The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<!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 Graph (librdf_model)</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&#160;II.&#160;Reference Manual">
<link rel="prev" href="redland-log.html" title="Logging.">
<link rel="next" href="redland-node.html" title="RDF term (librdf_node)">
<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&#160;I.&#160;Tutorial">
<link rel="part" href="pt02.html" title="Part&#160;II.&#160;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-log.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-node.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="#id2562958" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2625705" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="redland-model"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2562958"></a><span class="refentrytitle">RDF Graph (librdf_model)</span>
</h2>
<p>RDF Graph (librdf_model) &#8212; RDF graph (set of triples) API.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">



typedef     <a href="redland-model.html#librdf-model">librdf_model</a>;
typedef     <a href="redland-model.html#librdf-model-factory">librdf_model_factory</a>;
int         <a href="redland-model.html#librdf-model-enumerate">librdf_model_enumerate</a>          (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             unsigned int counter,
                                             const char **name,
                                             const char **label);
<a href="redland-model.html#librdf-model">librdf_model</a>* <a href="redland-model.html#librdf-new-model">librdf_new_model</a>              (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             <a href="redland-storage.html#librdf-storage">librdf_storage</a> *storage,
                                             const char *options_string);
<a href="redland-model.html#librdf-model">librdf_model</a>* <a href="redland-model.html#librdf-new-model-with-options">librdf_new_model_with_options</a> (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             <a href="redland-storage.html#librdf-storage">librdf_storage</a> *storage,
                                             <a href="redland-hash.html#librdf-hash">librdf_hash</a> *options);
