Top | ![]() |
![]() |
![]() |
![]() |
librdf_statement * | (*librdf_stream_map_handler) () |
void | (*librdf_stream_map_free_context_handler) () |
librdf_stream * | librdf_new_stream () |
librdf_stream * | librdf_new_stream_from_node_iterator () |
librdf_stream * | librdf_new_empty_stream () |
void | librdf_free_stream () |
int | librdf_stream_end () |
int | librdf_stream_next () |
librdf_statement * | librdf_stream_get_object () |
void * | librdf_stream_get_context () |
librdf_node * | librdf_stream_get_context2 () |
int | librdf_stream_add_map () |
void | librdf_stream_print () |
int | librdf_stream_write () |
librdf_statement * (*librdf_stream_map_handler) (librdf_stream *stream
,void *map_context
,librdf_statement *item
);
Map function for a librdf_stream map operation.
void
(*librdf_stream_map_free_context_handler)
(void *map_context
);
Free handler function for a librdf_stream map operation.
librdf_stream * librdf_new_stream (librdf_world *world
,void *context
,int (*is_end_method) (void*)
,int (*next_method) (void*)
,void* (*get_method) (void*, int)
,void (*finished_method) (void*)
);
Constructor - create a new librdf_stream.
Creates a new stream with an implementation based on the passed in
functions. The functions next_statement and end_of_stream will be called
multiple times until either of them signify the end of stream by
returning NULL or non 0 respectively. The finished function is called
once only when the stream object is destroyed with librdf_free_stream()
A mapping function can be set for the stream using librdf_stream_add_map()
function which allows the statements generated by the stream to be
filtered and/or altered as they are generated before passing back
to the user.
world |
redland world object |
|
context |
context to pass to the stream implementing objects |
|
is_end_method |
pointer to function to test for end of stream |
|
next_method |
pointer to function to move to the next statement in stream |
|
get_method |
pointer to function to get the current statement |
|
finished_method |
pointer to function to finish the stream. |
librdf_stream * librdf_new_stream_from_node_iterator (librdf_iterator *iterator
,librdf_statement *statement
,librdf_statement_part field
);
Constructor - create a new librdf_stream from an iterator of nodes.
Creates a new librdf_stream using the passed in librdf_iterator which generates a series of librdf_node objects. The resulting nodes are then inserted into the given statement and returned. The field attribute indicates which statement node is being generated.
iterator |
librdf_iterator of librdf_node objects |
|
statement |
librdf_statement prototype with one NULL node space |
|
field |
node part of statement |
librdf_stream *
librdf_new_empty_stream (librdf_world *world
);
Constructor - create a new librdf_stream with no content.
void
librdf_free_stream (librdf_stream *stream
);
Destructor - destroy an libdf_stream object.
int
librdf_stream_next (librdf_stream *stream
);
Move to the next librdf_statement in the stream.
librdf_statement *
librdf_stream_get_object (librdf_stream *stream
);
Get the current librdf_statement in the stream.
This method returns a SHARED pointer to the current statement object
which should be copied by the caller to preserve it if the stream
is moved on librdf_stream_next()
or if it should last after the
stream is closed. librdf_new_statement_from_statement()
can be used
for copying the statement.
void *
librdf_stream_get_context (librdf_stream *stream
);
librdf_stream_get_context
is deprecated and should not be used in newly-written code.
Get the context of the current object on the stream.
This method returns a SHARED pointer to the current context node object which should be copied by the caller to preserve it if the stream is moved on librdf_stream_next or if it should last after the stream is closed.
Deprecated
: Use librdf_stream_get_context2()
which returns a librdf_node
librdf_node *
librdf_stream_get_context2 (librdf_stream *stream
);
Get the context of the current object on the stream.
This method returns a SHARED pointer to the current context node object which should be copied by the caller to preserve it if the stream is moved on librdf_stream_next or if it should last after the stream is closed.
int librdf_stream_add_map (librdf_stream *stream
,librdf_stream_map_handler map_function
,librdf_stream_map_free_context_handler free_context
,void *map_context
);
Add a librdf_stream mapping function.
Adds an stream mapping function which operates over the stream to select which elements are returned; it will be applied as soon as this method is called.
Several mapping functions can be added and they are applied in the order given.
The mapping function should return the statement to return, or NULL to remove it from the stream.
void librdf_stream_print (librdf_stream *stream
,FILE *fh
);
librdf_stream_print
is deprecated and should not be used in newly-written code.
Print the stream.
This prints the remaining statements of the stream to the given
file handle. Note that after this method is called the stream
will be empty so that librdf_stream_end()
will always be true
and librdf_stream_next()
will always return NULL. The only
useful operation is to dispose of the stream with the
librdf_free_stream()
destructor.
This method is for debugging and the format of the output should not be relied on.
Deprecated
: Use librdf_stream_write()
to write to
raptor_iostream which can be made to write to a string. Use a
librdf_serializer to write proper syntax formats.
int librdf_stream_write (librdf_stream *stream
,raptor_iostream *iostr
);
Write a stream of triples to an iostream in a debug format.
This prints the remaining statements of the stream to the given raptor_iostream in a debug format.
Note that after this method is called the stream will be empty so
that librdf_stream_end()
will always be true and
librdf_stream_next()
will always return NULL. The only useful
operation is to dispose of the stream with the
librdf_free_stream()
destructor.
This method is for debugging and the format of the output should not be relied on. In particular, when contexts are used the result may be 4 nodes.
Flags for librdf_new_stream()
get_method function pointer.
get object from iterator - implementing |
||
get context from iterator - implementing |