/usr/share/gtk-doc/html/raptor/tutorial-serializer-to-destination.html is in libraptor1-doc 1.4.21-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Provide a destination for the serialized syntax</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Raptor RDF Syntax Parsing and Serializing Library Manual">
<link rel="up" href="tutorial-serializing.html" title="Serializing RDF triples to a syntax">
<link rel="prev" href="tutorial-serializer-set-error-warning-handlers.html" title="Set error and warning handlers">
<link rel="next" href="tutorial-serializer-get-triples.html" title="Get or construct RDF Triples">
<meta name="generator" content="GTK-Doc V1.13 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="introduction.html" title="Raptor Overview">
<link rel="part" href="tutorial.html" title="Part I. Raptor Tutorial">
<link rel="chapter" href="tutorial-initialising-finishing.html" title="Initialising and Finishing using the Library">
<link rel="chapter" href="tutorial-querying-functionality.html" title="Listing built-in functionality">
<link rel="chapter" href="tutorial-parsing.html" title="Parsing syntaxes to RDF Triples">
<link rel="chapter" href="tutorial-serializing.html" title="Serializing RDF triples to a syntax">
<link rel="part" href="reference-manual.html" title="Part II. Raptor Reference Manual">
<link rel="chapter" href="raptor-parsers.html" title="Parsers in Raptor (syntax to triples)">
<link rel="chapter" href="raptor-serializers.html" title="Serializers in Raptor (triples to syntax)">
<link rel="index" href="ix01.html" title="Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="tutorial-serializer-set-error-warning-handlers.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="tutorial-serializing.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Raptor RDF Syntax Parsing and Serializing Library Manual</th>
<td><a accesskey="n" href="tutorial-serializer-get-triples.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="section" title="Provide a destination for the serialized syntax">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="tutorial-serializer-to-destination"></a>Provide a destination for the serialized syntax</h2></div></div></div>
<p>The operation of turning RDF triples into a syntax has several
alternatives from functions that do most of the work writing to a file
or string to functions that allow passing in a
<a class="link" href="raptor-section-iostream.html#raptor-iostream" title="raptor_iostream"><span class="type">raptor_iostream</span></a>
which can be entirely user-constructed.</p>
<div class="section" title="Serialize to a filename (raptor_serialize_start_to_filename())">
<div class="titlepage"><div><div><h3 class="title">
<a name="serialize-to-filename"></a>Serialize to a filename (<a class="link" href="raptor-section-serializer.html#raptor-serialize-start-to-filename" title="raptor_serialize_start_to_filename ()"><code class="function">raptor_serialize_start_to_filename()</code></a>)</h3></div></div></div>
<p>Serialize to a new filename
(using <a class="link" href="raptor-section-iostream.html#raptor-new-iostream-to-filename" title="raptor_new_iostream_to_filename ()"><code class="function">raptor_new_iostream_to_filename()</code></a> internally)
and uses asf base URI, the file's URI.
</p>
<pre class="programlisting">
const char *filename="raptor.rdf";
raptor_serialize_start_to_filename(rdf_serializer, filename);
</pre>
<p>
</p>
</div>
<div class="section" title="Serialize to a string (raptor_serialize_start_to_string())">
<div class="titlepage"><div><div><h3 class="title">
<a name="serialize-to-string"></a>Serialize to a string (<a class="link" href="raptor-section-serializer.html#raptor-serialize-start-to-string" title="raptor_serialize_start_to_string ()"><code class="function">raptor_serialize_start_to_string()</code></a>)</h3></div></div></div>
<p>Serialize to a string that is allocated by the serializer
(using <a class="link" href="raptor-section-iostream.html#raptor-new-iostream-to-string" title="raptor_new_iostream_to_string ()"><code class="function">raptor_new_iostream_to_string()</code></a> internally). The
resulting string is only constructed after <a class="link" href="raptor-section-serializer.html#raptor-serialize-end" title="raptor_serialize_end ()"><code class="function">raptor_serialize_end()</code></a> is called and at that
point it is assigned to the string pointer passed in, with the length
written to the optional length pointer. This function
takes an optional base URI but may be required by some serializers.
</p>
<pre class="programlisting">
raptor_uri* uri=raptor_new_uri("http://example.org/base");
void *string; /* destination for string */
size_t length; /* length of constructed string */
raptor_serialize_start_to_string(rdf_serializer, uri,
&string, &length);
</pre>
<p>
</p>
</div>
<div class="section" title="Serialize to a FILE* file handle (raptor_serialize_start_to_file_handle())">
<div class="titlepage"><div><div><h3 class="title">
<a name="serialize-to-filehandle"></a>Serialize to a FILE* file handle (<a class="link" href="raptor-section-serializer.html#raptor-serialize-start-to-file-handle" title="raptor_serialize_start_to_file_handle ()"><code class="function">raptor_serialize_start_to_file_handle()</code></a>)</h3></div></div></div>
<p>Serialize to an existing open C FILE* file handle
(using <a class="link" href="raptor-section-iostream.html#raptor-new-iostream-to-file-handle" title="raptor_new_iostream_to_file_handle ()"><code class="function">raptor_new_iostream_to_file_handle()</code></a> internally). The handle is not closed after serializing is finished. This function
takes an optional base URI but may be required by some serializers.
</p>
<pre class="programlisting">
raptor_uri* uri=raptor_new_uri("http://example.org/base");
FILE* fh=fopen("raptor.rdf", "wb");
raptor_serialize_start_to_file_handle(rdf_serializer, uri, fh);
</pre>
<p>
</p>
</div>
<div class="section" title="Serialize to an raptor_iostream (raptor_serialize_start_to_iostream())">
<div class="titlepage"><div><div><h3 class="title">
<a name="serialize-to-iostream"></a>Serialize to an <a class="link" href="raptor-section-iostream.html#raptor-iostream" title="raptor_iostream"><span class="type">raptor_iostream</span></a> (<a class="link" href="raptor-section-serializer.html#raptor-serialize-start-to-iostream" title="raptor_serialize_start_to_iostream ()"><code class="function">raptor_serialize_start_to_iostream()</code></a>)</h3></div></div></div>
<p>This is the most flexible serializing method as it allows
writing to any
<a class="link" href="raptor-section-iostream.html#raptor-iostream" title="raptor_iostream"><span class="type">raptor_iostream</span></a>
which can be constructed to build any form of user-generated structure
via callbacks. The iostream remains owned by the caller that can continue
to write to it after the serializing is finished (after
<a class="link" href="raptor-section-serializer.html#raptor-serialize-end" title="raptor_serialize_end ()"><code class="function">raptor_serialize_end()</code></a>) is called).
</p>
<pre class="programlisting">
raptor_uri* uri=raptor_new_uri("http://example.org/base");
raptor_iostream* iostream = /* iostream initialized by some means */ ;
raptor_serialize_start_to_iostream(rdf_serializer, uri, iostream);
while( /* got RDF triples */ ) {
raptor_statement* triple = /* ... triple made from somewhere ... */ ;
raptor_serialize_statement(rdf_serializer, triple);
}
raptor_serialize_end(rdf_serializer);
raptor_free_serializer(rdf_serializer);
/* ... write other stuff to iostream ... */
raptor_free_iostream(iostream);
</pre>
<p>
</p>
</div>
<div class="section" title="Serialize to an raptor_iostream and close iostream (raptor_serialize_start())">
<div class="titlepage"><div><div><h3 class="title">
<a name="serialize-to-iostream-old"></a>Serialize to an <a class="link" href="raptor-section-iostream.html#raptor-iostream" title="raptor_iostream"><span class="type">raptor_iostream</span></a> and close iostream (<a class="link" href="raptor-section-serializer.html#raptor-serialize-start" title="raptor_serialize_start ()"><code class="function">raptor_serialize_start()</code></a>)</h3></div></div></div>
<p><a class="link" href="raptor-section-serializer.html#raptor-serialize-start" title="raptor_serialize_start ()"><code class="function">raptor_serialize_start()</code></a>
also serializes to an iostream like
<a class="link" href="raptor-section-serializer.html#raptor-serialize-start-to-iostream" title="raptor_serialize_start_to_iostream ()"><code class="function">raptor_serialize_start_to_iostream()</code></a>
but it becomes the owner of the passed in
<a class="link" href="raptor-section-iostream.html#raptor-iostream" title="raptor_iostream"><span class="type">raptor_iostream</span></a>
and destroys it at the end of serializing, so no further use of the
iostream can be made by the caller.
</p>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.13</div>
</body>
</html>
|