<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>RDF Triple (librdf_statement)</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.71.0">
<link rel="start" href="index.html" title="Redland RDF Application Framework Manual">
<link rel="up" href="pt02.html" title="Part II. Reference Manual">
<link rel="prev" href="redland-serializer.html" title="Serializers">
<link rel="next" href="redland-storage.html" title="Triple stores.">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="redland.html" title="Redland Overview">
<link rel="chapter" href="introduction.html" title="Introduction">
<link rel="part" href="pt01.html" title="Part I. Tutorial">
<link rel="part" href="pt02.html" title="Part II. Reference Manual">
<link rel="chapter" href="objects.html" title="Objects in C">
<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="redland-serializer.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="pt02.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">Redland RDF Application Framework Manual</th>
<td><a accesskey="n" href="redland-storage.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2601583" class="shortcut">Top</a>
 | 
<a href="#id2634685" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="redland-statement"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2601583"></a><span class="refentrytitle">RDF Triple (librdf_statement)</span>
</h2>
<p>RDF Triple (librdf_statement) — RDF Triple.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
typedef <a href="redland-statement.html#librdf-statement">librdf_statement</a>;
enum <a href="redland-statement.html#librdf-statement-part">librdf_statement_part</a>;
<a href="redland-statement.html#librdf-statement">librdf_statement</a>* <a href="redland-statement.html#librdf-new-statement">librdf_new_statement</a> (<a href="redland-world.html#librdf-world">librdf_world</a> *world);
<a href="redland-statement.html#librdf-statement">librdf_statement</a>* <a href="redland-statement.html#librdf-new-statement-from-statement">librdf_new_statement_from_statement</a>
(<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
<a href="redland-statement.html#librdf-statement">librdf_statement</a>* <a href="redland-statement.html#librdf-new-statement-from-nodes">librdf_new_statement_from_nodes</a>
(<a href="redland-world.html#librdf-world">librdf_world</a> *world,
<a href="redland-node.html#librdf-node">librdf_node</a> *subject,
<a href="redland-node.html#librdf-node">librdf_node</a> *predicate,
<a href="redland-node.html#librdf-node">librdf_node</a> *object);
void <a href="redland-statement.html#librdf-statement-init">librdf_statement_init</a> (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
void <a href="redland-statement.html#librdf-statement-clear">librdf_statement_clear</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
void <a href="redland-statement.html#librdf-free-statement">librdf_free_statement</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-statement.html#librdf-statement-get-subject">librdf_statement_get_subject</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
void <a href="redland-statement.html#librdf-statement-set-subject">librdf_statement_set_subject</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *node);
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-statement.html#librdf-statement-get-predicate">librdf_statement_get_predicate</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
void <a href="redland-statement.html#librdf-statement-set-predicate">librdf_statement_set_predicate</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *node);
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-statement.html#librdf-statement-get-object">librdf_statement_get_object</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
void <a href="redland-statement.html#librdf-statement-set-object">librdf_statement_set_object</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *node);
int <a href="redland-statement.html#librdf-statement-is-complete">librdf_statement_is_complete</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
unsigned char* <a href="redland-statement.html#librdf-statement-to-string">librdf_statement_to_string</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
void <a href="redland-statement.html#librdf-statement-print">librdf_statement_print</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
FILE *fh);
int <a href="redland-statement.html#librdf-statement-equals">librdf_statement_equals</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement1,
<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement2);
int <a href="redland-statement.html#librdf-statement-match">librdf_statement_match</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-statement.html#librdf-statement">librdf_statement</a> *partial_statement);
size_t <a href="redland-statement.html#librdf-statement-encode">librdf_statement_encode</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
unsigned char *buffer,
size_t length);
size_t <a href="redland-statement.html#librdf-statement-encode-parts">librdf_statement_encode_parts</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *context_node,
unsigned char *buffer,
size_t length,
<a href="redland-statement.html#librdf-statement-part">librdf_statement_part</a> fields);
size_t <a href="redland-statement.html#librdf-statement-decode">librdf_statement_decode</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
unsigned char *buffer,
size_t length);
size_t <a href="redland-statement.html#librdf-statement-decode-parts">librdf_statement_decode_parts</a> (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> **context_node,
unsigned char *buffer,
size_t length);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2634685"></a><h2>Description</h2>
<p>
An object representing an RDF Triple of three RDF terms (<a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a>).
Triples can be created, accessed, destroyed and en/decoded into a binary
form for use in storage.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2634710"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2634721"></a><h3>
<a name="librdf-statement"></a>librdf_statement</h3>
<a class="indexterm" name="id2634734"></a><pre class="programlisting">typedef struct librdf_statement_s librdf_statement;
</pre>
<p>
Redland statement class.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2634754"></a><h3>
<a name="librdf-statement-part"></a>enum librdf_statement_part</h3>
<a class="indexterm" name="id2634765"></a><pre class="programlisting">typedef enum {
LIBRDF_STATEMENT_SUBJECT = 1 << 0,
LIBRDF_STATEMENT_PREDICATE = 1 << 1,
LIBRDF_STATEMENT_OBJECT = 1 << 2,
/* must be a combination of all of the above */
LIBRDF_STATEMENT_ALL = (LIBRDF_STATEMENT_SUBJECT|
LIBRDF_STATEMENT_PREDICATE|
LIBRDF_STATEMENT_OBJECT)
} librdf_statement_part;
</pre>
<p>
Flags that are or-ed to indicate statement parts.
</p>
<p>
Used in fields arguments to methods such as the public
<a href="redland-statement.html#librdf-statement-encode-parts"><code class="function">librdf_statement_encode_parts()</code></a> <a href="redland-statement.html#librdf-statement-decode-parts"><code class="function">librdf_statement_decode_parts()</code></a>
<a href="redland-stream.html#librdf-new-stream-from-node-iterator"><code class="function">librdf_new_stream_from_node_iterator()</code></a> and the internal
<code class="function">librdf_storage_node_stream_to_node_create()</code></p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a name="LIBRDF-STATEMENT-SUBJECT:CAPS"></a><code class="literal">LIBRDF_STATEMENT_SUBJECT</code></span></td>
<td> Subject of a statement.
</td>
</tr>
<tr>
<td><span class="term"><a name="LIBRDF-STATEMENT-PREDICATE:CAPS"></a><code class="literal">LIBRDF_STATEMENT_PREDICATE</code></span></td>
<td> Predicate of a statement.
</td>
</tr>
<tr>
<td><span class="term"><a name="LIBRDF-STATEMENT-OBJECT:CAPS"></a><code class="literal">LIBRDF_STATEMENT_OBJECT</code></span></td>
<td> Object of a statement.
</td>
</tr>
<tr>
<td><span class="term"><a name="LIBRDF-STATEMENT-ALL:CAPS"></a><code class="literal">LIBRDF_STATEMENT_ALL</code></span></td>
<td> All parts of a statement.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2635793"></a><h3>
<a name="librdf-new-statement"></a>librdf_new_statement ()</h3>
<a class="indexterm" name="id2635804"></a><pre class="programlisting"><a href="redland-statement.html#librdf-statement">librdf_statement</a>* librdf_new_statement (<a href="redland-world.html#librdf-world">librdf_world</a> *world);</pre>
<p>
Constructor - create a new empty <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>world</code></em> :</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2635878"></a><h3>
<a name="librdf-new-statement-from-statement"></a>librdf_new_statement_from_statement ()</h3>
<a class="indexterm" name="id2635889"></a><pre class="programlisting"><a href="redland-statement.html#librdf-statement">librdf_statement</a>* librdf_new_statement_from_statement
(<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Copy constructor - create a new librdf_statement from an existing librdf_statement.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> to copy
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> with copy or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2635966"></a><h3>
<a name="librdf-new-statement-from-nodes"></a>librdf_new_statement_from_nodes ()</h3>
<a class="indexterm" name="id2635980"></a><pre class="programlisting"><a href="redland-statement.html#librdf-statement">librdf_statement</a>* librdf_new_statement_from_nodes
(<a href="redland-world.html#librdf-world">librdf_world</a> *world,
<a href="redland-node.html#librdf-node">librdf_node</a> *subject,
<a href="redland-node.html#librdf-node">librdf_node</a> *predicate,
<a href="redland-node.html#librdf-node">librdf_node</a> *object);</pre>
<p>
Constructor - create a new <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> from existing <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects.
</p>
<p>
The node objects become owned by the new statement (or freed on error).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>world</code></em> :</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>subject</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>predicate</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>object</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> with copy or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2636153"></a><h3>
<a name="librdf-statement-init"></a>librdf_statement_init ()</h3>
<a class="indexterm" name="id2636164"></a><pre class="programlisting">void librdf_statement_init (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Initialise a statically declared librdf_statement.
</p>
<p>
This MUST be called on a statically declared librdf_statement
to initialise it properly. It is the responsibility of the
user of the statically allocated librdf_statement to deal
with deallocation of any statement parts (subject, predicate, object).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>world</code></em> :</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644399"></a><h3>
<a name="librdf-statement-clear"></a>librdf_statement_clear ()</h3>
<a class="indexterm" name="id2644409"></a><pre class="programlisting">void librdf_statement_clear (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Empty a librdf_statement of nodes.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644460"></a><h3>
<a name="librdf-free-statement"></a>librdf_free_statement ()</h3>
<a class="indexterm" name="id2644470"></a><pre class="programlisting">void librdf_free_statement (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Destructor - destroy a <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644529"></a><h3>
<a name="librdf-statement-get-subject"></a>librdf_statement_get_subject ()</h3>
<a class="indexterm" name="id2644542"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_statement_get_subject (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Get the statement subject.
</p>
<p>
This method returns a SHARED pointer to the subject which must
be copied by the caller if needed.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to the <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of the statement subject -
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644623"></a><h3>
<a name="librdf-statement-set-subject"></a>librdf_statement_set_subject ()</h3>
<a class="indexterm" name="id2644636"></a><pre class="programlisting">void librdf_statement_set_subject (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *node);</pre>
<p>
Set the statement subject.
</p>
<p>
The subject passed in becomes owned by
the statement object and must not be used by the caller after this call.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of subject
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644728"></a><h3>
<a name="librdf-statement-get-predicate"></a>librdf_statement_get_predicate ()</h3>
<a class="indexterm" name="id2644741"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_statement_get_predicate (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Get the statement predicate.
</p>
<p>
This method returns a SHARED pointer to the predicate which must
be copied by the caller if needed.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to the <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of the statement predicate -
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644823"></a><h3>
<a name="librdf-statement-set-predicate"></a>librdf_statement_set_predicate ()</h3>
<a class="indexterm" name="id2644836"></a><pre class="programlisting">void librdf_statement_set_predicate (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *node);</pre>
<p>
Set the statement predicate.
</p>
<p>
The predicate passed in becomes owned by
the statement object and must not be used by the caller after this call.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of predicate
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2644928"></a><h3>
<a name="librdf-statement-get-object"></a>librdf_statement_get_object ()</h3>
<a class="indexterm" name="id2644939"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_statement_get_object (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Get the statement object.
</p>
<p>
This method returns a SHARED pointer to the object which must
be copied by the caller if needed.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a pointer to the <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of the statement object -
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645019"></a><h3>
<a name="librdf-statement-set-object"></a>librdf_statement_set_object ()</h3>
<a class="indexterm" name="id2645031"></a><pre class="programlisting">void librdf_statement_set_object (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *node);</pre>
<p>
Set the statement object.
</p>
<p>
The object passed in becomes owned by
the statement object and must not be used by the caller after this call.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of object
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645121"></a><h3>
<a name="librdf-statement-is-complete"></a>librdf_statement_is_complete ()</h3>
<a class="indexterm" name="id2645135"></a><pre class="programlisting">int librdf_statement_is_complete (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Check if statement is a complete and legal RDF triple.
</p>
<p>
Checks that all subject, predicate, object fields are present
and they have the allowed node types.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> non 0 if the statement is complete and legal
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645210"></a><h3>
<a name="librdf-statement-to-string"></a>librdf_statement_to_string ()</h3>
<a class="indexterm" name="id2645222"></a><pre class="programlisting">unsigned char* librdf_statement_to_string (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Format the librdf_statement as a string.
</p>
<p>
Formats the statement as a newly allocate string that must be freed by
the caller.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> the statement
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the string or NULL on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645289"></a><h3>
<a name="librdf-statement-print"></a>librdf_statement_print ()</h3>
<a class="indexterm" name="id2645300"></a><pre class="programlisting">void librdf_statement_print (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
FILE *fh);</pre>
<p>
Pretty print the statement to a file descriptor.
</p>
<p>
This method is for debugging and the format of the output should
not be relied on.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> the statement
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>fh</code></em> :</span></td>
<td> file handle
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645377"></a><h3>
<a name="librdf-statement-equals"></a>librdf_statement_equals ()</h3>
<a class="indexterm" name="id2645388"></a><pre class="programlisting">int librdf_statement_equals (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement1,
<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement2);</pre>
<p>
Check if two statements are equal.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement1</code></em> :</span></td>
<td> first <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement2</code></em> :</span></td>
<td> second <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> non 0 if statements are equal
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645485"></a><h3>
<a name="librdf-statement-match"></a>librdf_statement_match ()</h3>
<a class="indexterm" name="id2645496"></a><pre class="programlisting">int librdf_statement_match (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-statement.html#librdf-statement">librdf_statement</a> *partial_statement);</pre>
<p>
Match a statement against a 'partial' statement.
</p>
<p>
A partial statement is where some parts of the statement -
subject, predicate or object can be empty (NULL).
Empty parts match against any value, parts with values
must match exactly. Node matching is done via <a href="redland-node.html#librdf-node-equals"><code class="function">librdf_node_equals()</code></a></p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> statement
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>partial_statement</code></em> :</span></td>
<td> statement with possible empty parts
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> non 0 on match
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645594"></a><h3>
<a name="librdf-statement-encode"></a>librdf_statement_encode ()</h3>
<a class="indexterm" name="id2645605"></a><pre class="programlisting">size_t librdf_statement_encode (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
unsigned char *buffer,
size_t length);</pre>
<p>
Serialise a statement into a buffer.
</p>
<p>
Encodes the given statement in the buffer, which must be of sufficient
size. If buffer is NULL, no work is done but the size of buffer
required is returned.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> the statement to serialise
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> the buffer to use
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> buffer size
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of bytes written or 0 on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645687"></a><h3>
<a name="librdf-statement-encode-parts"></a>librdf_statement_encode_parts ()</h3>
<a class="indexterm" name="id2645699"></a><pre class="programlisting">size_t librdf_statement_encode_parts (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> *context_node,
unsigned char *buffer,
size_t length,
<a href="redland-statement.html#librdf-statement-part">librdf_statement_part</a> fields);</pre>
<p>
Serialise parts of a statement into a buffer.
</p>
<p>
Encodes the given statement in the buffer, which must be of sufficient
size. If buffer is NULL, no work is done but the size of buffer
required is returned.
</p>
<p>
The fields values are or-ed combinations of:
LIBRDF_STATEMENT_SUBJECT LIBRDF_STATEMENT_PREDICATE
LIBRDF_STATEMENT_OBJECT
or LIBRDF_STATEMENT_ALL for subject,prdicate,object fields
</p>
<p>
If context_node is given, it is encoded also</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> statement to serialise
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context_node</code></em> :</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context node (can be NULL)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> the buffer to use
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> buffer size
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>fields</code></em> :</span></td>
<td> fields to encode
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the number of bytes written or 0 on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645854"></a><h3>
<a name="librdf-statement-decode"></a>librdf_statement_decode ()</h3>
<a class="indexterm" name="id2645865"></a><pre class="programlisting">size_t librdf_statement_decode (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
unsigned char *buffer,
size_t length);</pre>
<p>
Decodes a statement from a buffer.
</p>
<p>
Decodes the serialised statement (as created by <a href="redland-statement.html#librdf-statement-encode"><code class="function">librdf_statement_encode()</code></a> )
from the given buffer.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> the statement to deserialise into
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> the buffer to use
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> buffer size
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> number of bytes used or 0 on failure (bad encoding, allocation failure)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2645971"></a><h3>
<a name="librdf-statement-decode-parts"></a>librdf_statement_decode_parts ()</h3>
<a class="indexterm" name="id2645984"></a><pre class="programlisting">size_t librdf_statement_decode_parts (<a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
<a href="redland-node.html#librdf-node">librdf_node</a> **context_node,
unsigned char *buffer,
size_t length);</pre>
<p>
Decodes a statement + context node from a buffer.
</p>
<p>
Decodes the serialised statement (as created by <a href="redland-statement.html#librdf-statement-encode"><code class="function">librdf_statement_encode()</code></a> )
from the given buffer. If a context node is found and context_node is
not NULL, a pointer to the new <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> is stored in *context_node.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em> :</span></td>
<td> the statement to deserialise into
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context_node</code></em> :</span></td>
<td> pointer to <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context_node to deserialise into
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> the buffer to use
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> buffer size
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> number of bytes used or 0 on failure (bad encoding, allocation failure)
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>