<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="redland-statement">
<refmeta>
<refentrytitle role="top_of_page" id="redland-statement.top_of_page">RDF Triple (librdf_statement)</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>REDLAND Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>RDF Triple (librdf_statement)</refname>
<refpurpose>RDF Triple.</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="redland-statement.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
typedef             <link linkend="librdf-statement">librdf_statement</link>;
enum                <link linkend="librdf-statement-part">librdf_statement_part</link>;
<link linkend="librdf-statement">librdf_statement</link>*   <link linkend="librdf-new-statement">librdf_new_statement</link>                (<link linkend="librdf-world">librdf_world</link> *world);
<link linkend="librdf-statement">librdf_statement</link>*   <link linkend="librdf-new-statement-from-statement">librdf_new_statement_from_statement</link> (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="librdf-statement">librdf_statement</link>*   <link linkend="librdf-new-statement-from-nodes">librdf_new_statement_from_nodes</link>     (<link linkend="librdf-world">librdf_world</link> *world,
                                                         <link linkend="librdf-node">librdf_node</link> *subject,
                                                         <link linkend="librdf-node">librdf_node</link> *predicate,
                                                         <link linkend="librdf-node">librdf_node</link> *object);
<link linkend="void">void</link>                <link linkend="librdf-statement-init">librdf_statement_init</link>               (<link linkend="librdf-world">librdf_world</link> *world,
                                                         <link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="void">void</link>                <link linkend="librdf-statement-clear">librdf_statement_clear</link>              (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="void">void</link>                <link linkend="librdf-free-statement">librdf_free_statement</link>               (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="librdf-node">librdf_node</link>*        <link linkend="librdf-statement-get-subject">librdf_statement_get_subject</link>        (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="void">void</link>                <link linkend="librdf-statement-set-subject">librdf_statement_set_subject</link>        (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *node);
<link linkend="librdf-node">librdf_node</link>*        <link linkend="librdf-statement-get-predicate">librdf_statement_get_predicate</link>      (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="void">void</link>                <link linkend="librdf-statement-set-predicate">librdf_statement_set_predicate</link>      (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *node);
<link linkend="librdf-node">librdf_node</link>*        <link linkend="librdf-statement-get-object">librdf_statement_get_object</link>         (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="void">void</link>                <link linkend="librdf-statement-set-object">librdf_statement_set_object</link>         (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *node);
<link linkend="int">int</link>                 <link linkend="librdf-statement-is-complete">librdf_statement_is_complete</link>        (<link linkend="librdf-statement">librdf_statement</link> *statement);
unsigned <link linkend="char">char</link>*      <link linkend="librdf-statement-to-string">librdf_statement_to_string</link>          (<link linkend="librdf-statement">librdf_statement</link> *statement);
<link linkend="void">void</link>                <link linkend="librdf-statement-print">librdf_statement_print</link>              (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="FILE:CAPS">FILE</link> *fh);
<link linkend="int">int</link>                 <link linkend="librdf-statement-equals">librdf_statement_equals</link>             (<link linkend="librdf-statement">librdf_statement</link> *statement1,
                                                         <link linkend="librdf-statement">librdf_statement</link> *statement2);
<link linkend="int">int</link>                 <link linkend="librdf-statement-match">librdf_statement_match</link>              (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-statement">librdf_statement</link> *partial_statement);
<link linkend="size-t">size_t</link>              <link linkend="librdf-statement-encode">librdf_statement_encode</link>             (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length);
<link linkend="size-t">size_t</link>              <link linkend="librdf-statement-encode-parts">librdf_statement_encode_parts</link>       (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *context_node,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length,
                                                         <link linkend="librdf-statement-part">librdf_statement_part</link> fields);
<link linkend="size-t">size_t</link>              <link linkend="librdf-statement-decode">librdf_statement_decode</link>             (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length);
<link linkend="size-t">size_t</link>              <link linkend="librdf-statement-decode-parts">librdf_statement_decode_parts</link>       (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> **context_node,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length);
</synopsis>
</refsynopsisdiv>









<refsect1 id="redland-statement.description" role="desc">
<title role="desc.title">Description</title>
<para>
An object representing an RDF Triple of three RDF terms (<link linkend="librdf-node"><type>librdf_node</type></link>).
Triples can be created, accessed, destroyed and en/decoded into a binary
form for use in storage.
</para>
</refsect1>

<refsect1 id="redland-statement.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="librdf-statement" role="typedef">
<title>librdf_statement</title>
<indexterm zone="librdf-statement"><primary>librdf_statement</primary></indexterm><programlisting>typedef struct librdf_statement_s librdf_statement;
</programlisting>
<para>
Redland statement class.</para>
<para>

</para></refsect2>
<refsect2 id="librdf-statement-part" role="enum">
<title>enum librdf_statement_part</title>
<indexterm zone="librdf-statement-part"><primary>librdf_statement_part</primary></indexterm><programlisting>typedef enum {
  LIBRDF_STATEMENT_SUBJECT   = 1 &lt;&lt; 0,
  LIBRDF_STATEMENT_PREDICATE = 1 &lt;&lt; 1,
  LIBRDF_STATEMENT_OBJECT    = 1 &lt;&lt; 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;
</programlisting>
<para>
Flags that are or-ed to indicate statement parts.
</para>
<para>
Used in fields arguments to methods such as the public
<link linkend="librdf-statement-encode-parts"><function>librdf_statement_encode_parts()</function></link> <link linkend="librdf-statement-decode-parts"><function>librdf_statement_decode_parts()</function></link>
<link linkend="librdf-new-stream-from-node-iterator"><function>librdf_new_stream_from_node_iterator()</function></link> and the internal
<link linkend="librdf-storage-node-stream-to-node-create"><function>librdf_storage_node_stream_to_node_create()</function></link></para>
<para>

</para><variablelist role="enum">
<varlistentry id="LIBRDF-STATEMENT-SUBJECT:CAPS" role="constant">
<term><literal>LIBRDF_STATEMENT_SUBJECT</literal></term>
<listitem><simpara> Subject of a statement.
</simpara></listitem>
</varlistentry>
<varlistentry id="LIBRDF-STATEMENT-PREDICATE:CAPS" role="constant">
<term><literal>LIBRDF_STATEMENT_PREDICATE</literal></term>
<listitem><simpara> Predicate of a statement.
</simpara></listitem>
</varlistentry>
<varlistentry id="LIBRDF-STATEMENT-OBJECT:CAPS" role="constant">
<term><literal>LIBRDF_STATEMENT_OBJECT</literal></term>
<listitem><simpara> Object of a statement.
</simpara></listitem>
</varlistentry>
<varlistentry id="LIBRDF-STATEMENT-ALL:CAPS" role="constant">
<term><literal>LIBRDF_STATEMENT_ALL</literal></term>
<listitem><simpara> All parts of a statement.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-new-statement" role="function">
<title>librdf_new_statement ()</title>
<indexterm zone="librdf-new-statement"><primary>librdf_new_statement</primary></indexterm><programlisting><link linkend="librdf-statement">librdf_statement</link>*   librdf_new_statement                (<link linkend="librdf-world">librdf_world</link> *world);</programlisting>
<para>
Constructor - create a new empty <link linkend="librdf-statement"><type>librdf_statement</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>world</parameter>&nbsp;:</term>
<listitem><simpara> redland world object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="librdf-statement"><type>librdf_statement</type></link> or NULL on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-new-statement-from-statement" role="function">
<title>librdf_new_statement_from_statement ()</title>
<indexterm zone="librdf-new-statement-from-statement"><primary>librdf_new_statement_from_statement</primary></indexterm><programlisting><link linkend="librdf-statement">librdf_statement</link>*   librdf_new_statement_from_statement (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Copy constructor - create a new librdf_statement from an existing librdf_statement.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> to copy
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="librdf-statement"><type>librdf_statement</type></link> with copy or NULL on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-new-statement-from-nodes" role="function">
<title>librdf_new_statement_from_nodes ()</title>
<indexterm zone="librdf-new-statement-from-nodes"><primary>librdf_new_statement_from_nodes</primary></indexterm><programlisting><link linkend="librdf-statement">librdf_statement</link>*   librdf_new_statement_from_nodes     (<link linkend="librdf-world">librdf_world</link> *world,
                                                         <link linkend="librdf-node">librdf_node</link> *subject,
                                                         <link linkend="librdf-node">librdf_node</link> *predicate,
                                                         <link linkend="librdf-node">librdf_node</link> *object);</programlisting>
<para>
Constructor - create a new <link linkend="librdf-statement"><type>librdf_statement</type></link> from existing <link linkend="librdf-node"><type>librdf_node</type></link> objects.
</para>
<para>
The node objects become owned by the new statement (or freed on error).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>world</parameter>&nbsp;:</term>
<listitem><simpara> redland world object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>subject</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>predicate</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>object</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new <link linkend="librdf-statement"><type>librdf_statement</type></link> with copy or NULL on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-init" role="function">
<title>librdf_statement_init ()</title>
<indexterm zone="librdf-statement-init"><primary>librdf_statement_init</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_statement_init               (<link linkend="librdf-world">librdf_world</link> *world,
                                                         <link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Initialise a statically declared librdf_statement.
</para>
<para>
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).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>world</parameter>&nbsp;:</term>
<listitem><simpara> redland world object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-clear" role="function">
<title>librdf_statement_clear ()</title>
<indexterm zone="librdf-statement-clear"><primary>librdf_statement_clear</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_statement_clear              (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Empty a librdf_statement of nodes.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-free-statement" role="function">
<title>librdf_free_statement ()</title>
<indexterm zone="librdf-free-statement"><primary>librdf_free_statement</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_free_statement               (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Destructor - destroy a <link linkend="librdf-statement"><type>librdf_statement</type></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-get-subject" role="function">
<title>librdf_statement_get_subject ()</title>
<indexterm zone="librdf-statement-get-subject"><primary>librdf_statement_get_subject</primary></indexterm><programlisting><link linkend="librdf-node">librdf_node</link>*        librdf_statement_get_subject        (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Get the statement subject.
</para>
<para>
This method returns a SHARED pointer to the subject which must
be copied by the caller if needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a pointer to the <link linkend="librdf-node"><type>librdf_node</type></link> of the statement subject - 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-set-subject" role="function">
<title>librdf_statement_set_subject ()</title>
<indexterm zone="librdf-statement-set-subject"><primary>librdf_statement_set_subject</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_statement_set_subject        (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *node);</programlisting>
<para>
Set the statement subject.
</para>
<para>
The subject passed in becomes owned by
the statement object and must not be used by the caller after this call.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>node</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link> of subject
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-get-predicate" role="function">
<title>librdf_statement_get_predicate ()</title>
<indexterm zone="librdf-statement-get-predicate"><primary>librdf_statement_get_predicate</primary></indexterm><programlisting><link linkend="librdf-node">librdf_node</link>*        librdf_statement_get_predicate      (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Get the statement predicate.
</para>
<para>
This method returns a SHARED pointer to the predicate which must
be copied by the caller if needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a pointer to the <link linkend="librdf-node"><type>librdf_node</type></link> of the statement predicate - 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-set-predicate" role="function">
<title>librdf_statement_set_predicate ()</title>
<indexterm zone="librdf-statement-set-predicate"><primary>librdf_statement_set_predicate</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_statement_set_predicate      (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *node);</programlisting>
<para>
Set the statement predicate.
</para>
<para>
The predicate passed in becomes owned by
the statement object and must not be used by the caller after this call.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>node</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link> of predicate
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-get-object" role="function">
<title>librdf_statement_get_object ()</title>
<indexterm zone="librdf-statement-get-object"><primary>librdf_statement_get_object</primary></indexterm><programlisting><link linkend="librdf-node">librdf_node</link>*        librdf_statement_get_object         (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Get the statement object.
</para>
<para>
This method returns a SHARED pointer to the object which must
be copied by the caller if needed.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a pointer to the <link linkend="librdf-node"><type>librdf_node</type></link> of the statement object - 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-set-object" role="function">
<title>librdf_statement_set_object ()</title>
<indexterm zone="librdf-statement-set-object"><primary>librdf_statement_set_object</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_statement_set_object         (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *node);</programlisting>
<para>
Set the statement object.
</para>
<para>
The object passed in becomes owned by
the statement object and must not be used by the caller after this call.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>node</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link> of object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-is-complete" role="function">
<title>librdf_statement_is_complete ()</title>
<indexterm zone="librdf-statement-is-complete"><primary>librdf_statement_is_complete</primary></indexterm><programlisting><link linkend="int">int</link>                 librdf_statement_is_complete        (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Check if statement is a complete and legal RDF triple.
</para>
<para>
Checks that all subject, predicate, object fields are present
and they have the allowed node types.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-statement"><type>librdf_statement</type></link> object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 if the statement is complete and legal
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-to-string" role="function">
<title>librdf_statement_to_string ()</title>
<indexterm zone="librdf-statement-to-string"><primary>librdf_statement_to_string</primary></indexterm><programlisting>unsigned <link linkend="char">char</link>*      librdf_statement_to_string          (<link linkend="librdf-statement">librdf_statement</link> *statement);</programlisting>
<para>
Format the librdf_statement as a string.
</para>
<para>
Formats the statement as a newly allocate string that must be freed by
the caller.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> the statement
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the string or NULL on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-print" role="function">
<title>librdf_statement_print ()</title>
<indexterm zone="librdf-statement-print"><primary>librdf_statement_print</primary></indexterm><programlisting><link linkend="void">void</link>                librdf_statement_print              (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="FILE:CAPS">FILE</link> *fh);</programlisting>
<para>
Pretty print the statement to a file descriptor.
</para>
<para>
This method is for debugging and the format of the output should
not be relied on.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> the statement
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fh</parameter>&nbsp;:</term>
<listitem><simpara> file handle
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-equals" role="function">
<title>librdf_statement_equals ()</title>
<indexterm zone="librdf-statement-equals"><primary>librdf_statement_equals</primary></indexterm><programlisting><link linkend="int">int</link>                 librdf_statement_equals             (<link linkend="librdf-statement">librdf_statement</link> *statement1,
                                                         <link linkend="librdf-statement">librdf_statement</link> *statement2);</programlisting>
<para>
Check if two statements are equal.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement1</parameter>&nbsp;:</term>
<listitem><simpara> first <link linkend="librdf-statement"><type>librdf_statement</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>statement2</parameter>&nbsp;:</term>
<listitem><simpara> second <link linkend="librdf-statement"><type>librdf_statement</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 if statements are equal
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-match" role="function">
<title>librdf_statement_match ()</title>
<indexterm zone="librdf-statement-match"><primary>librdf_statement_match</primary></indexterm><programlisting><link linkend="int">int</link>                 librdf_statement_match              (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-statement">librdf_statement</link> *partial_statement);</programlisting>
<para>
Match a statement against a 'partial' statement.
</para>
<para>
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 <link linkend="librdf-node-equals"><function>librdf_node_equals()</function></link></para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> statement
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>partial_statement</parameter>&nbsp;:</term>
<listitem><simpara> statement with possible empty parts
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> non 0 on match
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-encode" role="function">
<title>librdf_statement_encode ()</title>
<indexterm zone="librdf-statement-encode"><primary>librdf_statement_encode</primary></indexterm><programlisting><link linkend="size-t">size_t</link>              librdf_statement_encode             (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length);</programlisting>
<para>
Serialise a statement into a buffer.
</para>
<para>
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.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> the statement to serialise
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> the buffer to use
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
<listitem><simpara> buffer size
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the number of bytes written or 0 on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-encode-parts" role="function">
<title>librdf_statement_encode_parts ()</title>
<indexterm zone="librdf-statement-encode-parts"><primary>librdf_statement_encode_parts</primary></indexterm><programlisting><link linkend="size-t">size_t</link>              librdf_statement_encode_parts       (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> *context_node,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length,
                                                         <link linkend="librdf-statement-part">librdf_statement_part</link> fields);</programlisting>
<para>
Serialise parts of a statement into a buffer.
</para>
<para>
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.
</para>
<para>
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
</para>
<para>
If context_node is given, it is encoded also</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> statement to serialise
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>context_node</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="librdf-node"><type>librdf_node</type></link> context node (can be NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> the buffer to use
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
<listitem><simpara> buffer size
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>fields</parameter>&nbsp;:</term>
<listitem><simpara> fields to encode
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the number of bytes written or 0 on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-decode" role="function">
<title>librdf_statement_decode ()</title>
<indexterm zone="librdf-statement-decode"><primary>librdf_statement_decode</primary></indexterm><programlisting><link linkend="size-t">size_t</link>              librdf_statement_decode             (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length);</programlisting>
<para>
Decodes a statement from a buffer.
</para>
<para>
Decodes the serialised statement (as created by <link linkend="librdf-statement-encode"><function>librdf_statement_encode()</function></link> )
from the given buffer.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> the statement to deserialise into
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> the buffer to use
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
<listitem><simpara> buffer size
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> number of bytes used or 0 on failure (bad encoding, allocation failure)
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="librdf-statement-decode-parts" role="function">
<title>librdf_statement_decode_parts ()</title>
<indexterm zone="librdf-statement-decode-parts"><primary>librdf_statement_decode_parts</primary></indexterm><programlisting><link linkend="size-t">size_t</link>              librdf_statement_decode_parts       (<link linkend="librdf-statement">librdf_statement</link> *statement,
                                                         <link linkend="librdf-node">librdf_node</link> **context_node,
                                                         unsigned <link linkend="char">char</link> *buffer,
                                                         <link linkend="size-t">size_t</link> length);</programlisting>
<para>
Decodes a statement + context node from a buffer.
</para>
<para>
Decodes the serialised statement (as created by <link linkend="librdf-statement-encode"><function>librdf_statement_encode()</function></link> )
from the given buffer.  If a context node is found and context_node is
not NULL, a pointer to the new <link linkend="librdf-node"><type>librdf_node</type></link> is stored in *context_node.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> the statement to deserialise into
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>context_node</parameter>&nbsp;:</term>
<listitem><simpara> pointer to <link linkend="librdf-node"><type>librdf_node</type></link> context_node to deserialise into
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>buffer</parameter>&nbsp;:</term>
<listitem><simpara> the buffer to use
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>length</parameter>&nbsp;:</term>
<listitem><simpara> buffer size
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> number of bytes used or 0 on failure (bad encoding, allocation failure)
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