<a href="redland-model.html#librdf-model">librdf_model</a>* <a href="redland-model.html#librdf-new-model-from-model">librdf_new_model_from_model</a>   (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
void        <a href="redland-model.html#librdf-free-model">librdf_free_model</a>               (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
int         <a href="redland-model.html#librdf-model-size">librdf_model_size</a>               (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
int         <a href="redland-model.html#librdf-model-add">librdf_model_add</a>                (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <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);
int         <a href="redland-model.html#librdf-model-add-string-literal-statement">librdf_model_add_string_literal_statement</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *subject,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *predicate,
                                             unsigned char *literal,
                                             const char *xml_language,
                                             int is_wf_xml);
int         <a href="redland-model.html#librdf-model-add-typed-literal-statement">librdf_model_add_typed_literal_statement</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *subject,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *predicate,
                                             unsigned char *literal,
                                             const char *xml_language,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *datatype_uri);
int         <a href="redland-model.html#librdf-model-add-statement">librdf_model_add_statement</a>      (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
int         <a href="redland-model.html#librdf-model-add-statements">librdf_model_add_statements</a>     (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-stream.html#librdf-stream">librdf_stream</a> *statement_stream);
int         <a href="redland-model.html#librdf-model-remove-statement">librdf_model_remove_statement</a>   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
int         <a href="redland-model.html#librdf-model-contains-statement">librdf_model_contains_statement</a> (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
int         <a href="redland-model.html#librdf-model-has-arc-in">librdf_model_has_arc_in</a>         (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *property);
int         <a href="redland-model.html#librdf-model-has-arc-out">librdf_model_has_arc_out</a>        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *property);
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-as-stream">librdf_model_as_stream</a>       (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-serialise">librdf_model_serialise</a>       (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-find-statements">librdf_model_find_statements</a> (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
#define     <a href="redland-model.html#LIBRDF-MODEL-FIND-OPTION-MATCH-SUBSTRING-LITERAL:CAPS">LIBRDF_MODEL_FIND_OPTION_MATCH_SUBSTRING_LITERAL</a>
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-find-statements-with-options">librdf_model_find_statements_with_options</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context_node,
                                             <a href="redland-hash.html#librdf-hash">librdf_hash</a> *options);
<a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* <a href="redland-model.html#librdf-model-get-sources">librdf_model_get_sources</a>   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);
<a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* <a href="redland-model.html#librdf-model-get-arcs">librdf_model_get_arcs</a>      (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);
<a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* <a href="redland-model.html#librdf-model-get-targets">librdf_model_get_targets</a>   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc);
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-model.html#librdf-model-get-source">librdf_model_get_source</a>        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-model.html#librdf-model-get-arc">librdf_model_get_arc</a>           (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-model.html#librdf-model-get-target">librdf_model_get_target</a>        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc);
<a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* <a href="redland-model.html#librdf-model-get-arcs-in">librdf_model_get_arcs_in</a>   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node);
<a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* <a href="redland-model.html#librdf-model-get-arcs-out">librdf_model_get_arcs_out</a>  (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node);
int         <a href="redland-model.html#librdf-model-add-submodel">librdf_model_add_submodel</a>       (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-model.html#librdf-model">librdf_model</a> *sub_model);
int         <a href="redland-model.html#librdf-model-remove-submodel">librdf_model_remove_submodel</a>    (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-model.html#librdf-model">librdf_model</a> *sub_model);
void        <a href="redland-model.html#librdf-model-print">librdf_model_print</a>              (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             FILE *fh);
int         <a href="redland-model.html#librdf-model-context-add-statement">librdf_model_context_add_statement</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
int         <a href="redland-model.html#librdf-model-context-add-statements">librdf_model_context_add_statements</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context,
                                             <a href="redland-stream.html#librdf-stream">librdf_stream</a> *stream);
int         <a href="redland-model.html#librdf-model-context-remove-statement">librdf_model_context_remove_statement</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);
int         <a href="redland-model.html#librdf-model-context-remove-statements">librdf_model_context_remove_statements</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-context-as-stream">librdf_model_context_as_stream</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-context-serialize">librdf_model_context_serialize</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);
int         <a href="redland-model.html#librdf-model-contains-context">librdf_model_contains_context</a>   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);
<a href="redland-query-results.html#librdf-query-results">librdf_query_results</a>* <a href="redland-model.html#librdf-model-query-execute">librdf_model_query_execute</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-query.html#librdf-query">librdf_query</a> *query);
int         <a href="redland-model.html#librdf-model-sync">librdf_model_sync</a>               (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
<a href="redland-storage.html#librdf-storage">librdf_storage</a>* <a href="redland-model.html#librdf-model-get-storage">librdf_model_get_storage</a>    (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
int         <a href="redland-model.html#librdf-model-load">librdf_model_load</a>               (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *uri,
                                             const char *name,
                                             const char *mime_type,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *type_uri);
unsigned char* <a href="redland-model.html#librdf-model-to-counted-string">librdf_model_to_counted_string</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *uri,
                                             const char *name,
                                             const char *mime_type,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *type_uri,
                                             size_t *string_length_p);
unsigned char* <a href="redland-model.html#librdf-model-to-string">librdf_model_to_string</a>       (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *uri,
                                             const char *name,
                                             const char *mime_type,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *type_uri);
<a href="redland-stream.html#librdf-stream">librdf_stream</a>* <a href="redland-model.html#librdf-model-find-statements-in-context">librdf_model_find_statements_in_context</a>
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context_node);
<a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* <a href="redland-model.html#librdf-model-get-contexts">librdf_model_get_contexts</a>  (<a href="redland-model.html#librdf-model">librdf_model</a> *model);
#define     <a href="redland-model.html#LIBRDF-MODEL-FEATURE-CONTEXTS:CAPS">LIBRDF_MODEL_FEATURE_CONTEXTS</a>
<a href="redland-node.html#librdf-node">librdf_node</a>* <a href="redland-model.html#librdf-model-get-feature">librdf_model_get_feature</a>       (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *feature);
int         <a href="redland-model.html#librdf-model-set-feature">librdf_model_set_feature</a>        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *feature,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *value);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2625705"></a><h2>Description</h2>
<p>
The main user API class for Redland, providing access to the RDF
graph and the triples in it (<a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a>), storage, parsing,
serializing and querying.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2625727"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2625737"></a><h3>
<a name="librdf-model"></a>librdf_model</h3>
<a class="indexterm" name="id2625747"></a><pre class="programlisting">typedef struct librdf_model_s librdf_model;
</pre>
<p>
Redland model class.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2625765"></a><h3>
<a name="librdf-model-factory"></a>librdf_model_factory</h3>
<a class="indexterm" name="id2625775"></a><pre class="programlisting">typedef struct librdf_model_factory_s librdf_model_factory;
</pre>
<p>
Redland model factory class.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2625793"></a><h3>
<a name="librdf-model-enumerate"></a>librdf_model_enumerate ()</h3>
<a class="indexterm" name="id2625804"></a><pre class="programlisting">int         librdf_model_enumerate          (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             unsigned int counter,
                                             const char **name,
                                             const char **label);</pre>
