<?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="raptor-section-triples">
<refmeta>
<refentrytitle role="top_of_page" id="raptor-section-triples.top_of_page">Triples</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>RAPTOR Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Triples</refname>
<refpurpose>RDF Triples</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>

<refsynopsisdiv id="raptor-section-triples.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
enum                <link linkend="raptor-genid-type">raptor_genid_type</link>;
enum                <link linkend="raptor-identifier-type">raptor_identifier_type</link>;
                    <link linkend="raptor-identifier">raptor_identifier</link>;
<link linkend="raptor-identifier">raptor_identifier</link>*  <link linkend="raptor-new-identifier">raptor_new_identifier</link>               (<link linkend="raptor-identifier-type">raptor_identifier_type</link> type,
                                                         <link linkend="raptor-uri">raptor_uri</link> *uri,
                                                         <link linkend="raptor-uri-source">raptor_uri_source</link> uri_source,
                                                         unsigned <link linkend="char">char</link> *id,
                                                         unsigned <link linkend="char">char</link> *literal,
                                                         <link linkend="raptor-uri">raptor_uri</link> *literal_datatype,
                                                         unsigned <link linkend="char">char</link> *literal_language);
<link linkend="int">int</link>                 <link linkend="raptor-copy-identifier">raptor_copy_identifier</link>              (<link linkend="raptor-identifier">raptor_identifier</link> *dest,
                                                         <link linkend="raptor-identifier">raptor_identifier</link> *src);
<link linkend="void">void</link>                <link linkend="raptor-free-identifier">raptor_free_identifier</link>              (<link linkend="raptor-identifier">raptor_identifier</link> *identifier);
                    <link linkend="raptor-statement">raptor_statement</link>;
<link linkend="int">int</link>                 <link linkend="raptor-statement-compare">raptor_statement_compare</link>            (const <link linkend="raptor-statement">raptor_statement</link> *s1,
                                                         const <link linkend="raptor-statement">raptor_statement</link> *s2);
<link linkend="void">void</link>                <link linkend="raptor-print-statement">raptor_print_statement</link>              (const <link linkend="raptor-statement">raptor_statement</link> *statement,
                                                         <link linkend="FILE:CAPS">FILE</link> *stream);
<link linkend="void">void</link>                <link linkend="raptor-print-statement-as-ntriples">raptor_print_statement_as_ntriples</link>  (const <link linkend="raptor-statement">raptor_statement</link> *statement,
                                                         <link linkend="FILE:CAPS">FILE</link> *stream);
<link linkend="void">void</link>                <link linkend="raptor-print-statement-detailed">raptor_print_statement_detailed</link>     (const <link linkend="raptor-statement">raptor_statement</link> *statement,
                                                         <link linkend="int">int</link> detailed,
                                                         <link linkend="FILE:CAPS">FILE</link> *stream);
unsigned <link linkend="char">char</link>*      <link linkend="raptor-statement-part-as-counted-string">raptor_statement_part_as_counted_string</link>
                                                        (const <link linkend="void">void</link> *term,
                                                         <link linkend="raptor-identifier-type">raptor_identifier_type</link> type,
                                                         <link linkend="raptor-uri">raptor_uri</link> *literal_datatype,
                                                         unsigned <link linkend="char">char</link> *literal_language,
                                                         <link linkend="size-t">size_t</link> *len_p);
unsigned <link linkend="char">char</link>*      <link linkend="raptor-statement-part-as-string">raptor_statement_part_as_string</link>     (const <link linkend="void">void</link> *term,
                                                         <link linkend="raptor-identifier-type">raptor_identifier_type</link> type,
                                                         <link linkend="raptor-uri">raptor_uri</link> *literal_datatype,
                                                         unsigned <link linkend="char">char</link> *literal_language);
</synopsis>
</refsynopsisdiv>









