| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 5 | <title>Stream of triples (#librdf_statement).</title> |
| 6 | <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> |
| 7 | <link rel="home" href="index.html" title="Redland RDF Library Manual"> |
| 8 | <link rel="up" href="reference-manual.html" title="Part II. Reference Manual"> |
| 9 | <link rel="prev" href="redland-storage-module-virtuoso.html" title="Store 'virtuoso'"> |
| 10 | <link rel="next" href="redland-unicode.html" title="Unicode"> |
| 11 | <meta name="generator" content="GTK-Doc V1.18 (XML mode)"> |
| 12 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 13 | </head> |
| 14 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| 15 | <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> |
| 16 | <tr valign="middle"> |
| 17 | <td><a accesskey="p" href="redland-storage-module-virtuoso.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> |
| 18 | <td><a accesskey="u" href="reference-manual.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> |
| 19 | <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> |
| 20 | <th width="100%" align="center">Redland RDF Library Manual</th> |
| 21 | <td><a accesskey="n" href="redland-unicode.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> |
| 22 | </tr> |
| 23 | <tr><td colspan="5" class="shortcuts"> |
| 24 | <a href="#redland-stream.synopsis" class="shortcut">Top</a> |
| 25 | | |
| 26 | <a href="#redland-stream.description" class="shortcut">Description</a> |
| 27 | </td></tr> |
| 28 | </table> |
| 29 | <div class="refentry"> |
| 30 | <a name="redland-stream"></a><div class="titlepage"></div> |
| 31 | <div class="refnamediv"><table width="100%"><tr> |
| 32 | <td valign="top"> |
| 33 | <h2><span class="refentrytitle"><a name="redland-stream.top_of_page"></a>Stream of triples (#librdf_statement).</span></h2> |
| 34 | <p>Stream of triples (#librdf_statement). — Sequence of RDF Triples.</p> |
| 35 | </td> |
| 36 | <td valign="top" align="right"></td> |
| 37 | </tr></table></div> |
| 38 | <div class="refsynopsisdiv"> |
| 39 | <a name="redland-stream.synopsis"></a><h2>Synopsis</h2> |
| 40 | <pre class="synopsis">typedef <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream">librdf_stream</a>; |
| 41 | enum <a class="link" href="redland-stream.html#librdf-stream-get-method-flags" title="enum librdf_stream_get_method_flags">librdf_stream_get_method_flags</a>; |
| 42 | <a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="returnvalue">librdf_statement</span></a> * (<a class="link" href="redland-stream.html#librdf-stream-map-handler" title="librdf_stream_map_handler ()">*librdf_stream_map_handler</a>) (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 43 | <em class="parameter"><code><span class="type">void</span> *map_context</code></em>, |
| 44 | <em class="parameter"><code><a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a> *item</code></em>); |
| 45 | <span class="returnvalue">void</span> (<a class="link" href="redland-stream.html#librdf-stream-map-free-context-handler" title="librdf_stream_map_free_context_handler ()">*librdf_stream_map_free_context_handler</a>) |
| 46 | (<em class="parameter"><code><span class="type">void</span> *map_context</code></em>); |
| 47 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="returnvalue">librdf_stream</span></a> * <a class="link" href="redland-stream.html#librdf-new-stream" title="librdf_new_stream ()">librdf_new_stream</a> (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 48 | <em class="parameter"><code><span class="type">void</span> *context</code></em>, |
| 49 | <em class="parameter"><code><span class="type">int</span> (*is_end_method) (void*)</code></em>, |
| 50 | <em class="parameter"><code><span class="type">int</span> (*next_method) (void*)</code></em>, |
| 51 | <em class="parameter"><code><span class="type">void</span>* (*get_method) (void*, int)</code></em>, |
| 52 | <em class="parameter"><code><span class="type">void</span> (*finished_method) (void*)</code></em>); |
| 53 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="returnvalue">librdf_stream</span></a> * <a class="link" href="redland-stream.html#librdf-new-stream-from-node-iterator" title="librdf_new_stream_from_node_iterator ()">librdf_new_stream_from_node_iterator</a> |
| 54 | (<em class="parameter"><code><a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="type">librdf_iterator</span></a> *iterator</code></em>, |
| 55 | <em class="parameter"><code><a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a> *statement</code></em>, |
| 56 | <em class="parameter"><code><a class="link" href="redland-statement.html#librdf-statement-part" title="enum librdf_statement_part"><span class="type">librdf_statement_part</span></a> field</code></em>); |
| 57 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="returnvalue">librdf_stream</span></a> * <a class="link" href="redland-stream.html#librdf-new-empty-stream" title="librdf_new_empty_stream ()">librdf_new_empty_stream</a> (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>); |
| 58 | <span class="returnvalue">void</span> <a class="link" href="redland-stream.html#librdf-free-stream" title="librdf_free_stream ()">librdf_free_stream</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>); |
| 59 | <span class="returnvalue">int</span> <a class="link" href="redland-stream.html#librdf-stream-end" title="librdf_stream_end ()">librdf_stream_end</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>); |
| 60 | <span class="returnvalue">int</span> <a class="link" href="redland-stream.html#librdf-stream-next" title="librdf_stream_next ()">librdf_stream_next</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>); |
| 61 | <a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="returnvalue">librdf_statement</span></a> * <a class="link" href="redland-stream.html#librdf-stream-get-object" title="librdf_stream_get_object ()">librdf_stream_get_object</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>); |
| 62 | <span class="returnvalue">void</span> * <a class="link" href="redland-stream.html#librdf-stream-get-context" title="librdf_stream_get_context ()">librdf_stream_get_context</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>); |
| 63 | <a class="link" href="redland-node.html#librdf-node" title="librdf_node"><span class="returnvalue">librdf_node</span></a> * <a class="link" href="redland-stream.html#librdf-stream-get-context2" title="librdf_stream_get_context2 ()">librdf_stream_get_context2</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>); |
| 64 | <span class="returnvalue">int</span> <a class="link" href="redland-stream.html#librdf-stream-add-map" title="librdf_stream_add_map ()">librdf_stream_add_map</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 65 | <em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream-map-handler" title="librdf_stream_map_handler ()"><span class="type">librdf_stream_map_handler</span></a> map_function</code></em>, |
| 66 | <em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream-map-free-context-handler" title="librdf_stream_map_free_context_handler ()"><span class="type">librdf_stream_map_free_context_handler</span></a> free_context</code></em>, |
| 67 | <em class="parameter"><code><span class="type">void</span> *map_context</code></em>); |
| 68 | <span class="returnvalue">void</span> <a class="link" href="redland-stream.html#librdf-stream-print" title="librdf_stream_print ()">librdf_stream_print</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 69 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>); |
| 70 | <span class="returnvalue">int</span> <a class="link" href="redland-stream.html#librdf-stream-write" title="librdf_stream_write ()">librdf_stream_write</a> (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 71 | <em class="parameter"><code><span class="type">raptor_iostream</span> *iostr</code></em>); |
| 72 | </pre> |
| 73 | </div> |
| 74 | <div class="refsect1"> |
| 75 | <a name="redland-stream.description"></a><h2>Description</h2> |
| 76 | <p> |
| 77 | Iterate a sequence of RDF triples from some object. |
| 78 | </p> |
| 79 | </div> |
| 80 | <div class="refsect1"> |
| 81 | <a name="redland-stream.details"></a><h2>Details</h2> |
| 82 | <div class="refsect2"> |
| 83 | <a name="librdf-stream"></a><h3>librdf_stream</h3> |
| 84 | <pre class="programlisting">typedef struct librdf_stream_s librdf_stream; |
| 85 | </pre> |
| 86 | <p> |
| 87 | Redland stream class. |
| 88 | </p> |
| 89 | </div> |
| 90 | <hr> |
| 91 | <div class="refsect2"> |
| 92 | <a name="librdf-stream-get-method-flags"></a><h3>enum librdf_stream_get_method_flags</h3> |
| 93 | <pre class="programlisting">typedef enum { |
| 94 | LIBRDF_STREAM_GET_METHOD_GET_OBJECT = LIBRDF_ITERATOR_GET_METHOD_GET_OBJECT, |
| 95 | LIBRDF_STREAM_GET_METHOD_GET_CONTEXT = LIBRDF_ITERATOR_GET_METHOD_GET_CONTEXT |
| 96 | } librdf_stream_get_method_flags; |
| 97 | </pre> |
| 98 | <p> |
| 99 | Flags for <a class="link" href="redland-stream.html#librdf-new-stream" title="librdf_new_stream ()"><code class="function">librdf_new_stream()</code></a> get_method function pointer. |
| 100 | </p> |
| 101 | <div class="variablelist"><table border="0"> |
| 102 | <col align="left" valign="top"> |
| 103 | <tbody> |
| 104 | <tr> |
| 105 | <td><p><a name="LIBRDF-STREAM-GET-METHOD-GET-OBJECT:CAPS"></a><span class="term"><code class="literal">LIBRDF_STREAM_GET_METHOD_GET_OBJECT</code></span></p></td> |
| 106 | <td>get object from iterator - implementing <a class="link" href="redland-stream.html#librdf-stream-get-object" title="librdf_stream_get_object ()"><code class="function">librdf_stream_get_object()</code></a> |
| 107 | </td> |
| 108 | </tr> |
| 109 | <tr> |
| 110 | <td><p><a name="LIBRDF-STREAM-GET-METHOD-GET-CONTEXT:CAPS"></a><span class="term"><code class="literal">LIBRDF_STREAM_GET_METHOD_GET_CONTEXT</code></span></p></td> |
| 111 | <td>get context from iterator - implementing <a class="link" href="redland-stream.html#librdf-stream-get-context" title="librdf_stream_get_context ()"><code class="function">librdf_stream_get_context()</code></a> |
| 112 | </td> |
| 113 | </tr> |
| 114 | </tbody> |
| 115 | </table></div> |
| 116 | </div> |
| 117 | <hr> |
| 118 | <div class="refsect2"> |
| 119 | <a name="librdf-stream-map-handler"></a><h3>librdf_stream_map_handler ()</h3> |
| 120 | <pre class="programlisting"><a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="returnvalue">librdf_statement</span></a> * (*librdf_stream_map_handler) (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 121 | <em class="parameter"><code><span class="type">void</span> *map_context</code></em>, |
| 122 | <em class="parameter"><code><a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a> *item</code></em>);</pre> |
| 123 | <p> |
| 124 | Map function for a <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> map operation. |
| 125 | </p> |
| 126 | <p> |
| 127 | See <a class="link" href="redland-stream.html#librdf-stream-add-map" title="librdf_stream_add_map ()"><code class="function">librdf_stream_add_map()</code></a>. |
| 128 | </p> |
| 129 | <div class="variablelist"><table border="0"> |
| 130 | <col align="left" valign="top"> |
| 131 | <tbody> |
| 132 | <tr> |
| 133 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 134 | <td>Stream that this map is operating over.</td> |
| 135 | </tr> |
| 136 | <tr> |
| 137 | <td><p><span class="term"><em class="parameter"><code>map_context</code></em> :</span></p></td> |
| 138 | <td>Map data context pointer.</td> |
| 139 | </tr> |
| 140 | <tr> |
| 141 | <td><p><span class="term"><em class="parameter"><code>item</code></em> :</span></p></td> |
| 142 | <td>Pointer to the current item in the iteration.</td> |
| 143 | </tr> |
| 144 | <tr> |
| 145 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 146 | <td>item in keep the iteration or NULL to remove it</td> |
| 147 | </tr> |
| 148 | </tbody> |
| 149 | </table></div> |
| 150 | </div> |
| 151 | <hr> |
| 152 | <div class="refsect2"> |
| 153 | <a name="librdf-stream-map-free-context-handler"></a><h3>librdf_stream_map_free_context_handler ()</h3> |
| 154 | <pre class="programlisting"><span class="returnvalue">void</span> (*librdf_stream_map_free_context_handler) |
| 155 | (<em class="parameter"><code><span class="type">void</span> *map_context</code></em>);</pre> |
| 156 | <p> |
| 157 | Free handler function for a <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> map operation. |
| 158 | </p> |
| 159 | <p> |
| 160 | See <a class="link" href="redland-stream.html#librdf-stream-add-map" title="librdf_stream_add_map ()"><code class="function">librdf_stream_add_map()</code></a>. |
| 161 | </p> |
| 162 | <div class="variablelist"><table border="0"> |
| 163 | <col align="left" valign="top"> |
| 164 | <tbody><tr> |
| 165 | <td><p><span class="term"><em class="parameter"><code>map_context</code></em> :</span></p></td> |
| 166 | <td>Map data context pointer.</td> |
| 167 | </tr></tbody> |
| 168 | </table></div> |
| 169 | </div> |
| 170 | <hr> |
| 171 | <div class="refsect2"> |
| 172 | <a name="librdf-new-stream"></a><h3>librdf_new_stream ()</h3> |
| 173 | <pre class="programlisting"><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="returnvalue">librdf_stream</span></a> * librdf_new_stream (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>, |
| 174 | <em class="parameter"><code><span class="type">void</span> *context</code></em>, |
| 175 | <em class="parameter"><code><span class="type">int</span> (*is_end_method) (void*)</code></em>, |
| 176 | <em class="parameter"><code><span class="type">int</span> (*next_method) (void*)</code></em>, |
| 177 | <em class="parameter"><code><span class="type">void</span>* (*get_method) (void*, int)</code></em>, |
| 178 | <em class="parameter"><code><span class="type">void</span> (*finished_method) (void*)</code></em>);</pre> |
| 179 | <p> |
| 180 | Constructor - create a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a>. |
| 181 | </p> |
| 182 | <p> |
| 183 | Creates a new stream with an implementation based on the passed in |
| 184 | functions. The functions next_statement and end_of_stream will be called |
| 185 | multiple times until either of them signify the end of stream by |
| 186 | returning NULL or non 0 respectively. The finished function is called |
| 187 | once only when the stream object is destroyed with <a class="link" href="redland-stream.html#librdf-free-stream" title="librdf_free_stream ()"><code class="function">librdf_free_stream()</code></a> |
| 188 | </p> |
| 189 | <p> |
| 190 | A mapping function can be set for the stream using <a class="link" href="redland-stream.html#librdf-stream-add-map" title="librdf_stream_add_map ()"><code class="function">librdf_stream_add_map()</code></a> |
| 191 | function which allows the statements generated by the stream to be |
| 192 | filtered and/or altered as they are generated before passing back |
| 193 | to the user. |
| 194 | </p> |
| 195 | <div class="variablelist"><table border="0"> |
| 196 | <col align="left" valign="top"> |
| 197 | <tbody> |
| 198 | <tr> |
| 199 | <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td> |
| 200 | <td>redland world object</td> |
| 201 | </tr> |
| 202 | <tr> |
| 203 | <td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td> |
| 204 | <td>context to pass to the stream implementing objects</td> |
| 205 | </tr> |
| 206 | <tr> |
| 207 | <td><p><span class="term"><em class="parameter"><code>is_end_method</code></em> :</span></p></td> |
| 208 | <td>pointer to function to test for end of stream</td> |
| 209 | </tr> |
| 210 | <tr> |
| 211 | <td><p><span class="term"><em class="parameter"><code>next_method</code></em> :</span></p></td> |
| 212 | <td>pointer to function to move to the next statement in stream</td> |
| 213 | </tr> |
| 214 | <tr> |
| 215 | <td><p><span class="term"><em class="parameter"><code>get_method</code></em> :</span></p></td> |
| 216 | <td>pointer to function to get the current statement</td> |
| 217 | </tr> |
| 218 | <tr> |
| 219 | <td><p><span class="term"><em class="parameter"><code>finished_method</code></em> :</span></p></td> |
| 220 | <td>pointer to function to finish the stream.</td> |
| 221 | </tr> |
| 222 | <tr> |
| 223 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 224 | <td>a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object or NULL on failure</td> |
| 225 | </tr> |
| 226 | </tbody> |
| 227 | </table></div> |
| 228 | </div> |
| 229 | <hr> |
| 230 | <div class="refsect2"> |
| 231 | <a name="librdf-new-stream-from-node-iterator"></a><h3>librdf_new_stream_from_node_iterator ()</h3> |
| 232 | <pre class="programlisting"><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="returnvalue">librdf_stream</span></a> * librdf_new_stream_from_node_iterator |
| 233 | (<em class="parameter"><code><a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="type">librdf_iterator</span></a> *iterator</code></em>, |
| 234 | <em class="parameter"><code><a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a> *statement</code></em>, |
| 235 | <em class="parameter"><code><a class="link" href="redland-statement.html#librdf-statement-part" title="enum librdf_statement_part"><span class="type">librdf_statement_part</span></a> field</code></em>);</pre> |
| 236 | <p> |
| 237 | Constructor - create a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> from an iterator of nodes. |
| 238 | </p> |
| 239 | <p> |
| 240 | Creates a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> using the passed in <a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="type">librdf_iterator</span></a> |
| 241 | which generates a series of <a class="link" href="redland-node.html#librdf-node" title="librdf_node"><span class="type">librdf_node</span></a> objects. The resulting |
| 242 | nodes are then inserted into the given statement and returned. |
| 243 | The field attribute indicates which statement node is being generated. |
| 244 | </p> |
| 245 | <div class="variablelist"><table border="0"> |
| 246 | <col align="left" valign="top"> |
| 247 | <tbody> |
| 248 | <tr> |
| 249 | <td><p><span class="term"><em class="parameter"><code>iterator</code></em> :</span></p></td> |
| 250 | <td> |
| 251 | <a class="link" href="redland-iterator.html#librdf-iterator" title="librdf_iterator"><span class="type">librdf_iterator</span></a> of <a class="link" href="redland-node.html#librdf-node" title="librdf_node"><span class="type">librdf_node</span></a> objects</td> |
| 252 | </tr> |
| 253 | <tr> |
| 254 | <td><p><span class="term"><em class="parameter"><code>statement</code></em> :</span></p></td> |
| 255 | <td> |
| 256 | <a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a> prototype with one NULL node space</td> |
| 257 | </tr> |
| 258 | <tr> |
| 259 | <td><p><span class="term"><em class="parameter"><code>field</code></em> :</span></p></td> |
| 260 | <td>node part of statement</td> |
| 261 | </tr> |
| 262 | <tr> |
| 263 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 264 | <td>a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object or NULL on failure</td> |
| 265 | </tr> |
| 266 | </tbody> |
| 267 | </table></div> |
| 268 | </div> |
| 269 | <hr> |
| 270 | <div class="refsect2"> |
| 271 | <a name="librdf-new-empty-stream"></a><h3>librdf_new_empty_stream ()</h3> |
| 272 | <pre class="programlisting"><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="returnvalue">librdf_stream</span></a> * librdf_new_empty_stream (<em class="parameter"><code><a class="link" href="redland-world.html#librdf-world" title="librdf_world"><span class="type">librdf_world</span></a> *world</code></em>);</pre> |
| 273 | <p> |
| 274 | Constructor - create a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> with no content. |
| 275 | </p> |
| 276 | <div class="variablelist"><table border="0"> |
| 277 | <col align="left" valign="top"> |
| 278 | <tbody> |
| 279 | <tr> |
| 280 | <td><p><span class="term"><em class="parameter"><code>world</code></em> :</span></p></td> |
| 281 | <td>redland world object</td> |
| 282 | </tr> |
| 283 | <tr> |
| 284 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 285 | <td>a new <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object or NULL on failure</td> |
| 286 | </tr> |
| 287 | </tbody> |
| 288 | </table></div> |
| 289 | </div> |
| 290 | <hr> |
| 291 | <div class="refsect2"> |
| 292 | <a name="librdf-free-stream"></a><h3>librdf_free_stream ()</h3> |
| 293 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_free_stream (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>);</pre> |
| 294 | <p> |
| 295 | Destructor - destroy an <span class="type">libdf_stream</span> object. |
| 296 | </p> |
| 297 | <div class="variablelist"><table border="0"> |
| 298 | <col align="left" valign="top"> |
| 299 | <tbody><tr> |
| 300 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 301 | <td> |
| 302 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object</td> |
| 303 | </tr></tbody> |
| 304 | </table></div> |
| 305 | </div> |
| 306 | <hr> |
| 307 | <div class="refsect2"> |
| 308 | <a name="librdf-stream-end"></a><h3>librdf_stream_end ()</h3> |
| 309 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_stream_end (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>);</pre> |
| 310 | <p> |
| 311 | Test if the stream has ended. |
| 312 | </p> |
| 313 | <div class="variablelist"><table border="0"> |
| 314 | <col align="left" valign="top"> |
| 315 | <tbody> |
| 316 | <tr> |
| 317 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 318 | <td> |
| 319 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object</td> |
| 320 | </tr> |
| 321 | <tr> |
| 322 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 323 | <td>non 0 at end of stream.</td> |
| 324 | </tr> |
| 325 | </tbody> |
| 326 | </table></div> |
| 327 | </div> |
| 328 | <hr> |
| 329 | <div class="refsect2"> |
| 330 | <a name="librdf-stream-next"></a><h3>librdf_stream_next ()</h3> |
| 331 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_stream_next (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>);</pre> |
| 332 | <p> |
| 333 | Move to the next librdf_statement in the stream. |
| 334 | </p> |
| 335 | <div class="variablelist"><table border="0"> |
| 336 | <col align="left" valign="top"> |
| 337 | <tbody> |
| 338 | <tr> |
| 339 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 340 | <td> |
| 341 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object</td> |
| 342 | </tr> |
| 343 | <tr> |
| 344 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 345 | <td>non 0 if the stream has finished</td> |
| 346 | </tr> |
| 347 | </tbody> |
| 348 | </table></div> |
| 349 | </div> |
| 350 | <hr> |
| 351 | <div class="refsect2"> |
| 352 | <a name="librdf-stream-get-object"></a><h3>librdf_stream_get_object ()</h3> |
| 353 | <pre class="programlisting"><a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="returnvalue">librdf_statement</span></a> * librdf_stream_get_object (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>);</pre> |
| 354 | <p> |
| 355 | Get the current librdf_statement in the stream. |
| 356 | </p> |
| 357 | <p> |
| 358 | This method returns a SHARED pointer to the current statement object |
| 359 | which should be copied by the caller to preserve it if the stream |
| 360 | is moved on <a class="link" href="redland-stream.html#librdf-stream-next" title="librdf_stream_next ()"><code class="function">librdf_stream_next()</code></a> or if it should last after the |
| 361 | stream is closed. <a class="link" href="redland-statement.html#librdf-new-statement-from-statement" title="librdf_new_statement_from_statement ()"><code class="function">librdf_new_statement_from_statement()</code></a> can be used |
| 362 | for copying the statement. |
| 363 | </p> |
| 364 | <div class="variablelist"><table border="0"> |
| 365 | <col align="left" valign="top"> |
| 366 | <tbody> |
| 367 | <tr> |
| 368 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 369 | <td> |
| 370 | <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object</td> |
| 371 | </tr> |
| 372 | <tr> |
| 373 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 374 | <td>the current <a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a> object or NULL at end of stream.</td> |
| 375 | </tr> |
| 376 | </tbody> |
| 377 | </table></div> |
| 378 | </div> |
| 379 | <hr> |
| 380 | <div class="refsect2"> |
| 381 | <a name="librdf-stream-get-context"></a><h3>librdf_stream_get_context ()</h3> |
| 382 | <pre class="programlisting"><span class="returnvalue">void</span> * librdf_stream_get_context (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>);</pre> |
| 383 | <p> |
| 384 | Get the context of the current object on the stream. |
| 385 | </p> |
| 386 | <p> |
| 387 | This method returns a SHARED pointer to the current context node object |
| 388 | which should be copied by the caller to preserve it if the stream |
| 389 | is moved on librdf_stream_next or if it should last after the |
| 390 | stream is closed. |
| 391 | </p> |
| 392 | <p> |
| 393 | <em class="parameter"><code>Deprecated</code></em>: Use <a class="link" href="redland-stream.html#librdf-stream-get-context2" title="librdf_stream_get_context2 ()"><code class="function">librdf_stream_get_context2()</code></a> which returns a <a class="link" href="redland-node.html#librdf-node" title="librdf_node"><span class="type">librdf_node</span></a> |
| 394 | </p> |
| 395 | <div class="variablelist"><table border="0"> |
| 396 | <col align="left" valign="top"> |
| 397 | <tbody> |
| 398 | <tr> |
| 399 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 400 | <td>the <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object</td> |
| 401 | </tr> |
| 402 | <tr> |
| 403 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 404 | <td>The context node (can be NULL) or NULL if the stream has finished.</td> |
| 405 | </tr> |
| 406 | </tbody> |
| 407 | </table></div> |
| 408 | </div> |
| 409 | <hr> |
| 410 | <div class="refsect2"> |
| 411 | <a name="librdf-stream-get-context2"></a><h3>librdf_stream_get_context2 ()</h3> |
| 412 | <pre class="programlisting"><a class="link" href="redland-node.html#librdf-node" title="librdf_node"><span class="returnvalue">librdf_node</span></a> * librdf_stream_get_context2 (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>);</pre> |
| 413 | <p> |
| 414 | Get the context of the current object on the stream. |
| 415 | </p> |
| 416 | <p> |
| 417 | This method returns a SHARED pointer to the current context node object |
| 418 | which should be copied by the caller to preserve it if the stream |
| 419 | is moved on librdf_stream_next or if it should last after the |
| 420 | stream is closed. |
| 421 | </p> |
| 422 | <div class="variablelist"><table border="0"> |
| 423 | <col align="left" valign="top"> |
| 424 | <tbody> |
| 425 | <tr> |
| 426 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 427 | <td>the <a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> object</td> |
| 428 | </tr> |
| 429 | <tr> |
| 430 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 431 | <td>The context node (can be NULL) or NULL if the stream has finished.</td> |
| 432 | </tr> |
| 433 | </tbody> |
| 434 | </table></div> |
| 435 | </div> |
| 436 | <hr> |
| 437 | <div class="refsect2"> |
| 438 | <a name="librdf-stream-add-map"></a><h3>librdf_stream_add_map ()</h3> |
| 439 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_stream_add_map (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 440 | <em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream-map-handler" title="librdf_stream_map_handler ()"><span class="type">librdf_stream_map_handler</span></a> map_function</code></em>, |
| 441 | <em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream-map-free-context-handler" title="librdf_stream_map_free_context_handler ()"><span class="type">librdf_stream_map_free_context_handler</span></a> free_context</code></em>, |
| 442 | <em class="parameter"><code><span class="type">void</span> *map_context</code></em>);</pre> |
| 443 | <p> |
| 444 | Add a librdf_stream mapping function. |
| 445 | </p> |
| 446 | <p> |
| 447 | Adds an stream mapping function which operates over the stream to |
| 448 | select which elements are returned; it will be applied as soon as |
| 449 | this method is called. |
| 450 | </p> |
| 451 | <p> |
| 452 | Several mapping functions can be added and they are applied in |
| 453 | the order given. |
| 454 | </p> |
| 455 | <p> |
| 456 | The mapping function should return the statement to return, or NULL |
| 457 | to remove it from the stream. |
| 458 | </p> |
| 459 | <div class="variablelist"><table border="0"> |
| 460 | <col align="left" valign="top"> |
| 461 | <tbody> |
| 462 | <tr> |
| 463 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 464 | <td>the stream</td> |
| 465 | </tr> |
| 466 | <tr> |
| 467 | <td><p><span class="term"><em class="parameter"><code>map_function</code></em> :</span></p></td> |
| 468 | <td>the function to perform the mapping</td> |
| 469 | </tr> |
| 470 | <tr> |
| 471 | <td><p><span class="term"><em class="parameter"><code>free_context</code></em> :</span></p></td> |
| 472 | <td>the function to use to free the context (or NULL)</td> |
| 473 | </tr> |
| 474 | <tr> |
| 475 | <td><p><span class="term"><em class="parameter"><code>map_context</code></em> :</span></p></td> |
| 476 | <td>the context to pass to the map function</td> |
| 477 | </tr> |
| 478 | <tr> |
| 479 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 480 | <td>Non 0 on failure</td> |
| 481 | </tr> |
| 482 | </tbody> |
| 483 | </table></div> |
| 484 | </div> |
| 485 | <hr> |
| 486 | <div class="refsect2"> |
| 487 | <a name="librdf-stream-print"></a><h3>librdf_stream_print ()</h3> |
| 488 | <pre class="programlisting"><span class="returnvalue">void</span> librdf_stream_print (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 489 | <em class="parameter"><code><span class="type">FILE</span> *fh</code></em>);</pre> |
| 490 | <p> |
| 491 | Print the stream. |
| 492 | </p> |
| 493 | <p> |
| 494 | This prints the remaining statements of the stream to the given |
| 495 | file handle. Note that after this method is called the stream |
| 496 | will be empty so that <a class="link" href="redland-stream.html#librdf-stream-end" title="librdf_stream_end ()"><code class="function">librdf_stream_end()</code></a> will always be true |
| 497 | and <a class="link" href="redland-stream.html#librdf-stream-next" title="librdf_stream_next ()"><code class="function">librdf_stream_next()</code></a> will always return NULL. The only |
| 498 | useful operation is to dispose of the stream with the |
| 499 | <a class="link" href="redland-stream.html#librdf-free-stream" title="librdf_free_stream ()"><code class="function">librdf_free_stream()</code></a> destructor. |
| 500 | </p> |
| 501 | <p> |
| 502 | This method is for debugging and the format of the output should |
| 503 | not be relied on. |
| 504 | </p> |
| 505 | <p> |
| 506 | <em class="parameter"><code>Deprecated</code></em>: Use <a class="link" href="redland-stream.html#librdf-stream-write" title="librdf_stream_write ()"><code class="function">librdf_stream_write()</code></a> to write to |
| 507 | <span class="type">raptor_iostream</span> which can be made to write to a string. Use a |
| 508 | <a class="link" href="redland-serializer.html#librdf-serializer" title="librdf_serializer"><span class="type">librdf_serializer</span></a> to write proper syntax formats. |
| 509 | </p> |
| 510 | <div class="variablelist"><table border="0"> |
| 511 | <col align="left" valign="top"> |
| 512 | <tbody> |
| 513 | <tr> |
| 514 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 515 | <td>the stream object</td> |
| 516 | </tr> |
| 517 | <tr> |
| 518 | <td><p><span class="term"><em class="parameter"><code>fh</code></em> :</span></p></td> |
| 519 | <td>the FILE stream to print to</td> |
| 520 | </tr> |
| 521 | </tbody> |
| 522 | </table></div> |
| 523 | </div> |
| 524 | <hr> |
| 525 | <div class="refsect2"> |
| 526 | <a name="librdf-stream-write"></a><h3>librdf_stream_write ()</h3> |
| 527 | <pre class="programlisting"><span class="returnvalue">int</span> librdf_stream_write (<em class="parameter"><code><a class="link" href="redland-stream.html#librdf-stream" title="librdf_stream"><span class="type">librdf_stream</span></a> *stream</code></em>, |
| 528 | <em class="parameter"><code><span class="type">raptor_iostream</span> *iostr</code></em>);</pre> |
| 529 | <p> |
| 530 | Write a stream of triples to an iostream in a debug format. |
| 531 | </p> |
| 532 | <p> |
| 533 | This prints the remaining statements of the stream to the given |
| 534 | <span class="type">raptor_iostream</span> in a debug format. |
| 535 | </p> |
| 536 | <p> |
| 537 | Note that after this method is called the stream will be empty so |
| 538 | that <a class="link" href="redland-stream.html#librdf-stream-end" title="librdf_stream_end ()"><code class="function">librdf_stream_end()</code></a> will always be true and |
| 539 | <a class="link" href="redland-stream.html#librdf-stream-next" title="librdf_stream_next ()"><code class="function">librdf_stream_next()</code></a> will always return NULL. The only useful |
| 540 | operation is to dispose of the stream with the |
| 541 | <a class="link" href="redland-stream.html#librdf-free-stream" title="librdf_free_stream ()"><code class="function">librdf_free_stream()</code></a> destructor. |
| 542 | </p> |
| 543 | <p> |
| 544 | This method is for debugging and the format of the output should |
| 545 | not be relied on. In particular, when contexts are used the |
| 546 | result may be 4 nodes. |
| 547 | </p> |
| 548 | <div class="variablelist"><table border="0"> |
| 549 | <col align="left" valign="top"> |
| 550 | <tbody> |
| 551 | <tr> |
| 552 | <td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td> |
| 553 | <td>the stream object</td> |
| 554 | </tr> |
| 555 | <tr> |
| 556 | <td><p><span class="term"><em class="parameter"><code>iostr</code></em> :</span></p></td> |
| 557 | <td>the iostream to write to</td> |
| 558 | </tr> |
| 559 | <tr> |
| 560 | <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> |
| 561 | <td>non-0 on failure</td> |
| 562 | </tr> |
| 563 | </tbody> |
| 564 | </table></div> |
| 565 | </div> |
| 566 | </div> |
| 567 | <div class="refsect1"> |
| 568 | <a name="redland-stream.see-also"></a><h2>See Also</h2> |
| 569 | <p> |
| 570 | Provides a way to operate across a sequence of RDF Triples that are |
| 571 | generated one-by-one on demand. The generated triples can be from |
| 572 | some API call in the <a class="link" href="redland-model.html#librdf-model" title="librdf_model"><span class="type">librdf_model</span></a> class, from listing a graph content |
| 573 | as individual triples, from parsing a syntax or returning an RDF graph |
| 574 | result from a query. Streams can be passed into methods for the reverse |
| 575 | operations such as adding to a graph, serializing a graph to a syntax. |
| 576 | Streams pass individual triples (<a class="link" href="redland-statement.html#librdf-statement" title="librdf_statement"><span class="type">librdf_statement</span></a>) between objects |
| 577 | and are usually lazily generated and consumed. |
| 578 | </p> |
| 579 | </div> |
| 580 | </div> |
| 581 | <div class="footer"> |
| 582 | <hr> |
| 583 | Generated by GTK-Doc V1.18</div> |
| 584 | </body> |
| 585 | </html> |