stream/iterator map context nodes (Re: [redland-dev] [patch]
jfieber at adobe.com
Wed May 7 16:53:57 BST 2008
On May 7, 2008, at 1:38 AM, Dave Beckett wrote:
> Lauri Aalto wrote:
>> [adding APIs for stream/iterator map callbacks that supply context
> Seems fine to me, but do you have a use for this? If the answer is
> yes then I'd be more confident that this is the right API.
I have an application that depends (critically) on being able to
examine the context nodes in an iterator/stream. I could, of course,
create my own iterator wrapper, but the map function is much simpler
(== less code == less opportunity for bugs), but I need access to the
context node in the map function.
While adding additional map_handler forms would address the problem, I
think it would be cleaner to add a map_handler-safe version of
librdf_[iterator|stream]_get_context, or work out a way to make the
existing function map_handler safe, i.e. not result in a recursive
call to librdf_[iterator|stream]_update_current_element(). It might
do to change boolean "is_updated" into three states to include
"is_mapping" to break the infinite recursion in librdf_[iterator|
stream]_update_current_element() when processing mapping functions.
If I get a few spare cycles I'll investigate this.
More information about the redland-dev