<p>
Get information on models.</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>&#160;:</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>counter</code></em>&#160;:</span></td>
<td> index into the list of models
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>name</code></em>&#160;:</span></td>
<td> pointer to store the name of the model (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>label</code></em>&#160;:</span></td>
<td> pointer to store syntax readable label (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure of if counter is out of range
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2625918"></a><h3>
<a name="librdf-new-model"></a>librdf_new_model ()</h3>
<a class="indexterm" name="id2625928"></a><pre class="programlisting"><a href="redland-model.html#librdf-model">librdf_model</a>* librdf_new_model              (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             <a href="redland-storage.html#librdf-storage">librdf_storage</a> *storage,
                                             const char *options_string);</pre>
<p>
Constructor - create a new storage <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object.
</p>
<p>
The options are encoded as described in <code class="function">librdf_hash_from_string()</code>
and can be NULL if none are required.</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>&#160;:</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>storage</code></em>&#160;:</span></td>
<td> <a href="redland-storage.html#librdf-storage"><span class="type">librdf_storage</span></a> to use
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>options_string</code></em>&#160;:</span></td>
<td> options to initialise model
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626052"></a><h3>
<a name="librdf-new-model-with-options"></a>librdf_new_model_with_options ()</h3>
<a class="indexterm" name="id2626065"></a><pre class="programlisting"><a href="redland-model.html#librdf-model">librdf_model</a>* librdf_new_model_with_options (<a href="redland-world.html#librdf-world">librdf_world</a> *world,
                                             <a href="redland-storage.html#librdf-storage">librdf_storage</a> *storage,
                                             <a href="redland-hash.html#librdf-hash">librdf_hash</a> *options);</pre>
<p>
Constructor - Create a new <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> with storage.
</p>
<p>
Options are presently not used.</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>&#160;:</span></td>
<td> redland world object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>storage</code></em>&#160;:</span></td>
<td> <a href="redland-storage.html#librdf-storage"><span class="type">librdf_storage</span></a> storage to use
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>options</code></em>&#160;:</span></td>
<td> <a href="redland-hash.html#librdf-hash"><span class="type">librdf_hash</span></a> of options to use
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626186"></a><h3>
<a name="librdf-new-model-from-model"></a>librdf_new_model_from_model ()</h3>
<a class="indexterm" name="id2626197"></a><pre class="programlisting"><a href="redland-model.html#librdf-model">librdf_model</a>* librdf_new_model_from_model   (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Copy constructor - create a new librdf_model from an existing one.
</p>
<p>
Creates a new model as a copy of the existing model in the same
storage context.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the existing <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626269"></a><h3>
<a name="librdf-free-model"></a>librdf_free_model ()</h3>
<a class="indexterm" name="id2626279"></a><pre class="programlisting">void        librdf_free_model               (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Destructor - Destroy a <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> 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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> model to destroy
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626336"></a><h3>
<a name="librdf-model-size"></a>librdf_model_size ()</h3>
<a class="indexterm" name="id2626346"></a><pre class="programlisting">int         librdf_model_size               (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Get the number of statements in the model.
</p>
<p>
WARNING: Not all underlying stores can return the size of the graph
In which case the return value will be negative.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the number of statements or &lt;0 if not possible
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626413"></a><h3>
<a name="librdf-model-add"></a>librdf_model_add ()</h3>
<a class="indexterm" name="id2626423"></a><pre class="programlisting">int         librdf_model_add                (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <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>
Create and add a new statement about a resource to the model.
</p>
<p>
After this method, the <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects become owned by the model.
All of subject, predicate and object must be non-NULL.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>subject</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of subject
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>predicate</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of predicate
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>object</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of object (literal or resource)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626565"></a><h3>
<a name="librdf-model-add-string-literal-statement"></a>librdf_model_add_string_literal_statement ()</h3>
<a class="indexterm" name="id2626579"></a><pre class="programlisting">int         librdf_model_add_string_literal_statement
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *subject,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *predicate,
                                             unsigned char *literal,
                                             const char *xml_language,
                                             int is_wf_xml);</pre>
<p>
Create and add a new statement about a literal to the model.
</p>
<p>
The language can be set to NULL if not used.
All of subject, predicate and literal must be non-NULL.
</p>
<p>
0.9.12: xml_space argument deleted</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>subject</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of subject
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>predicate</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of predicate
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>literal</code></em>&#160;:</span></td>
<td> string literal conten
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>xml_language</code></em>&#160;:</span></td>
<td> language of literal
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>is_wf_xml</code></em>&#160;:</span></td>
<td> literal is XML
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626751"></a><h3>
<a name="librdf-model-add-typed-literal-statement"></a>librdf_model_add_typed_literal_statement ()</h3>
<a class="indexterm" name="id2626764"></a><pre class="programlisting">int         librdf_model_add_typed_literal_statement
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *subject,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *predicate,
                                             unsigned char *literal,
                                             const char *xml_language,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *datatype_uri);</pre>
<p>
Create and add a new statement about a typed literal to the model.
</p>
<p>
After this method, the <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> subject and predicate become
owned by the model.
</p>
<p>
The language can be set to NULL if not used.
All of subject, predicate and literal must be non-NULL.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>subject</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of subject
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>predicate</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> of predicate
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>literal</code></em>&#160;:</span></td>
<td> string literal content
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>xml_language</code></em>&#160;:</span></td>
<td> language of literal
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>datatype_uri</code></em>&#160;:</span></td>
<td> datatype <a href="redland-uri.html#librdf-uri"><span class="type">librdf_uri</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2626949"></a><h3>
<a name="librdf-model-add-statement"></a>librdf_model_add_statement ()</h3>
<a class="indexterm" name="id2626960"></a><pre class="programlisting">int         librdf_model_add_statement      (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Add a statement to the model.
</p>
<p>
The passed-in statement is copied when added to the model, not
shared with the model.  It must be a complete statement - all
of subject, predicate, object parts must be present.
</p>
<p>
Only statements that are legal RDF can be added: URI or blank subject,
URI predicate and URI or blank or literal object (i.e. anything).
</p>
<p>
If the statement already exists in the model, it is not added.
Duplicate statements can be added when used with Redland Contexts
such as with <a href="redland-model.html#librdf-model-context-add-statement"><span class="type">librdf_model_context_add_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>model</code></em>&#160;:</span></td>
<td> model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> statement object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627058"></a><h3>
<a name="librdf-model-add-statements"></a>librdf_model_add_statements ()</h3>
<a class="indexterm" name="id2627069"></a><pre class="programlisting">int         librdf_model_add_statements     (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-stream.html#librdf-stream">librdf_stream</a> *statement_stream);</pre>
<p>
Add a stream of statements to the model.
</p>
<p>
If any of the statements are illegal RDF statements they will
be skipped and not added.  See <a href="redland-model.html#librdf-model-add-statement"><span class="type">librdf_model_add_statement</span></a> for the detail.
</p>
<p>
If any of the statements already exists in the store, they are not
added unless Redland contexts are being used.  See also
<a href="redland-model.html#librdf-model-context-add-statements"><span class="type">librdf_model_context_add_statements</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>model</code></em>&#160;:</span></td>
<td> model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement_stream</code></em>&#160;:</span></td>
<td> stream of statements to use
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627166"></a><h3>
<a name="librdf-model-remove-statement"></a>librdf_model_remove_statement ()</h3>
<a class="indexterm" name="id2627178"></a><pre class="programlisting">int         librdf_model_remove_statement   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Remove a known statement from the model.
</p>
<p>
It must be a complete statement - all of subject, predicate, object
parts must be present and a legal RDF triple.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> the statement
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627257"></a><h3>
<a name="librdf-model-contains-statement"></a>librdf_model_contains_statement ()</h3>
<a class="indexterm" name="id2627269"></a><pre class="programlisting">int         librdf_model_contains_statement (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Check for a statement in the model.
</p>
<p>
It must be a complete statement - all of subject, predicate,
object parts must be present and a legal RDF triple.  Use
librdf_model_find_statements to search for partial statement
matches.
</p>
<p>
WARNING: librdf_model_contains_statement may not work correctly
with stores using contexts.  In this case, a search using
librdf_model_find_statements for a non-empty list will
return the correct result.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> the statement
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 if the model contains the statement (&gt;0 if the statement is illegal)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627358"></a><h3>
<a name="librdf-model-has-arc-in"></a>librdf_model_has_arc_in ()</h3>
<a class="indexterm" name="id2627368"></a><pre class="programlisting">int         librdf_model_has_arc_in         (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *property);</pre>
<p>
Check if a node has a given property pointing to it.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> resource node
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>property</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> property node
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 if arc property does point to the resource node
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627480"></a><h3>
<a name="librdf-model-has-arc-out"></a>librdf_model_has_arc_out ()</h3>
<a class="indexterm" name="id2627491"></a><pre class="programlisting">int         librdf_model_has_arc_out        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *property);</pre>
<p>
Check if a node has a given property pointing from it.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> resource node
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>property</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> property node
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 if arc property does point from the resource node
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627603"></a><h3>
<a name="librdf-model-as-stream"></a>librdf_model_as_stream ()</h3>
<a class="indexterm" name="id2627613"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_as_stream       (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
List the model contents as a stream of statements.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627674"></a><h3>
<a name="librdf-model-serialise"></a>librdf_model_serialise ()</h3>
<a class="indexterm" name="id2627684"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_serialise       (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Serialise the entire model as a stream (DEPRECATED).
</p>
<p>
DEPRECATED to reduce confusion with the librdf_serializer class.
Please use librdf_model_as_stream.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627750"></a><h3>
<a name="librdf-model-find-statements"></a>librdf_model_find_statements ()</h3>
<a class="indexterm" name="id2627762"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_find_statements (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Find matching statements in the model.
</p>
<p>
The partial statement is a statement where the subject, predicate
and/or object can take the value NULL which indicates a match with
any value in the model</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> the partial statement to match
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of statements (can be empty) or NULL
on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627850"></a><h3>
<a name="LIBRDF-MODEL-FIND-OPTION-MATCH-SUBSTRING-LITERAL:CAPS"></a>LIBRDF_MODEL_FIND_OPTION_MATCH_SUBSTRING_LITERAL</h3>
<a class="indexterm" name="id2627863"></a><pre class="programlisting">#define LIBRDF_MODEL_FIND_OPTION_MATCH_SUBSTRING_LITERAL "http://feature.librdf.org/model-find-match-substring-literal"
</pre>
<p>
Model find statement option.
</p>
<p>
If set, the find statement uses substring matching.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2627888"></a><h3>
<a name="librdf-model-find-statements-with-options"></a>librdf_model_find_statements_with_options ()</h3>
<a class="indexterm" name="id2627902"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_find_statements_with_options
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context_node,
                                             <a href="redland-hash.html#librdf-hash">librdf_hash</a> *options);</pre>
<p>
Search the model for matching statements with match options.
</p>
<p>
Searches the model for a (partial) statement as described in
<a href="redland-statement.html#librdf-statement-match"><code class="function">librdf_statement_match()</code></a> and returns a <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of
matching <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> objects.
</p>
<p>
If options is given then the match is made according to
the given options.  If options is NULL, this is equivalent
to librdf_model_find_statements_in_context.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> partial statement to find
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context_node</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context node or NULL.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>options</code></em>&#160;:</span></td>
<td> <a href="redland-hash.html#librdf-hash"><span class="type">librdf_hash</span></a> of matching options or NULL
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of matching statements (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628078"></a><h3>
<a name="librdf-model-get-sources"></a>librdf_model_get_sources ()</h3>
<a class="indexterm" name="id2628088"></a><pre class="programlisting"><a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* librdf_model_get_sources   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);</pre>
<p>
Return the sources (subjects) of arc in an RDF graph given arc (predicate) and target (object).
</p>
<p>
Searches the model for arcs matching the given arc and target
and returns a list of the source <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects as an iterator</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>arc</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> arc
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>target</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> target
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-iterator.html#librdf-iterator"><span class="type">librdf_iterator</span></a> of <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628225"></a><h3>
<a name="librdf-model-get-arcs"></a>librdf_model_get_arcs ()</h3>
<a class="indexterm" name="id2628235"></a><pre class="programlisting"><a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* librdf_model_get_arcs      (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);</pre>
<p>
Return the arcs (predicates) of an arc in an RDF graph given source (subject) and target (object).
</p>
<p>
Searches the model for arcs matching the given source and target
and returns a list of the arc <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects as an iterator</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>source</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> source
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>target</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> target
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-iterator.html#librdf-iterator"><span class="type">librdf_iterator</span></a> of <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628371"></a><h3>
<a name="librdf-model-get-targets"></a>librdf_model_get_targets ()</h3>
<a class="indexterm" name="id2628382"></a><pre class="programlisting"><a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* librdf_model_get_targets   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc);</pre>
<p>
Return the targets (objects) of an arc in an RDF graph given source (subject) and arc (predicate).
</p>
<p>
Searches the model for targets matching the given source and arc
and returns a list of the source <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects as an iterator</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>source</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> source
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>arc</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> arc
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-iterator.html#librdf-iterator"><span class="type">librdf_iterator</span></a> of <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628518"></a><h3>
<a name="librdf-model-get-source"></a>librdf_model_get_source ()</h3>
<a class="indexterm" name="id2628528"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_model_get_source        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);</pre>
<p>
Return one source (subject) of arc in an RDF graph given arc (predicate) and target (object).
</p>
<p>
Searches the model for arcs matching the given arc and target
and returns one <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> 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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>arc</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> arc
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>target</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> target
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  a new <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> object or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628657"></a><h3>
<a name="librdf-model-get-arc"></a>librdf_model_get_arc ()</h3>
<a class="indexterm" name="id2628668"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_model_get_arc           (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *target);</pre>
<p>
Return one arc (predicate) of an arc in an RDF graph given source (subject) and target (object).
</p>
<p>
Searches the model for arcs matching the given source and target
and returns one <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> 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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>source</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> source
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>target</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> target
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  a new <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> object or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628796"></a><h3>
<a name="librdf-model-get-target"></a>librdf_model_get_target ()</h3>
<a class="indexterm" name="id2628807"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_model_get_target        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *source,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *arc);</pre>
<p>
Return one target (object) of an arc in an RDF graph given source (subject) and arc (predicate).
</p>
<p>
Searches the model for targets matching the given source and arc
and returns one <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> 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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>source</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> source
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>arc</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> arc
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  a new <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> object or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2628936"></a><h3>
<a name="librdf-model-get-arcs-in"></a>librdf_model_get_arcs_in ()</h3>
<a class="indexterm" name="id2628946"></a><pre class="programlisting"><a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* librdf_model_get_arcs_in   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node);</pre>
<p>
Return the properties pointing to the given resource.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> resource node
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-iterator.html#librdf-iterator"><span class="type">librdf_iterator</span></a> of <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629045"></a><h3>
<a name="librdf-model-get-arcs-out"></a>librdf_model_get_arcs_out ()</h3>
<a class="indexterm" name="id2629056"></a><pre class="programlisting"><a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* librdf_model_get_arcs_out  (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *node);</pre>
<p>
Return the properties pointing from the given resource.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>node</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> resource node
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-iterator.html#librdf-iterator"><span class="type">librdf_iterator</span></a> of <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> objects (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629155"></a><h3>
<a name="librdf-model-add-submodel"></a>librdf_model_add_submodel ()</h3>
<a class="indexterm" name="id2629166"></a><pre class="programlisting">int         librdf_model_add_submodel       (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-model.html#librdf-model">librdf_model</a> *sub_model);</pre>
<p>
Add a sub-model to the model.
</p>
<p>
FIXME: Not tested</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>sub_model</code></em>&#160;:</span></td>
<td> the sub model to add
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629242"></a><h3>
<a name="librdf-model-remove-submodel"></a>librdf_model_remove_submodel ()</h3>
<a class="indexterm" name="id2629255"></a><pre class="programlisting">int         librdf_model_remove_submodel    (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-model.html#librdf-model">librdf_model</a> *sub_model);</pre>
<p>
Remove a sub-model from the model.
</p>
<p>
FIXME: Not tested</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>sub_model</code></em>&#160;:</span></td>
<td> the sub model to remove
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629332"></a><h3>
<a name="librdf-model-print"></a>librdf_model_print ()</h3>
<a class="indexterm" name="id2629342"></a><pre class="programlisting">void        librdf_model_print              (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             FILE *fh);</pre>
<p>
Print the model.
</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>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>fh</code></em>&#160;:</span></td>
<td> the FILE stream to print to
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629410"></a><h3>
<a name="librdf-model-context-add-statement"></a>librdf_model_context_add_statement ()</h3>
<a class="indexterm" name="id2629423"></a><pre class="programlisting">int         librdf_model_context_add_statement
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Add a statement to a model with a context.
</p>
<p>
It must be a complete statement - all
of subject, predicate, object parts must be present.
</p>
<p>
If <em class="parameter"><code>context</code></em> is NULL, this is equivalent to librdf_model_add_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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> statement object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629549"></a><h3>
<a name="librdf-model-context-add-statements"></a>librdf_model_context_add_statements ()</h3>
<a class="indexterm" name="id2629563"></a><pre class="programlisting">int         librdf_model_context_add_statements
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context,
                                             <a href="redland-stream.html#librdf-stream">librdf_stream</a> *stream);</pre>
<p>
Add statements to a model with a context.
</p>
<p>
If <em class="parameter"><code>context</code></em> is NULL, this is equivalent to librdf_model_add_statements</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>stream</code></em>&#160;:</span></td>
<td> <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> stream object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629684"></a><h3>
<a name="librdf-model-context-remove-statement"></a>librdf_model_context_remove_statement ()</h3>
<a class="indexterm" name="id2629697"></a><pre class="programlisting">int         librdf_model_context_remove_statement
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement);</pre>
<p>
Remove a statement from a model in a context.
</p>
<p>
It must be a complete statement - all of subject, predicate, object
parts must be present.
</p>
<p>
If <em class="parameter"><code>context</code></em> is NULL, this is equivalent to librdf_model_remove_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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> statement
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629840"></a><h3>
<a name="librdf-model-context-remove-statements"></a>librdf_model_context_remove_statements ()</h3>
<a class="indexterm" name="id2629854"></a><pre class="programlisting">int         librdf_model_context_remove_statements
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);</pre>
<p>
Remove statements from a model with the given context.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> Non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2629952"></a><h3>
<a name="librdf-model-context-as-stream"></a>librdf_model_context_as_stream ()</h3>
<a class="indexterm" name="id2629966"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_context_as_stream
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);</pre>
<p>
List all statements in a model context.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of statements or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630072"></a><h3>
<a name="librdf-model-context-serialize"></a>librdf_model_context_serialize ()</h3>
<a class="indexterm" name="id2630086"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_context_serialize
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);</pre>
<p>
List all statements in a model context.
</p>
<p>
DEPRECATED to reduce confusion with the librdf_serializer class.
Please use librdf_model_context_as_stream.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of statements or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630197"></a><h3>
<a name="librdf-model-contains-context"></a>librdf_model_contains_context ()</h3>
<a class="indexterm" name="id2630210"></a><pre class="programlisting">int         librdf_model_contains_context   (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context);</pre>
<p>
Check for a context in the model.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> the model object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> the contest
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 if the model contains the context node
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630294"></a><h3>
<a name="librdf-model-query-execute"></a>librdf_model_query_execute ()</h3>
<a class="indexterm" name="id2630308"></a><pre class="programlisting"><a href="redland-query-results.html#librdf-query-results">librdf_query_results</a>* librdf_model_query_execute
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-query.html#librdf-query">librdf_query</a> *query);</pre>
<p>
Execute a query against the model.
</p>
<p>
Run the given query against the model and return a <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of
matching <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> objects</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>query</code></em>&#160;:</span></td>
<td> <a href="redland-query.html#librdf-query"><span class="type">librdf_query</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="redland-query-results.html#librdf-query-results"><span class="type">librdf_query_results</span></a> or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630432"></a><h3>
<a name="librdf-model-sync"></a>librdf_model_sync ()</h3>
<a class="indexterm" name="id2630446"></a><pre class="programlisting">int         librdf_model_sync               (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Synchronise the model to the model implementation.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non-0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630514"></a><h3>
<a name="librdf-model-get-storage"></a>librdf_model_get_storage ()</h3>
<a class="indexterm" name="id2630528"></a><pre class="programlisting"><a href="redland-storage.html#librdf-storage">librdf_storage</a>* librdf_model_get_storage    (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Return the storage of this model.
</p>
<p>
Note: this can only return one storage, so model implementations
that have multiple <a href="redland-storage.html#librdf-storage"><span class="type">librdf_storage</span></a> internally may chose not to
implement this.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td>  <a href="redland-storage.html#librdf-storage"><span class="type">librdf_storage</span></a> or NULL if this has no store
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630617"></a><h3>
<a name="librdf-model-load"></a>librdf_model_load ()</h3>
<a class="indexterm" name="id2630631"></a><pre class="programlisting">int         librdf_model_load               (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *uri,
                                             const char *name,
                                             const char *mime_type,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *type_uri);</pre>
<p>
Load content from a URI into the model.
</p>
<p>
If the name field is NULL, the library will try to guess
the parser to use from the uri, mime_type and type_uri fields.
This is done via the raptor_guess_parser_name function.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri</code></em>&#160;:</span></td>
<td> the URI to read the content
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>name</code></em>&#160;:</span></td>
<td> the name of the parser (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>mime_type</code></em>&#160;:</span></td>
<td> the MIME type of the syntax (NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>type_uri</code></em>&#160;:</span></td>
<td> URI identifying the syntax (NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630793"></a><h3>
<a name="librdf-model-to-counted-string"></a>librdf_model_to_counted_string ()</h3>
<a class="indexterm" name="id2630807"></a><pre class="programlisting">unsigned char* librdf_model_to_counted_string
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *uri,
                                             const char *name,
                                             const char *mime_type,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *type_uri,
                                             size_t *string_length_p);</pre>
<p>
Write serialized model to a string.
</p>
<p>
If the name field is NULL, the default serializer will be used.
</p>
<p>
Note: the returned string 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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri</code></em>&#160;:</span></td>
<td> base URI to use in serializing (or NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>name</code></em>&#160;:</span></td>
<td> the name of the serializer (or NULL for default)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>mime_type</code></em>&#160;:</span></td>
<td> the MIME type of the syntax (NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>type_uri</code></em>&#160;:</span></td>
<td> URI identifying the syntax (NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>string_length_p</code></em>&#160;:</span></td>
<td> pointer to location to store string length (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> new string or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2630996"></a><h3>
<a name="librdf-model-to-string"></a>librdf_model_to_string ()</h3>
<a class="indexterm" name="id2631010"></a><pre class="programlisting">unsigned char* librdf_model_to_string       (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *uri,
                                             const char *name,
                                             const char *mime_type,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *type_uri);</pre>
<p>
Write serialized model to a string.
</p>
<p>
If the name field is NULL, the default serializer will be used.
</p>
<p>
Note: the returned string 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>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri</code></em>&#160;:</span></td>
<td> base URI to use in serializing (or NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>name</code></em>&#160;:</span></td>
<td> the name of the serializer (or NULL for default)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>mime_type</code></em>&#160;:</span></td>
<td> the MIME type of the syntax (NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>type_uri</code></em>&#160;:</span></td>
<td> URI identifying the syntax (NULL if not used)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> new string or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2631177"></a><h3>
<a name="librdf-model-find-statements-in-context"></a>librdf_model_find_statements_in_context ()</h3>
<a class="indexterm" name="id2631191"></a><pre class="programlisting"><a href="redland-stream.html#librdf-stream">librdf_stream</a>* librdf_model_find_statements_in_context
                                            (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-statement.html#librdf-statement">librdf_statement</a> *statement,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *context_node);</pre>
<p>
Search the model for matching statements in a given context.
</p>
<p>
Searches the model for a (partial) statement as described in
<a href="redland-statement.html#librdf-statement-match"><code class="function">librdf_statement_match()</code></a> in the given context and returns a
<a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of matching <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> objects.  If
context is NULL, this is equivalent to librdf_model_find_statements.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>statement</code></em>&#160;:</span></td>
<td> <a href="redland-statement.html#librdf-statement"><span class="type">librdf_statement</span></a> partial statement to find
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context_node</code></em>&#160;:</span></td>
<td> context <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> (or NULL)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="redland-stream.html#librdf-stream"><span class="type">librdf_stream</span></a> of matching statements (may be empty) or NULL on failure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2631358"></a><h3>
<a name="librdf-model-get-contexts"></a>librdf_model_get_contexts ()</h3>
<a class="indexterm" name="id2631372"></a><pre class="programlisting"><a href="redland-iterator.html#librdf-iterator">librdf_iterator</a>* librdf_model_get_contexts  (<a href="redland-model.html#librdf-model">librdf_model</a> *model);</pre>
<p>
Return the list of contexts in the graph.
</p>
<p>
Returns an iterator of <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> context nodes for each
context in the graph.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> <a href="redland-iterator.html#librdf-iterator"><span class="type">librdf_iterator</span></a> of context nodes or NULL on failure or if contexts are not supported
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2631460"></a><h3>
<a name="LIBRDF-MODEL-FEATURE-CONTEXTS:CAPS"></a>LIBRDF_MODEL_FEATURE_CONTEXTS</h3>
<a class="indexterm" name="id2631475"></a><pre class="programlisting">#define LIBRDF_MODEL_FEATURE_CONTEXTS "http://feature.librdf.org/model-contexts"
</pre>
<p>
Model feature contexts.
</p>
<p>
If set, the model has redland contexts.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2631500"></a><h3>
<a name="librdf-model-get-feature"></a>librdf_model_get_feature ()</h3>
<a class="indexterm" name="id2631514"></a><pre class="programlisting"><a href="redland-node.html#librdf-node">librdf_node</a>* librdf_model_get_feature       (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *feature);</pre>
<p>
Get the value of a graph feature .</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>feature</code></em>&#160;:</span></td>
<td> <a href="redland-uri.html#librdf-uri"><span class="type">librdf_uri</span></a> feature property
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> new <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> feature value or NULL if no such feature
exists or the value is empty.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2631618"></a><h3>
<a name="librdf-model-set-feature"></a>librdf_model_set_feature ()</h3>
<a class="indexterm" name="id2631632"></a><pre class="programlisting">int         librdf_model_set_feature        (<a href="redland-model.html#librdf-model">librdf_model</a> *model,
                                             <a href="redland-uri.html#librdf-uri">librdf_uri</a> *feature,
                                             <a href="redland-node.html#librdf-node">librdf_node</a> *value);</pre>
<p>
Set the value of a graph feature.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>model</code></em>&#160;:</span></td>
<td> <a href="redland-model.html#librdf-model"><span class="type">librdf_model</span></a> object
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>feature</code></em>&#160;:</span></td>
<td> <a href="redland-uri.html#librdf-uri"><span class="type">librdf_uri</span></a> feature property
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td> <a href="redland-node.html#librdf-node"><span class="type">librdf_node</span></a> feature property value
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> non 0 on failure (negative if no such feature)
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>