<refsect1 id="raptor-section-triples.description" role="desc">
<title role="desc.title">Description</title>
<para>
Representation of RDF triples inside Raptor.  They are a sequence
of three <link linkend="raptor-identifier"><type>raptor_identifier</type></link> which cover the RDF terms of
URI (<link linkend="RAPTOR-IDENTIFIER-TYPE-RESOURCE:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_RESOURCE</literal></link>),
Literal (<link linkend="RAPTOR-IDENTIFIER-TYPE-LITERAL:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_LITERAL</literal></link>) and
Blank Node (<link linkend="RAPTOR-IDENTIFIER-TYPE-ANONYMOUS:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_ANONYMOUS</literal></link>).
Some other <link linkend="raptor-identifer-type"><type>raptor_identifer_type</type></link> forms exist but are deprecated.
</para>
</refsect1>

<refsect1 id="raptor-section-triples.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="raptor-genid-type" role="enum">
<title>enum raptor_genid_type</title>
<indexterm zone="raptor-genid-type"><primary>raptor_genid_type</primary></indexterm><programlisting>typedef enum {
  RAPTOR_GENID_TYPE_BNODEID,
  RAPTOR_GENID_TYPE_BAGID
} raptor_genid_type;
</programlisting>
<para>
Intended type for a generated identifier asked for by the handler
registered with <link linkend="raptor-set-generate-id-handler"><function>raptor_set_generate_id_handler()</function></link>.</para>
<para>

</para><variablelist role="enum">
<varlistentry id="RAPTOR-GENID-TYPE-BNODEID:CAPS" role="constant">
<term><literal>RAPTOR_GENID_TYPE_BNODEID</literal></term>
<listitem><simpara> Generated ID is for a blank node
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-GENID-TYPE-BAGID:CAPS" role="constant">
<term><literal>RAPTOR_GENID_TYPE_BAGID</literal></term>
<listitem><simpara> Generated ID is for rdf:bagID
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-identifier-type" role="enum">
<title>enum raptor_identifier_type</title>
<indexterm zone="raptor-identifier-type"><primary>raptor_identifier_type</primary></indexterm><programlisting>typedef enum {
  RAPTOR_IDENTIFIER_TYPE_UNKNOWN,
  RAPTOR_IDENTIFIER_TYPE_RESOURCE,
  RAPTOR_IDENTIFIER_TYPE_ANONYMOUS,
  RAPTOR_IDENTIFIER_TYPE_PREDICATE,
  RAPTOR_IDENTIFIER_TYPE_ORDINAL,
  RAPTOR_IDENTIFIER_TYPE_LITERAL,
  RAPTOR_IDENTIFIER_TYPE_XML_LITERAL
} raptor_identifier_type;
</programlisting>
<para>
Type of identifier in a <link linkend="raptor-statement"><type>raptor_statement</type></link></para>
<para>

</para><variablelist role="enum">
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-UNKNOWN:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_UNKNOWN</literal></term>
<listitem><simpara>     Internal
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-RESOURCE:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_RESOURCE</literal></term>
<listitem><simpara>    Resource URI (e.g. <literal>rdf:about</literal>)
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-ANONYMOUS:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_ANONYMOUS</literal></term>
<listitem><simpara>   <literal>_:foo</literal> N-Triples, or generated
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-PREDICATE:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_PREDICATE</literal></term>
<listitem><simpara>   predicate URI.  WARNING: Will not be generated in in Raptor 1.4.9 or newer.  Instead a <link linkend="RAPTOR-IDENTIFIER-TYPE-RESOURCE:CAPS"><type>RAPTOR_IDENTIFIER_TYPE_RESOURCE</type></link> will be returned.
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-ORDINAL:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_ORDINAL</literal></term>
<listitem><simpara>     <literal>rdf:li</literal>, <literal>rdf:_</literal><emphasis>n</emphasis>.  No longer generated in any parser in Raptor 1.4.10+, instead a <link linkend="RAPTOR-IDENTIFIER-TYPE-RESOURCE:CAPS"><type>RAPTOR_IDENTIFIER_TYPE_RESOURCE</type></link> is returned.
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-LITERAL:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_LITERAL</literal></term>
<listitem><simpara>     regular literal
</simpara></listitem>
</varlistentry>
<varlistentry id="RAPTOR-IDENTIFIER-TYPE-XML-LITERAL:CAPS" role="constant">
<term><literal>RAPTOR_IDENTIFIER_TYPE_XML_LITERAL</literal></term>
<listitem><simpara> <literal>rdf:parseType="Literal"</literal>.  No longer generated by any parser in Raptor 1.4.8+, instead a <link linkend="RAPTOR-IDENTIFIER-TYPE-LITERAL:CAPS"><type>RAPTOR_IDENTIFIER_TYPE_LITERAL</type></link> is returned with a datatype of <literal>rdf:XMLLiteral</literal>.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-identifier" role="struct">
<title>raptor_identifier</title>
<indexterm zone="raptor-identifier"><primary>raptor_identifier</primary></indexterm><programlisting>typedef struct {
  raptor_identifier_type type;
  raptor_uri *uri;
  raptor_uri_source uri_source;
  const unsigned char *id;
  int ordinal;
  int is_malloced;
  const unsigned char *literal;
  raptor_uri *literal_datatype;
  const unsigned char *literal_language;
} raptor_identifier;
</programlisting>
<para>
Raptor RDF term identifier.</para>
<para>

</para><variablelist role="struct">
<varlistentry>
<term><link linkend="raptor-identifier-type">raptor_identifier_type</link>&nbsp;<structfield>type</structfield>;</term>
<listitem><simpara> Type of identifier
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-uri">raptor_uri</link>&nbsp;*<structfield>uri</structfield>;</term>
<listitem><simpara> URI of identifier for types <link linkend="RAPTOR-IDENTIFIER-TYPE-RESOURCE:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_RESOURCE</literal></link> and
  <link linkend="RAPTOR-IDENTIFIER-TYPE-PREDICATE:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_PREDICATE</literal></link>
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-uri-source">raptor_uri_source</link>&nbsp;<structfield>uri_source</structfield>;</term>
<listitem><simpara> where the identifier (URI or blank node) came from
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="int">int</link>&nbsp;<structfield>ordinal</structfield>;</term>
<listitem><simpara> integer ordinal for type <link linkend="RAPTOR-IDENTIFIER-TYPE-ORDINAL:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_ORDINAL</literal></link>
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="int">int</link>&nbsp;<structfield>is_malloced</structfield>;</term>
<listitem><simpara> internal
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-uri">raptor_uri</link>&nbsp;*<structfield>literal_datatype</structfield>;</term>
<listitem><simpara> RDF literal datatype URI for types
  <link linkend="RAPTOR-IDENTIFIER-TYPE-LITERAL:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_LITERAL</literal></link> and <link linkend="RAPTOR-IDENTIFIER-TYPE-XML-LITERAL:CAPS"><literal>RAPTOR_IDENTIFIER_TYPE_XML_LITERAL</literal></link>
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-new-identifier" role="function">
<title>raptor_new_identifier ()</title>
<indexterm zone="raptor-new-identifier"><primary>raptor_new_identifier</primary></indexterm><programlisting><link linkend="raptor-identifier">raptor_identifier</link>*  raptor_new_identifier               (<link linkend="raptor-identifier-type">raptor_identifier_type</link> type,
                                                         <link linkend="raptor-uri">raptor_uri</link> *uri,
                                                         <link linkend="raptor-uri-source">raptor_uri_source</link> uri_source,
                                                         unsigned <link linkend="char">char</link> *id,
                                                         unsigned <link linkend="char">char</link> *literal,
                                                         <link linkend="raptor-uri">raptor_uri</link> *literal_datatype,
                                                         unsigned <link linkend="char">char</link> *literal_language);</programlisting>
<para>
Constructor - create a raptor_identifier.
</para>
<para>
Constructs a new identifier copying the URI, ID fields.
SHARED means raptor_new_identifier owns this argument after calling.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>type</parameter>&nbsp;:</term>
<listitem><simpara> raptor_identifier_type of identifier
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> of identifier (if relevant) (SHARED)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>uri_source</parameter>&nbsp;:</term>
<listitem><simpara> raptor_uri_source of URI (if relevant)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>id</parameter>&nbsp;:</term>
<listitem><simpara> string for ID or genid (if relevant) (SHARED)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal</parameter>&nbsp;:</term>
<listitem><simpara> string for literal (SHARED)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal_datatype</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-uri"><type>raptor_uri</type></link> of identifier (SHARED)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal_language</parameter>&nbsp;:</term>
<listitem><simpara> literal language (SHARED)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a new raptor_identifier object or NULL on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-copy-identifier" role="function">
<title>raptor_copy_identifier ()</title>
<indexterm zone="raptor-copy-identifier"><primary>raptor_copy_identifier</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_copy_identifier              (<link linkend="raptor-identifier">raptor_identifier</link> *dest,
                                                         <link linkend="raptor-identifier">raptor_identifier</link> *src);</programlisting>
<para>
Copy raptor_identifiers.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>dest</parameter>&nbsp;:</term>
<listitem><simpara> destination <link linkend="raptor-identifier"><type>raptor_identifier</type></link> (previously created)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>src</parameter>&nbsp;:</term>
<listitem><simpara>  source <link linkend="raptor-identifier"><type>raptor_identifier</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> Non 0 on failure
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-free-identifier" role="function">
<title>raptor_free_identifier ()</title>
<indexterm zone="raptor-free-identifier"><primary>raptor_free_identifier</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_free_identifier              (<link linkend="raptor-identifier">raptor_identifier</link> *identifier);</programlisting>
<para>
Destructor - destroy a raptor_identifier object.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>identifier</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-identifier"><type>raptor_identifier</type></link> object
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-statement" role="struct">
<title>raptor_statement</title>
<indexterm zone="raptor-statement"><primary>raptor_statement</primary></indexterm><programlisting>typedef struct {
  const void *subject;
  raptor_identifier_type subject_type;
  const void *predicate;
  raptor_identifier_type predicate_type;
  const void *object;
  raptor_identifier_type object_type;
  raptor_uri *object_literal_datatype;
  const unsigned char *object_literal_language;
} raptor_statement;
</programlisting>
<para>
An RDF triple
</para>
<para>
See <link linkend="raptor-identifier"><type>raptor_identifier</type></link> for a description of how the fields may be used.
As returned by a parser statement_handler.</para>
<para>

</para><variablelist role="struct">
<varlistentry>
<term>const&nbsp;<link linkend="void">void</link>&nbsp;*<structfield>subject</structfield>;</term>
<listitem><simpara> triple subject data
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-identifier-type">raptor_identifier_type</link>&nbsp;<structfield>subject_type</structfield>;</term>
<listitem><simpara> triple subject type
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>const&nbsp;<link linkend="void">void</link>&nbsp;*<structfield>predicate</structfield>;</term>
<listitem><simpara> triple predicate data
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-identifier-type">raptor_identifier_type</link>&nbsp;<structfield>predicate_type</structfield>;</term>
<listitem><simpara> triple predicate type
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>const&nbsp;<link linkend="void">void</link>&nbsp;*<structfield>object</structfield>;</term>
<listitem><simpara> triple object literal string
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-identifier-type">raptor_identifier_type</link>&nbsp;<structfield>object_type</structfield>;</term>
<listitem><simpara> triple object type
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="raptor-uri">raptor_uri</link>&nbsp;*<structfield>object_literal_datatype</structfield>;</term>
<listitem><simpara> triple object literal datatype URI (or NULL)
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-statement-compare" role="function">
<title>raptor_statement_compare ()</title>
<indexterm zone="raptor-statement-compare"><primary>raptor_statement_compare</primary></indexterm><programlisting><link linkend="int">int</link>                 raptor_statement_compare            (const <link linkend="raptor-statement">raptor_statement</link> *s1,
                                                         const <link linkend="raptor-statement">raptor_statement</link> *s2);</programlisting>
<para>
Compare a pair of <link linkend="raptor-statement"><type>raptor_statement</type></link>
</para>
<para>
If types are different, the <link linkend="raptor-identifier-type"><type>raptor_identifier_type</type></link> order is used.
Resource and datatype URIs are compared with <link linkend="raptor-uri-compare"><function>raptor_uri_compare()</function></link>,
blank nodes and literals with <link linkend="strcmp"><function>strcmp()</function></link>.  If one literal has no
language, it is earlier than one with a language.  If one literal
has no datatype, it is earlier than one with a datatype.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>s1</parameter>&nbsp;:</term>
<listitem><simpara> first statement
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>s2</parameter>&nbsp;:</term>
<listitem><simpara> second statement
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> &lt;0 if s1 is before s2, 0 if equal, &gt;0 if s1 is after s2
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-print-statement" role="function">
<title>raptor_print_statement ()</title>
<indexterm zone="raptor-print-statement"><primary>raptor_print_statement</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_print_statement              (const <link linkend="raptor-statement">raptor_statement</link> *statement,
                                                         <link linkend="FILE:CAPS">FILE</link> *stream);</programlisting>
<para>
Print a raptor_statement to a stream.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> object to print
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="FILE:CAPS"><type>FILE</type></link>* stream
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-print-statement-as-ntriples" role="function">
<title>raptor_print_statement_as_ntriples ()</title>
<indexterm zone="raptor-print-statement-as-ntriples"><primary>raptor_print_statement_as_ntriples</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_print_statement_as_ntriples  (const <link linkend="raptor-statement">raptor_statement</link> *statement,
                                                         <link linkend="FILE:CAPS">FILE</link> *stream);</programlisting>
<para>
Print a raptor_statement in N-Triples form.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> to print
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="FILE:CAPS"><type>FILE</type></link>* stream
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-print-statement-detailed" role="function" condition="deprecated:">
<title>raptor_print_statement_detailed ()</title>
<indexterm zone="raptor-print-statement-detailed" role="deprecated"><primary>raptor_print_statement_detailed</primary></indexterm><programlisting><link linkend="void">void</link>                raptor_print_statement_detailed     (const <link linkend="raptor-statement">raptor_statement</link> *statement,
                                                         <link linkend="int">int</link> detailed,
                                                         <link linkend="FILE:CAPS">FILE</link> *stream);</programlisting>
<warning><para><literal>raptor_print_statement_detailed</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Print a raptor_statement to a stream in a detailed fashion.
</para>
<para>
<parameter>deprecated</parameter>: an internal function, do not use.
</para>
<para>
No current difference from calling <link linkend="raptor-print-statement"><function>raptor_print_statement()</function></link>.</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>statement</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> object to print
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>detailed</parameter>&nbsp;:</term>
<listitem><simpara> unused
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>stream</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="FILE:CAPS"><type>FILE</type></link>* stream
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-statement-part-as-counted-string" role="function">
<title>raptor_statement_part_as_counted_string ()</title>
<indexterm zone="raptor-statement-part-as-counted-string"><primary>raptor_statement_part_as_counted_string</primary></indexterm><programlisting>unsigned <link linkend="char">char</link>*      raptor_statement_part_as_counted_string
                                                        (const <link linkend="void">void</link> *term,
                                                         <link linkend="raptor-identifier-type">raptor_identifier_type</link> type,
                                                         <link linkend="raptor-uri">raptor_uri</link> *literal_datatype,
                                                         unsigned <link linkend="char">char</link> *literal_language,
                                                         <link linkend="size-t">size_t</link> *len_p);</programlisting>
<para>
Turns part of raptor statement into a N-Triples format counted string.
</para>
<para>
Turns the given <parameter>term</parameter> into an N-Triples escaped string using all the
escapes as defined in http://www.w3.org/TR/rdf-testcases/<link linkend="ntriples"><type>ntriples</type></link>
</para>
<para>
The part (subject, predicate, object) of the raptor_statement is
typically passed in as <parameter>term</parameter>, the part type (subject_type,
predicate_type, object_type) is passed in as <parameter>type</parameter>.  When the part
is a literal, the <parameter>literal_datatype</parameter> and <parameter>literal_language</parameter> fields
are set, otherwise NULL (usually object_datatype,
object_literal_language).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>term</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part (subject, predicate, object)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>type</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part type
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal_datatype</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part datatype
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal_language</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part language
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len_p</parameter>&nbsp;:</term>
<listitem><simpara> Pointer to location to store length of new string (if not NULL)
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new string or NULL on failure.  The length of
the new string is returned in *<parameter>len_p</parameter> if len_p is not NULL.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="raptor-statement-part-as-string" role="function">
<title>raptor_statement_part_as_string ()</title>
<indexterm zone="raptor-statement-part-as-string"><primary>raptor_statement_part_as_string</primary></indexterm><programlisting>unsigned <link linkend="char">char</link>*      raptor_statement_part_as_string     (const <link linkend="void">void</link> *term,
                                                         <link linkend="raptor-identifier-type">raptor_identifier_type</link> type,
                                                         <link linkend="raptor-uri">raptor_uri</link> *literal_datatype,
                                                         unsigned <link linkend="char">char</link> *literal_language);</programlisting>
<para>
Turns part of raptor statement into a N-Triples format string.
</para>
<para>
Turns the given <parameter>term</parameter> into an N-Triples escaped string using all the
escapes as defined in http://www.w3.org/TR/rdf-testcases/<link linkend="ntriples"><type>ntriples</type></link>
</para>
<para>
The part (subject, predicate, object) of the raptor_statement is
typically passed in as <parameter>term</parameter>, the part type (subject_type,
predicate_type, object_type) is passed in as <parameter>type</parameter>.  When the part
is a literal, the <parameter>literal_datatype</parameter> and <parameter>literal_language</parameter> fields
are set, otherwise NULL (usually object_datatype,
object_literal_language).</para>
<para>

</para><variablelist role="params">
<varlistentry><term><parameter>term</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part (subject, predicate, object)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>type</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part type
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal_datatype</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part datatype
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>literal_language</parameter>&nbsp;:</term>
<listitem><simpara> <link linkend="raptor-statement"><type>raptor_statement</type></link> part language
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> the new string or NULL on failure.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
