<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Redland RDF Application Framework - Python API Reference</title>
</head>
<body>
<h1 style="text-align:center">Redland RDF Application Framework - Python API Reference</h1>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="heading">
<tr bgcolor="#7799EE">
<td valign="bottom"> <br />
<font color="#FFFFFF" face="helvetica, arial"> <br />
<big><big><strong>RDF</strong></big></big> (version 1.1, $Date$)</font></td>
<td align="right" valign="bottom"><font color="#FFFFFF" face="helvetica, arial"><a href=".">index</a><br />
</font></td>
</tr>
</table>
<!-- LICENSE HEADING -->
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#AA55CC">
<td colspan="3" valign="bottom"> <br />
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Modules</strong></big></font></td>
</tr>
<tr>
<td bgcolor="#AA55CC"><tt> </tt></td>
<td> </td>
<td width="100%">
<table width="100%" summary="list">
<tr>
<td width="25%" valign="top">Redland<br /></td>
<td width="25%" valign="top">string<br /></td>
<td width="25%" valign="top">sys<br /></td>
<td width="25%" valign="top"></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#EE77AA">
<td colspan="3" valign="bottom"> <br />
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Classes</strong></big></font></td>
</tr>
<tr>
<td bgcolor="#EE77AA"><tt> </tt></td>
<td> </td>
<td width="100%">
<dl>
<dt><font face="helvetica, arial">__builtin__.object</font></dt>
<dd>
<dl>
<dt><font face="helvetica, arial"><a href="#Iterator">Iterator</a></font></dt>
<dt><font face="helvetica, arial"><a href="#Model">Model</a></font></dt>
<dt><font face="helvetica, arial"><a href="#NS">NS</a></font></dt>
<dt><font face="helvetica, arial"><a href="#Node">Node</a></font></dt>
<dt><font face="helvetica, arial"><a href="#Parser">Parser</a></font></dt>
<dd>
<dl>
<dt><font face="helvetica, arial"><a href="#NTriplesParser">NTriplesParser</a></font></dt>
<dt><font face="helvetica, arial"><a href="#TurtleParser">TurtleParser</a></font></dt>
</dl>
</dd>
<dt><font face="helvetica, arial"><a href="#Query">Query</a></font></dt>
<dd>
<dl>
<dt><font face="helvetica, arial"><a href="#RDQLQuery">RDQLQuery</a></font></dt>
<dt><font face="helvetica, arial"><a href="#SPARQLQuery">SPARQLQuery</a></font></dt>
</dl>
</dd>
<dt><font face="helvetica, arial"><a href="#Serializer">Serializer</a></font></dt>
<dd>
<dl>
<dt><font face="helvetica, arial"><a href="#NTriplesSerializer">NTriplesSerializer</a></font></dt>
<dt><font face="helvetica, arial"><a href="#RDFXMLSerializer">RDFXMLSerializer</a></font></dt>
</dl>
</dd>
<dt><font face="helvetica, arial"><a href="#Statement">Statement</a></font></dt>
<dt><font face="helvetica, arial"><a href="#Storage">Storage</a></font></dt>
<dd>
<dl>
<dt><font face="helvetica, arial"><a href="#HashStorage">HashStorage</a></font></dt>
<dt><font face="helvetica, arial"><a href="#MemoryStorage">MemoryStorage</a></font></dt>
</dl>
</dd>
<dt><font face="helvetica, arial"><a href="#Stream">Stream</a></font></dt>
<dt><font face="helvetica, arial"><a href="#Uri">Uri</a></font></dt>
</dl>
</dd>
</dl>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="HashStorage" id="HashStorage">class <strong>HashStorage</strong></a>(<a href="#Storage">Storage</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland Hashed <a href="#Storage">Storage</a> class<br />
<br />
import RDF<br />
h1=RDF.<a href="#HashStorage">HashStorage</a>("abc", options="hash-type='memory'")<br />
<br />
# Creating a storage with contexts enabled<br />
s=RDF.<a href="#HashStorage">HashStorage</a>("def", options="contexts='yes'")<br />
<br />
Class of hashed <a href="#Storage">Storage</a> for a particular type of hash (typically<br />
hash-type is "memory" or "bdb") and any other options.<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#HashStorage">HashStorage</a></dd>
<dd><a href="#Storage">Storage</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="HashStorage-__init__" id="HashStorage-__init__"><strong>__init__</strong></a>(self, hash_name, options<font color="#909090">=''</font>)</dt>
</dl>
<hr />
Methods inherited from <a href="#Storage">Storage</a>:<br />
<dl>
<dt><a name="HashStorage-__del__" id="HashStorage-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<hr />
Data descriptors inherited from <a href="#Storage">Storage</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Iterator" id="Iterator">class <strong>Iterator</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland <a href="#Node">Node</a> <a href="#Iterator">Iterator</a> class<br />
<br />
A class for iterating over a sequence of <a href="#Node">Node</a> s such as<br />
those returned from a <a href="#Model">Model</a> query. Some methods return<br />
<a href="#Iterator">Iterator</a> s or Python sequences. If this is used, it works<br />
as follows:<br />
<br />
iterator=model.get_targets_iterator(source, arc)<br />
while not iterator.<a href="#Iterator-end">end</a>():<br />
# get the current <a href="#Node">Node</a><br />
node=iterator.<a href="#Iterator-current">current</a>()<br />
# do something with it<br />
# (it is shared; you must copy it you want to keep it)<br />
...<br />
iterator.<a href="#Iterator-next">next</a>()<br />
iterator=None<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Iterator-__del__" id="Iterator-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Iterator-__init__" id="Iterator-__init__"><strong>__init__</strong></a>(self, object, creator1<font color="#909090">=None</font>, creator2<font color="#909090">=None</font>, creator3<font color="#909090">=None</font>)</dt>
<dd><tt>Create an RDF <a href="#Iterator">Iterator</a> (constructor).</tt></dd>
</dl>
<dl>
<dt><a name="Iterator-__iter__" id="Iterator-__iter__"><strong>__iter__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Iterator-context" id="Iterator-context"><strong>context</strong></a>(self)</dt>
<dd><tt>Return the context <a href="#Node">Node</a> of the current object on the <a href="#Iterator">Iterator</a></tt></dd>
</dl>
<dl>
<dt><a name="Iterator-current" id="Iterator-current"><strong>current</strong></a>(self)</dt>
<dd><tt>Return the current object on the <a href="#Iterator">Iterator</a></tt></dd>
</dl>
<dl>
<dt><a name="Iterator-end" id="Iterator-end"><strong>end</strong></a>(self)</dt>
<dd><tt>Return true if the iterator is exhausted</tt></dd>
</dl>
<dl>
<dt><a name="Iterator-have_elements" id="Iterator-have_elements"><strong>have_elements</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Iterator-next" id="Iterator-next"><strong>next</strong></a>(self)</dt>
<dd><tt>Move to the next object on the <a href="#Iterator">Iterator</a></tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="MemoryStorage" id="MemoryStorage">class <strong>MemoryStorage</strong></a>(<a href="#Storage">Storage</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland memory <a href="#Storage">Storage</a> class<br />
<br />
import RDF<br />
h1=RDF.<a href="#MemoryStorage">MemoryStorage</a>()<br />
h1=RDF.<a href="#MemoryStorage">MemoryStorage</a>("abc")<br />
h2=RDF.<a href="#MemoryStorage">MemoryStorage</a>("abc", "write='no'")<br />
<br />
# Creating a storage with contexts enabled<br />
s = RDF.<a href="#MemoryStorage">MemoryStorage</a>(options_string="contexts='yes'")<br />
<br />
Class of memory <a href="#Storage">Storage</a> with optional name, additional options.<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#MemoryStorage">MemoryStorage</a></dd>
<dd><a href="#Storage">Storage</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="MemoryStorage-__init__" id="MemoryStorage-__init__"><strong>__init__</strong></a>(self, mem_name<font color="#909090">=''</font>, options_string<font color="#909090">=''</font>)</dt>
</dl>
<hr />
Methods inherited from <a href="#Storage">Storage</a>:<br />
<dl>
<dt><a name="MemoryStorage-__del__" id="MemoryStorage-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<hr />
Data descriptors inherited from <a href="#Storage">Storage</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Model" id="Model">class <strong>Model</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland Graph class<br />
<br />
import RDF<br />
model = RDF.<a href="#Model">Model</a>(storage)<br />
<br />
The main interface to the Redland RDF graph (formed from triples, or<br />
RDF statements). There are many methods for adding, removing, querying<br />
statements and serializing them to/from syntaxes using the <a href="#Serializer">Serializer</a><br />
or <a href="#Parser">Parser</a> classes.<br />
<br />
Models can also be used as Python sequences to give every triple in the<br />
model:<br />
<br />
for statement in model:<br />
print statement<br />
<br />
Models have other aspects of sequence types. The following also works:<br />
<br />
if statement in model: # do whatever<br />
if (statement, context) in model: # do whatever<br />
<br />
del model[statement] # remove statement from model<br />
del model[statement, context] # ditto for context-aware model<br />
<br />
model.<a href="#Model-append">append</a>(statement) # append a statement<br />
model.<a href="#Model-append">append</a>(statement, context) # append statement with context<br />
<br />
num_items = len(model) # get number of statements in the model<br />
# works only with countable storages<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Model-__contains__" id="Model-__contains__"><strong>__contains__</strong></a>(self, arg)</dt>
</dl>
<dl>
<dt><a name="Model-__del__" id="Model-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Model-__delitem__" id="Model-__delitem__"><strong>__delitem__</strong></a>(self, arg)</dt>
</dl>
<dl>
<dt><a name="Model-__init__" id="Model-__init__"><strong>__init__</strong></a>(self, storage<font color="#909090">=None</font>, **args)</dt>
<dd><tt>Create an RDF <a href="#Model">Model</a> (constructor).<br />
<br />
Create a <a href="#Model">Model</a> from an existing <a href="#Storage">Storage</a> (most common use). <br />
<br />
Optional parameters:<br />
<br />
options_string - A string of options for the <a href="#Model">Model</a><br />
options_hash - A Hash of options for the <a href="#Model">Model</a><br />
<br />
m1 = RDF.<a href="#Model">Model</a>(s1)<br />
m1 = RDF.<a href="#Model">Model</a>(storage = s1)<br />
<br />
Copy an existing model m1, copying the underlying <a href="#Storage">Storage</a> of m1<br />
<br />
m2 = RDF.<a href="#Model">Model</a>(model = m1)<br />
<br />
Create a model using an in-memory storage.<br />
<br />
m3 = RDF.<a href="#Model">Model</a>()</tt></dd>
</dl>
<dl>
<dt><a name="Model-__iter__" id="Model-__iter__"><strong>__iter__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Model-__len__" id="Model-__len__"><strong>__len__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Model-__str__" id="Model-__str__"><strong>__str__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Model-__unicode__" id="Model-__unicode__"><strong>__unicode__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Model-add" id="Model-add"><strong>add</strong></a>(self, subject, predicate, object)</dt>
<dd><tt>Add the statement (subject,predicate,object) to the model.<br />
DEPRECATED. Use <a href="#Model">Model</a>.<a href="#Model-append">append</a>(<a href="#Statement">Statement</a>(s,p,o)) instead.</tt></dd>
</dl>
<dl>
<dt><a name="Model-add_statement" id="Model-add_statement"><strong>add_statement</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt>
<dd><tt>Add the <a href="#Statement">Statement</a> to the <a href="#Model">Model</a> with optional context <a href="#Node">Node</a>.<br />
For Python idiom you should use <a href="#Model">Model</a>.<a href="#Model-append">append</a>() instead, which does<br />
the same thing.</tt></dd>
</dl>
<dl>
<dt><a name="Model-add_statements" id="Model-add_statements"><strong>add_statements</strong></a>(self, statement_stream, context<font color="#909090">=None</font>)</dt>
<dd><tt>Add the <a href="#Stream">Stream</a> of Statements to the <a href="#Model">Model</a> with the optional<br />
context <a href="#Node">Node</a></tt></dd>
</dl>
<dl>
<dt><a name="Model-add_typed_literal_statement" id="Model-add_typed_literal_statement"><strong>add_typed_literal_statement</strong></a>(self, subject, predicate, string, xml_language<font color="#909090">=None</font>, datatype<font color="#909090">=None</font>)</dt>
<dd><tt>Add the <a href="#Statement">Statement</a> (subject,predicate, typed literal) to the <a href="#Model">Model</a><br />
where the typed literal is constructed from the<br />
literal string, optional XML language and optional datatype URI.<br />
DEPRECATED. Use <a href="#Model">Model</a>.<a href="#Model-append">append</a>(<a href="#Statement">Statement</a>(s,p,o)) instead.</tt></dd>
</dl>
<dl>
<dt><a name="Model-append" id="Model-append"><strong>append</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt>
<dd><tt>Append a <a href="#Statement">Statement</a> to the <a href="#Model">Model</a>, with optional context <a href="#Node">Node</a>.<br />
<br />
model.<a href="#Model-append">append</a>(<a href="#Statement">Statement</a>(s, p, o)</tt></dd>
</dl>
<dl>
<dt><a name="Model-arcs" id="Model-arcs"><strong>arcs</strong></a> = <a href="#Model-get_predicates">get_predicates</a>(self, source, target)</dt>
</dl>
<dl>
<dt><a name="Model-as_stream" id="Model-as_stream"><strong>as_stream</strong></a>(self, context<font color="#909090">=None</font>)</dt>
<dd><tt>Return the <a href="#Model">Model</a> as a <a href="#Stream">Stream</a> of Statements. No need to use<br />
this explicitly, instead do:<br />
<br />
for statement in model:<br />
# process statement</tt></dd>
</dl>
<dl>
<dt><a name="Model-as_stream_context" id="Model-as_stream_context"><strong>as_stream_context</strong></a>(self, context<font color="#909090">=None</font>)</dt>
<dd><tt>Return the <a href="#Model">Model</a> as a <a href="#Stream">Stream</a> of (statement, context) tuples.<br />
<br />
for (s, c) in model.<a href="#Model-as_stream_context">as_stream_context</a>():<br />
# do whatever<br />
<br />
Specify the optional argument context if you want to hardwire<br />
the stream's context.</tt></dd>
</dl>
<dl>
<dt><a name="Model-contains_statement" id="Model-contains_statement"><strong>contains_statement</strong></a>(self, statement)</dt>
<dd><tt>Return true if the <a href="#Statement">Statement</a> is in the <a href="#Model">Model</a></tt></dd>
</dl>
<dl>
<dt><a name="Model-contains_statement_context" id="Model-contains_statement_context"><strong>contains_statement_context</strong></a>(self, statement, context)</dt>
<dd><tt>Return true if the <a href="#Statement">Statement</a> is in the <a href="#Model">Model</a> with the specified<br />
context. Note that the implementation is pretty inefficient.</tt></dd>
</dl>
<dl>
<dt><a name="Model-context_remove_statements" id="Model-context_remove_statements"><strong>context_remove_statements</strong></a> = <a href="#Model-remove_statements_with_context">remove_statements_with_context</a>(self, context)</dt>
</dl>
<dl>
<dt><a name="Model-execute" id="Model-execute"><strong>execute</strong></a>(self, query)</dt>
</dl>
<dl>
<dt><a name="Model-find_statements" id="Model-find_statements"><strong>find_statements</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements matching the given <a href="#Statement">Statement</a> --<br />
any nodes with value None of the statement match any <a href="#Node">Node</a> in<br />
the <a href="#Model">Model</a>.<br />
<br />
Specify the optional argument context if you want to search<br />
only in one context.<br />
<br />
qs = RDF.<a href="#Statement">Statement</a>(subject = None,<br />
predicate = RDF.<a href="#Node">Node</a>(uri_string = "http://example.com/pred"),<br />
object = None)<br />
for statement in model.<a href="#Model-find_statements">find_statements</a>(qs):<br />
# do whatever</tt></dd>
</dl>
<dl>
<dt><a name="Model-find_statements_context" id="Model-find_statements_context"><strong>find_statements_context</strong></a>(self, statement)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements with context, matching the given<br />
<a href="#Statement">Statement</a> -- any nodes with value None of the statement match<br />
any <a href="#Node">Node</a> in the <a href="#Model">Model</a>.<br />
<br />
qs = RDF.<a href="#Statement">Statement</a>(subject = None,<br />
predicate = RDF.<a href="#Node">Node</a>(uri_string = "http://example.com/pred"),<br />
object = None)<br />
for (statement, context) in model.<a href="#Model-find_statements_context">find_statements_context</a>(qs):<br />
# do whatever</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_arc" id="Model-get_arc"><strong>get_arc</strong></a> = <a href="#Model-get_predicate">get_predicate</a>(self, source, target)</dt>
</dl>
<dl>
<dt><a name="Model-get_arcs" id="Model-get_arcs"><strong>get_arcs</strong></a> = <a href="#Model-get_predicates">get_predicates</a>(self, source, target)</dt>
</dl>
<dl>
<dt><a name="Model-get_contexts" id="Model-get_contexts"><strong>get_contexts</strong></a>(self)</dt>
<dd><tt>Return a sequence of context Nodes in the <a href="#Model">Model</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_feature" id="Model-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Model">Model</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_predicate" id="Model-get_predicate"><strong>get_predicate</strong></a>(self, source, target)</dt>
<dd><tt>Return one <a href="#Node">Node</a> in the <a href="#Model">Model</a> matching (source, ?, target).<br />
The source can be a <a href="#Node">Node</a> or <a href="#Uri">Uri</a>, the target a <a href="#Node">Node</a>, <a href="#Uri">Uri</a> or string.</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_predicates" id="Model-get_predicates"><strong>get_predicates</strong></a>(self, source, target)</dt>
<dd><tt>Return a sequence of Nodes that are the predicates<br />
of Statements in the <a href="#Model">Model</a> matching (source, ?, target).<br />
<br />
Instead of specifying a <a href="#Node">Node</a> for source, you can shortcut with<br />
a <a href="#Uri">Uri</a>, and with a <a href="#Uri">Uri</a> or string for target.<br />
<br />
e.g.<br />
model.<a href="#Model-get_predicates">get_predicates</a>(<a href="#Uri">Uri</a>("http://example.com/me"), "Fred")</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_predicates_context" id="Model-get_predicates_context"><strong>get_predicates_context</strong></a>(self, source, target)</dt>
<dd><tt>As for <a href="#Model">Model</a>.get_predicates but returns a list of <br />
(statement, context) tuples.</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_source" id="Model-get_source"><strong>get_source</strong></a>(self, predicate, target)</dt>
<dd><tt>Return one <a href="#Node">Node</a> in the <a href="#Model">Model</a> matching (?, predicate, target).<br />
The predicate can be a <a href="#Node">Node</a> or <a href="#Uri">Uri</a>, the target a <a href="#Node">Node</a>, <a href="#Uri">Uri</a> or string.</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_sources" id="Model-get_sources"><strong>get_sources</strong></a>(self, predicate, target)</dt>
<dd><tt>Return a sequence of <a href="#Node">Node</a> s that are the source<br />
of Statements in the <a href="#Model">Model</a> matching (?, predicate, target).<br />
<br />
Instead of specifying a <a href="#Node">Node</a> for predicate, you can shortcut with<br />
a <a href="#Uri">Uri</a>, and with a <a href="#Uri">Uri</a> or string for target.<br />
<br />
e.g.<br />
model.<a href="#Model-get_sources">get_sources</a>(<a href="#Uri">Uri</a>("http://example.com/name"), "Fred")</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_sources_context" id="Model-get_sources_context"><strong>get_sources_context</strong></a>(self, predicate, target)</dt>
<dd><tt>As for <a href="#Model">Model</a>.get_sources but returns a list of <br />
(statement, context) tuples.</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_target" id="Model-get_target"><strong>get_target</strong></a>(self, source, predicate)</dt>
<dd><tt>Return one <a href="#Node">Node</a> in the <a href="#Model">Model</a> matching (source, predicate, ?).<br />
The source and predicate can be a <a href="#Node">Node</a> or <a href="#Uri">Uri</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_targets" id="Model-get_targets"><strong>get_targets</strong></a>(self, source, predicate)</dt>
<dd><tt>Return a sequence of Nodes that are the targets<br />
of Statements in the <a href="#Model">Model</a> matching (source, predicate, ?).<br />
<br />
Instead of specifying a <a href="#Node">Node</a> for source or predicate, you<br />
can shortcut with a <a href="#Uri">Uri</a>.<br />
<br />
e.g.<br />
<br />
model.<a href="#Model-get_targets">get_targets</a>(<a href="#Uri">Uri</a>("http://example.com/me"), prednode)</tt></dd>
</dl>
<dl>
<dt><a name="Model-get_targets_context" id="Model-get_targets_context"><strong>get_targets_context</strong></a>(self, source, predicate)</dt>
<dd><tt>As for <a href="#Model">Model</a>.get_targets but returns a list of <br />
(statement, context) tuples.</tt></dd>
</dl>
<dl>
<dt><a name="Model-load" id="Model-load"><strong>load</strong></a>(self, uri, name<font color="#909090">=''</font>, mime_type<font color="#909090">=''</font>, type_uri<font color="#909090">=None</font>, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Load triples into the <a href="#Model">Model</a> from a URI in a syntax.<br />
Returns a boolean success or failure.<br />
<br />
If no parser name is given, the parser to use is guessed.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.</tt></dd>
</dl>
<dl>
<dt><a name="Model-predicates" id="Model-predicates"><strong>predicates</strong></a> = <a href="#Model-get_predicates">get_predicates</a>(self, source, target)</dt>
</dl>
<dl>
<dt><a name="Model-remove_statement" id="Model-remove_statement"><strong>remove_statement</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt>
<dd><tt>Remove the <a href="#Statement">Statement</a> from the <a href="#Model">Model</a> with the optional context <a href="#Node">Node</a>.<br />
This is used by the __delitem__ method. Preferred way of removing a<br />
<a href="#Statement">Statement</a> is:<br />
<br />
del model[statement]<br />
del model[statement, context]</tt></dd>
</dl>
<dl>
<dt><a name="Model-remove_statements_with_context" id="Model-remove_statements_with_context"><strong>remove_statements_with_context</strong></a>(self, context)</dt>
<dd><tt>Remove all Statements from the <a href="#Model">Model</a> with the given context <a href="#Node">Node</a></tt></dd>
</dl>
<dl>
<dt><a name="Model-run_as_statements" id="Model-run_as_statements"><strong>run_as_statements</strong></a>(self, query)</dt>
</dl>
<dl>
<dt><a name="Model-serialise" id="Model-serialise"><strong>serialise</strong></a> = <a href="#Model-as_stream">as_stream</a>(self, context<font color="#909090">=None</font>)</dt>
</dl>
<dl>
<dt><a name="Model-set_feature" id="Model-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Model">Model</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="Model-size" id="Model-size"><strong>size</strong></a>(self)</dt>
<dd><tt>Return the size of the <a href="#Model">Model</a> in number of statements.<br />
Returns a value < 0 if number of statements not countable.</tt></dd>
</dl>
<dl>
<dt><a name="Model-sources" id="Model-sources"><strong>sources</strong></a> = <a href="#Model-get_sources">get_sources</a>(self, predicate, target)</dt>
</dl>
<dl>
<dt><a name="Model-sync" id="Model-sync"><strong>sync</strong></a>(self)</dt>
<dd><tt>Synchronise the <a href="#Model">Model</a> with the underlying <a href="#Storage">Storage</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Model-targets" id="Model-targets"><strong>targets</strong></a> = <a href="#Model-get_targets">get_targets</a>(self, source, predicate)</dt>
</dl>
<dl>
<dt><a name="Model-to_string" id="Model-to_string"><strong>to_string</strong></a>(self, base_uri<font color="#909090">=None</font>, name<font color="#909090">=''</font>, mime_type<font color="#909090">=''</font>, type_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize the <a href="#Model">Model</a> to a syntax.<br />
<br />
print model.<a href="#Model-to_string">to_string</a>(base_uri="http://example.org/base")<br />
<br />
If no serializer name is given, the default serializer RDF/XML is used.</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="NS" id="NS">class <strong>NS</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland Namespace Utility Class<br />
<br />
import RDF<br />
nspace = RDF.<a href="#NS">NS</a>("http://example.com/foo#")<br />
<br />
# creates an RDF <a href="#Node">Node</a> for http://example.com/foo#blah <br />
node1 = nspace.blah<br />
<br />
# creates an RDF <a href="#Node">Node</a> for http://example.com/foo#blah <br />
node2 = nspace['blah']<br />
<br />
A class for generating RDF Nodes with URIs from the same vocabulary<br />
(such as XML Namespace) varying only in the appended name in<br />
the vocabulary. Each node returned is a pointer to a shared copy.<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="NS-__getattr__" id="NS-__getattr__"><strong>__getattr__</strong></a>(self, localName)</dt>
</dl>
<dl>
<dt><a name="NS-__getitem__" id="NS-__getitem__"><strong>__getitem__</strong></a>(self, localName)</dt>
</dl>
<dl>
<dt><a name="NS-__init__" id="NS-__init__"><strong>__init__</strong></a>(self, prefix)</dt>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="NTriplesParser" id="NTriplesParser">class <strong>NTriplesParser</strong></a>(<a href="#Parser">Parser</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland N-Triples <a href="#Parser">Parser</a> class<br />
<br />
import RDF<br />
parser=RDF.<a href="#NTriplesParser">NTriplesParser</a>()<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#NTriplesParser">NTriplesParser</a></dd>
<dd><a href="#Parser">Parser</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="NTriplesParser-__init__" id="NTriplesParser-__init__"><strong>__init__</strong></a>(self)</dt>
</dl>
<hr />
Methods inherited from <a href="#Parser">Parser</a>:<br />
<dl>
<dt><a name="NTriplesParser-__del__" id="NTriplesParser-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="NTriplesParser-get_feature" id="NTriplesParser-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-namespaces_seen" id="NTriplesParser-namespaces_seen"><strong>namespaces_seen</strong></a>(self)</dt>
<dd><tt>Get a dictionary of prefix/URI pairs for namespaces seen during parsing.</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-parse_as_stream" id="NTriplesParser-parse_as_stream"><strong>parse_as_stream</strong></a>(self, uri, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content at<br />
a URI for the optional base URI or None if the parsing fails.<br />
<br />
(This depends on what URI support raptor provides to redland)<br />
<br />
for statement in parser.<a href="#NTriplesParser-parse_as_stream">parse_as_stream</a>(""):<br />
print statement</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-parse_into_model" id="NTriplesParser-parse_into_model"><strong>parse_into_model</strong></a>(self, model, uri, base_uri<font color="#909090">=None</font>, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content at the URI, for<br />
the optional base URI. Returns a boolean success or failure.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.<br />
<br />
parser.<a href="#NTriplesParser-parse_into_model">parse_into_model</a>(model, "file:./foo.rdf",<br />
"http://example.com/foo.rdf")</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-parse_string_as_stream" id="NTriplesParser-parse_string_as_stream"><strong>parse_string_as_stream</strong></a>(self, string, base_uri)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content in<br />
string with the required base URI or None if the parsing fails.<br />
<br />
for statement in parser.<a href="#NTriplesParser-parse_string_as_stream">parse_string_as_stream</a>(rdfstring, base_uri):<br />
print statement</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-parse_string_into_model" id="NTriplesParser-parse_string_into_model"><strong>parse_string_into_model</strong></a>(self, model, string, base_uri, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content string<br />
with the required base URI. Returns a boolean success or failure.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-set_feature" id="NTriplesParser-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesParser-set_uri_filter" id="NTriplesParser-set_uri_filter"><strong>set_uri_filter</strong></a>(self, filter)</dt>
<dd><tt>Set a function for rejecting retrieval of URIs seen during parsing.<br />
<br />
Return False or 0 to not reject the URI<br />
<br />
def reject(uri):<br />
if "bad" == uri:<br />
return True<br />
return False<br />
<br />
parser.<a href="#NTriplesParser-set_uri_filter">set_uri_filter</a>(reject)</tt></dd>
</dl>
<hr />
Data descriptors inherited from <a href="#Parser">Parser</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="NTriplesSerializer" id="NTriplesSerializer">class <strong>NTriplesSerializer</strong></a>(<a href="#Serializer">Serializer</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland N-Triples <a href="#Serializer">Serializer</a> class<br />
<br />
import RDF<br />
ser=RDF.<a href="#NTriplesSerializer">NTriplesSerializer</a>()<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#NTriplesSerializer">NTriplesSerializer</a></dd>
<dd><a href="#Serializer">Serializer</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="NTriplesSerializer-__init__" id="NTriplesSerializer-__init__"><strong>__init__</strong></a>(self)</dt>
</dl>
<hr />
Methods inherited from <a href="#Serializer">Serializer</a>:<br />
<dl>
<dt><a name="NTriplesSerializer-__del__" id="NTriplesSerializer-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="NTriplesSerializer-get_feature" id="NTriplesSerializer-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the value of <a href="#Serializer">Serializer</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesSerializer-serialize_model_to_file" id="NTriplesSerializer-serialize_model_to_file"><strong>serialize_model_to_file</strong></a>(self, name, model, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize to filename name the <a href="#Model">Model</a> model using the<br />
optional base URI.</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesSerializer-serialize_model_to_string" id="NTriplesSerializer-serialize_model_to_string"><strong>serialize_model_to_string</strong></a>(self, model, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize to a string using the optional base URI.</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesSerializer-set_feature" id="NTriplesSerializer-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the value of <a href="#Serializer">Serializer</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="NTriplesSerializer-set_namespace" id="NTriplesSerializer-set_namespace"><strong>set_namespace</strong></a>(self, prefix, uri)</dt>
<dd><tt>Set a namespace prefix and URI for the <a href="#Serializer">Serializer</a> to use.</tt></dd>
</dl>
<hr />
Data descriptors inherited from <a href="#Serializer">Serializer</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Node" id="Node">class <strong>Node</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland <a href="#Node">Node</a> (RDF Resource, Property, Literal) Class<br />
<br />
import RDF<br />
<br />
node1=RDF.<a href="#Node">Node</a>()<br />
<br />
node2=RDF.<a href="#Node">Node</a>(RDF.<a href="#Uri">Uri</a>("http://example.com/"))<br />
node3=RDF.<a href="#Node">Node</a>("Hello, World!")<br />
<br />
node4=RDF.<a href="#Node">Node</a>(uri_string="http://example.com/")<br />
node5=RDF.<a href="#Node">Node</a>(literal="<tag>content</tag>", is_wf_xml=1)<br />
node6=RDF.<a href="#Node">Node</a>(blank="abc")<br />
node7=RDF.<a href="#Node">Node</a>(node5)<br />
...<br />
<br />
print node2<br />
if node7.<a href="#Node-is_resource">is_resource</a>():<br />
print "Resource with URI", node7.uri<br />
<br />
if node5.<a href="#Node-is_blank">is_blank</a>():<br />
print "Resource with blank node name ", node5.blank_identifier<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Node-__del__" id="Node-__del__"><strong>__del__</strong></a>(self)</dt>
<dd><tt>Free an RDF <a href="#Node">Node</a> (destructor).</tt></dd>
</dl>
<dl>
<dt><a name="Node-__eq__" id="Node-__eq__"><strong>__eq__</strong></a>(self, other)</dt>
<dd><tt>Equality of an RDF <a href="#Node">Node</a> compared to another RDF <a href="#Node">Node</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Node-__hash__" id="Node-__hash__"><strong>__hash__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Node-__init__" id="Node-__init__"><strong>__init__</strong></a>(self, arg<font color="#909090">=None</font>, **args)</dt>
<dd><tt>Create an RDF <a href="#Node">Node</a> (constructor).<br />
<br />
Resource or Property node creation:<br />
<br />
n1 = <a href="#Node">Node</a>(<a href="#Uri">Uri</a>("http://example.com/foo"))<br />
<br />
String literal node creation (see below for more complex<br />
ways of building literals.)<br />
<br />
n2 = <a href="#Node">Node</a>("foo")<br />
<br />
<a href="#Node">Node</a> copying:<br />
<br />
n3 = <a href="#Node">Node</a>(n1)<br />
<br />
Or create a new RDF <a href="#Node">Node</a> using the following named parameters:<br />
<br />
uri_string - create a resource node from a string URI<br />
uri - create a resource node from a URI object<br />
literal - create a literal node from a literal string <br />
datatype - the datatype URI<br />
is_wf_xml - the literal is XML (alternative to datatype)<br />
language - the literal XML language<br />
blank - create a resource node from with a blank node identiifer<br />
node - copy a node</tt></dd>
</dl>
<dl>
<dt><a name="Node-__ne__" id="Node-__ne__"><strong>__ne__</strong></a>(self, other)</dt>
<dd><tt>Inequality of an RDF <a href="#Node">Node</a> compared to another RDF <a href="#Node">Node</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Node-__str__" id="Node-__str__"><strong>__str__</strong></a>(self)</dt>
<dd><tt>Get a string representation of an RDF <a href="#Node">Node</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Node-__unicode__" id="Node-__unicode__"><strong>__unicode__</strong></a>(self)</dt>
<dd><tt>Get a Unicode string representation of an RDF <a href="#Node">Node</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Node-is_blank" id="Node-is_blank"><strong>is_blank</strong></a>(self)</dt>
<dd><tt>Return true if node is a blank node</tt></dd>
</dl>
<dl>
<dt><a name="Node-is_literal" id="Node-is_literal"><strong>is_literal</strong></a>(self)</dt>
<dd><tt>Return true if node is a literal</tt></dd>
</dl>
<dl>
<dt><a name="Node-is_resource" id="Node-is_resource"><strong>is_resource</strong></a>(self)</dt>
<dd><tt>Return true if node is a resource with a URI</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>blank</strong></dt>
<dd><tt>The blank node identifier</tt></dd>
</dl>
<dl>
<dt><strong>blank_identifier</strong></dt>
<dd><tt>The node identifier of a blank node</tt></dd>
</dl>
<dl>
<dt><strong>literal</strong></dt>
<dd><tt>A tuple of the string, language and datatype values of the node</tt></dd>
</dl>
<dl>
<dt><strong>literal_value</strong></dt>
<dd><tt>A dictionary containing the value of the node literal with keys string, language and datatype</tt></dd>
</dl>
<dl>
<dt><strong>type</strong></dt>
<dd><tt>The node type, an integer</tt></dd>
</dl>
<dl>
<dt><strong>uri</strong></dt>
<dd><tt>The URI of a resource node</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Parser" id="Parser">class <strong>Parser</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland Syntax <a href="#Parser">Parser</a> Class<br />
<br />
import RDF<br />
parser1=RDF.<a href="#Parser">Parser</a>()<br />
parser2=RDF.<a href="#Parser">Parser</a>(name="rdfxml")<br />
parser3=RDF.<a href="#Parser">Parser</a>(mime_type="application/rdf+xml")<br />
<br />
stream=parser2.<a href="#Parser-parse_as_stream">parse_as_stream</a>("file://dir/file.rdf")<br />
parser3.<a href="#Parser-parse_into_model">parse_into_model</a>(model, "file://dir/file.rdf", "http://example.org/")<br />
<br />
The default parser type if not given explicitly is raptor,<br />
for the RDF/XML syntax.<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Parser-__del__" id="Parser-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Parser-__init__" id="Parser-__init__"><strong>__init__</strong></a>(self, name<font color="#909090">=None</font>, mime_type<font color="#909090">=None</font>, uri<font color="#909090">=None</font>)</dt>
<dd><tt>Create an RDF <a href="#Parser">Parser</a> (constructor).<br />
<br />
Create a new RDF <a href="#Parser">Parser</a> for a particular syntax. The parser is<br />
chosen by the fields given to the constructor, all of which are<br />
optional. When any are given, they must all match. The default<br />
parser is chosen if none are given, which is RDF/XML in the<br />
standard configuration of Raptor.<br />
<br />
name - parser syntax name<br />
mime_type - syntax mime type<br />
uri - URI identifying the syntax</tt></dd>
</dl>
<dl>
<dt><a name="Parser-get_feature" id="Parser-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="Parser-namespaces_seen" id="Parser-namespaces_seen"><strong>namespaces_seen</strong></a>(self)</dt>
<dd><tt>Get a dictionary of prefix/URI pairs for namespaces seen during parsing.</tt></dd>
</dl>
<dl>
<dt><a name="Parser-parse_as_stream" id="Parser-parse_as_stream"><strong>parse_as_stream</strong></a>(self, uri, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content at<br />
a URI for the optional base URI or None if the parsing fails.<br />
<br />
(This depends on what URI support raptor provides to redland)<br />
<br />
for statement in parser.<a href="#Parser-parse_as_stream">parse_as_stream</a>(""):<br />
print statement</tt></dd>
</dl>
<dl>
<dt><a name="Parser-parse_into_model" id="Parser-parse_into_model"><strong>parse_into_model</strong></a>(self, model, uri, base_uri<font color="#909090">=None</font>, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content at the URI, for<br />
the optional base URI. Returns a boolean success or failure.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.<br />
<br />
parser.<a href="#Parser-parse_into_model">parse_into_model</a>(model, "file:./foo.rdf",<br />
"http://example.com/foo.rdf")</tt></dd>
</dl>
<dl>
<dt><a name="Parser-parse_string_as_stream" id="Parser-parse_string_as_stream"><strong>parse_string_as_stream</strong></a>(self, string, base_uri)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content in<br />
string with the required base URI or None if the parsing fails.<br />
<br />
for statement in parser.<a href="#Parser-parse_string_as_stream">parse_string_as_stream</a>(rdfstring, base_uri):<br />
print statement</tt></dd>
</dl>
<dl>
<dt><a name="Parser-parse_string_into_model" id="Parser-parse_string_into_model"><strong>parse_string_into_model</strong></a>(self, model, string, base_uri, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content string<br />
with the required base URI. Returns a boolean success or failure.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.</tt></dd>
</dl>
<dl>
<dt><a name="Parser-set_feature" id="Parser-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="Parser-set_uri_filter" id="Parser-set_uri_filter"><strong>set_uri_filter</strong></a>(self, filter)</dt>
<dd><tt>Set a function for rejecting retrieval of URIs seen during parsing.<br />
<br />
Return False or 0 to not reject the URI<br />
<br />
def reject(uri):<br />
if "bad" == uri:<br />
return True<br />
return False<br />
<br />
parser.<a href="#Parser-set_uri_filter">set_uri_filter</a>(reject)</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Query" id="Query">class <strong>Query</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland <a href="#Query">Query</a> interface class<br />
<br />
import RDF<br />
<br />
q1 = RDF.<a href="#Query">Query</a>("SELECT ?a ?c WHERE (?a dc:title ?c) USING dc FOR <<a href="http://purl.org/dc/elements/1.1/">http://purl.org/dc/elements/1.1/</a>>")<br />
q2 = RDF.<a href="#Query">Query</a>("- - -", query_language="triples")<br />
q3 = RDF.<a href="#Query">Query</a>("select $a where ...", query_language="sparql")<br />
<br />
results=q1.<a href="#Query-execute">execute</a>(model)<br />
for result in results:<br />
print result['a']<br />
print result['c']<br />
<br />
for statement in q2.<a href="#Query-execute">execute</a>().as_stream(model):<br />
print statement<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Query-__del__" id="Query-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Query-__init__" id="Query-__init__"><strong>__init__</strong></a>(self, querystring, base_uri<font color="#909090">=None</font>, query_language<font color="#909090">='rdql'</font>, query_uri<font color="#909090">=None</font>)</dt>
</dl>
<dl>
<dt><a name="Query-execute" id="Query-execute"><strong>execute</strong></a>(self, model)</dt>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="RDFXMLSerializer" id="RDFXMLSerializer">class <strong>RDFXMLSerializer</strong></a>(<a href="#Serializer">Serializer</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland RDF/XML <a href="#Serializer">Serializer</a> class<br />
<br />
import RDF<br />
ser=RDF.<a href="#RDFXMLSerializer">RDFXMLSerializer</a>()<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#RDFXMLSerializer">RDFXMLSerializer</a></dd>
<dd><a href="#Serializer">Serializer</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="RDFXMLSerializer-__init__" id="RDFXMLSerializer-__init__"><strong>__init__</strong></a>(self)</dt>
</dl>
<hr />
Methods inherited from <a href="#Serializer">Serializer</a>:<br />
<dl>
<dt><a name="RDFXMLSerializer-__del__" id="RDFXMLSerializer-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="RDFXMLSerializer-get_feature" id="RDFXMLSerializer-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the value of <a href="#Serializer">Serializer</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="RDFXMLSerializer-serialize_model_to_file" id="RDFXMLSerializer-serialize_model_to_file"><strong>serialize_model_to_file</strong></a>(self, name, model, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize to filename name the <a href="#Model">Model</a> model using the<br />
optional base URI.</tt></dd>
</dl>
<dl>
<dt><a name="RDFXMLSerializer-serialize_model_to_string" id="RDFXMLSerializer-serialize_model_to_string"><strong>serialize_model_to_string</strong></a>(self, model, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize to a string using the optional base URI.</tt></dd>
</dl>
<dl>
<dt><a name="RDFXMLSerializer-set_feature" id="RDFXMLSerializer-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the value of <a href="#Serializer">Serializer</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="RDFXMLSerializer-set_namespace" id="RDFXMLSerializer-set_namespace"><strong>set_namespace</strong></a>(self, prefix, uri)</dt>
<dd><tt>Set a namespace prefix and URI for the <a href="#Serializer">Serializer</a> to use.</tt></dd>
</dl>
<hr />
Data descriptors inherited from <a href="#Serializer">Serializer</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="RDQLQuery" id="RDQLQuery">class <strong>RDQLQuery</strong></a>(<a href="#Query">Query</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland RDQL <a href="#Query">Query</a> class<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#RDQLQuery">RDQLQuery</a></dd>
<dd><a href="#Query">Query</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="RDQLQuery-__init__" id="RDQLQuery-__init__"><strong>__init__</strong></a>(self, querystring, base_uri<font color="#909090">=None</font>)</dt>
</dl>
<hr />
Methods inherited from <a href="#Query">Query</a>:<br />
<dl>
<dt><a name="RDQLQuery-__del__" id="RDQLQuery-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="RDQLQuery-execute" id="RDQLQuery-execute"><strong>execute</strong></a>(self, model)</dt>
</dl>
<hr />
Data descriptors inherited from <a href="#Query">Query</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="SPARQLQuery" id="SPARQLQuery">class <strong>SPARQLQuery</strong></a>(<a href="#Query">Query</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland SPARQL <a href="#Query">Query</a> class<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#SPARQLQuery">SPARQLQuery</a></dd>
<dd><a href="#Query">Query</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="SPARQLQuery-__init__" id="SPARQLQuery-__init__"><strong>__init__</strong></a>(self, querystring, base_uri<font color="#909090">=None</font>)</dt>
</dl>
<hr />
Methods inherited from <a href="#Query">Query</a>:<br />
<dl>
<dt><a name="SPARQLQuery-__del__" id="SPARQLQuery-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="SPARQLQuery-execute" id="SPARQLQuery-execute"><strong>execute</strong></a>(self, model)</dt>
</dl>
<hr />
Data descriptors inherited from <a href="#Query">Query</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Serializer" id="Serializer">class <strong>Serializer</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland Syntax <a href="#Serializer">Serializer</a> Class<br />
<br />
import RDF<br />
ser1=RDF.<a href="#Serializer">Serializer</a>()<br />
<br />
ser2=RDF.<a href="#Serializer">Serializer</a>(mime_type="application/rdf+xml")<br />
<br />
ser3=RDF.<a href="#Serializer">Serializer</a>(name="ntriples")<br />
<br />
A class for turning a <a href="#Model">Model</a> into a syntax serialization (at present<br />
only to local files).<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Serializer-__del__" id="Serializer-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Serializer-__init__" id="Serializer-__init__"><strong>__init__</strong></a>(self, name<font color="#909090">=None</font>, mime_type<font color="#909090">=None</font>, uri<font color="#909090">=None</font>)</dt>
<dd><tt>Create an RDF <a href="#Serializer">Serializer</a> (constructor).<br />
<br />
The arguments name, mime_type and uri are all optional and<br />
when omitted the default serialization syntax is used. If<br />
any arguments are given, they must all match for an appropriate<br />
syntax to be chosen. For example, RDF/XML has a MIME type of<br />
'application/rdf+xml' so this can be given with the mime_type<br />
argument, however the N-Triples has none, so the 'ntriples' name<br />
must be used. Most syntaxes have URIs.</tt></dd>
</dl>
<dl>
<dt><a name="Serializer-get_feature" id="Serializer-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the value of <a href="#Serializer">Serializer</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="Serializer-serialize_model_to_file" id="Serializer-serialize_model_to_file"><strong>serialize_model_to_file</strong></a>(self, name, model, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize to filename name the <a href="#Model">Model</a> model using the<br />
optional base URI.</tt></dd>
</dl>
<dl>
<dt><a name="Serializer-serialize_model_to_string" id="Serializer-serialize_model_to_string"><strong>serialize_model_to_string</strong></a>(self, model, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Serialize to a string using the optional base URI.</tt></dd>
</dl>
<dl>
<dt><a name="Serializer-set_feature" id="Serializer-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the value of <a href="#Serializer">Serializer</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="Serializer-set_namespace" id="Serializer-set_namespace"><strong>set_namespace</strong></a>(self, prefix, uri)</dt>
<dd><tt>Set a namespace prefix and URI for the <a href="#Serializer">Serializer</a> to use.</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Statement" id="Statement">class <strong>Statement</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland <a href="#Statement">Statement</a> (triple) class. The main means of manipulating<br />
statements is by the subject, predicate and object properties.<br />
<br />
import RDF<br />
statement1 = RDF.<a href="#Statement">Statement</a>(node1, node2, node3)<br />
statement2 = RDF.<a href="#Statement">Statement</a>(statement = statement1)<br />
<br />
if statement2.subject.is_resource():<br />
print "statement2 subject is URI ",statement2.subject.uri<br />
<br />
statement.object = <a href="#Node">Node</a>("hello, world")<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Statement-__del__" id="Statement-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Statement-__eq__" id="Statement-__eq__"><strong>__eq__</strong></a>(self, other)</dt>
<dd><tt>Equality of an RDF <a href="#Statement">Statement</a> compared to another RDF <a href="#Statement">Statement</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Statement-__init__" id="Statement-__init__"><strong>__init__</strong></a>(self, subject<font color="#909090">=None</font>, predicate<font color="#909090">=None</font>, object<font color="#909090">=None</font>, **args)</dt>
<dd><tt>Constructor for <a href="#Statement">Statement</a>.<br />
<br />
Create a <a href="#Statement">Statement</a> from three <a href="#Node">Node</a> objects.<br />
<br />
s1 = RDF.<a href="#Statement">Statement</a>(subjnode, prednode, objnode)<br />
<br />
A <a href="#Node">Node</a> argument can be replaced with <a href="#Uri">Uri</a> or string to<br />
shortcut <a href="#Node">Node</a> creation.<br />
<br />
s2 = RDF.<a href="#Statement">Statement</a>(<a href="#Uri">Uri</a>(""), <a href="#Uri">Uri</a>(""), "baz")<br />
<br />
Copy an existing <a href="#Statement">Statement</a> s1.<br />
<br />
s3 = RDF.<a href="#Statement">Statement</a>(statement=s1)</tt></dd>
</dl>
<dl>
<dt><a name="Statement-__ne__" id="Statement-__ne__"><strong>__ne__</strong></a>(self, other)</dt>
<dd><tt>Inequality of an RDF <a href="#Statement">Statement</a> compared to another RDF <a href="#Statement">Statement</a>.</tt></dd>
</dl>
<dl>
<dt><a name="Statement-__str__" id="Statement-__str__"><strong>__str__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Statement-__unicode__" id="Statement-__unicode__"><strong>__unicode__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Statement-matches" id="Statement-matches"><strong>matches</strong></a>(self, other)</dt>
<dd><tt>Comparison of this potentially incomplete RDF <a href="#Statement">Statement</a> compared to another RDF <a href="#Statement">Statement</a>.</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>object</strong></dt>
<dd><tt>The object node of the statement.</tt></dd>
</dl>
<dl>
<dt><strong>predicate</strong></dt>
<dd><tt>The predicate node of the statement.</tt></dd>
</dl>
<dl>
<dt><strong>subject</strong></dt>
<dd><tt>The subject node of the statement.</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Storage" id="Storage">class <strong>Storage</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland <a href="#Statement">Statement</a> <a href="#Storage">Storage</a> class<br />
<br />
import RDF<br />
storage=RDF.<a href="#Storage">Storage</a>(storage_name="memory")<br />
<br />
The Redland abstraction for storing RDF graphs as Statements.<br />
<br />
There are no user methods (can only be constructed).<br />
<br />
You should normally use a specialized class such as <a href="#MemoryStorage">MemoryStorage</a> or<br />
<a href="#HashStorage">HashStorage</a> in preference to this class.<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Storage-__del__" id="Storage-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Storage-__init__" id="Storage-__init__"><strong>__init__</strong></a>(self, **args)</dt>
<dd><tt>Create an RDF <a href="#Storage">Storage</a> (constructor).<br />
<br />
Create a new RDF <a href="#Storage">Storage</a> using any of these forms<br />
<br />
s1=RDF.<a href="#Storage">Storage</a>(storage_name="name",options_string="")<br />
<br />
Create a <a href="#Storage">Storage</a> of the given type. Currently the built in storage<br />
names that are always present are 'memory', 'hashes', 'file' and<br />
'uri'. 'bdb' is available when Sleepycat / BerkeleyDB is compiled<br />
in, 'mysql' when MySQL is compiled in, and 'sqlite' when SQLite is<br />
compiled in. If storage_name is omitted, it defaults to 'memory'.<br />
<br />
The argument 'name' can be used when the storage needs a name<br />
to operate, such as used for a filename or URI:<br />
<br />
s1=RDF.<a href="#Storage">Storage</a>(storage_name="file", name='/filename',options_string="")<br />
<br />
s2=RDF.<a href="#Storage">Storage</a>(storage_name="uri", name='<a href="http://rdf.example.org/',options_string">http://rdf.example.org/',options_string</a>="")<br />
<br />
<br />
The required argument options_string allows additional store-specific<br />
options to be given, some of which are required by certain stores.<br />
This uses the following form:<br />
<br />
s3=RDF.<a href="#Storage">Storage</a>(storage_name="name", name='abc',<br />
options_string="key1='value1', key2='value2', ...")<br />
<br />
for multiple key/value option pairs, option values are always<br />
surrounded by single quotes.<br />
<br />
The common options are:<br />
new - optional and takes a boolean value (default false)<br />
If true, it deletes any existing store and creates a new one<br />
otherwise if false (default) open an existing store.<br />
<br />
write - optional and takes a boolean value (default true)<br />
If true (default) the <a href="#Storage">Storage</a> is opened read-write otherwise<br />
if false the storage is opened read-only and for file-based<br />
Storages or those with locks, may be opened with shared-readers.<br />
<br />
Some storage types have additional options:<br />
<br />
storage_name 'hashes' has options:<br />
hash-type - the name of any hash type supported.<br />
'memory' (default), 'file' hash types are always present. 'bdb' is<br />
available when BerkeleyDB is compiled in,<br />
dir - the directory name to create the files in (default '.')<br />
mode - the file creation mode (default 0644 octal)<br />
<br />
storage_name 'mysql' has options:<br />
host - required MySQL database hostname<br />
port - optional MySQL database port (defaults to 3306)<br />
database - required MySQL database name<br />
user - required MySQL database user<br />
password - required MySQL database password<br />
<br />
stoage name 'sqlite' has options:<br />
synchronous - optional value off, normal or full<br />
<br />
The other form is:<br />
s4=RDF.<a href="#Storage">Storage</a>(storage=s1)<br />
Copy an existing <a href="#Storage">Storage</a> s1.<br />
<br />
<br />
Note: there are convience classes to create a memory storage<br />
s5=RDF.<a href="#MemoryStorage">MemoryStorage</a>()<br />
<br />
and Hash storage:<br />
# memory hash<br />
s6=RDF.<a href="#HashStorage">HashStorage</a>('abc')<br />
<br />
# specified bdb hash stored in files named 'def'*<br />
s7=RDF.<a href="#HashStorage">HashStorage</a>('def', options="hash-type='bdb'")</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Stream" id="Stream">class <strong>Stream</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland <a href="#Statement">Statement</a> <a href="#Stream">Stream</a> class<br />
<br />
A class encapsulating a sequence of Statements, such as<br />
those returned from a <a href="#Model">Model</a> query. Can be used as a Python<br />
sequence.<br />
<br />
stream = model.find_statements(query_statement)<br />
for statement in stream:<br />
# do whatever with 'statement'<br />
# note it is shared and will go out of scope, so you must<br />
# copy it if you want it to stay around<br />
<br />
You should not normally find yourself needing to use this<br />
class explicitly.<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Stream-__del__" id="Stream-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Stream-__init__" id="Stream-__init__"><strong>__init__</strong></a>(self, object, creator)</dt>
<dd><tt>Create an RDF <a href="#Stream">Stream</a> (constructor).</tt></dd>
</dl>
<dl>
<dt><a name="Stream-__iter__" id="Stream-__iter__"><strong>__iter__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Stream-context" id="Stream-context"><strong>context</strong></a>(self)</dt>
<dd><tt>Return the context <a href="#Node">Node</a> of the current object on the <a href="#Stream">Stream</a></tt></dd>
</dl>
<dl>
<dt><a name="Stream-context_iter" id="Stream-context_iter"><strong>context_iter</strong></a>(self)</dt>
<dd><tt>Return an iterator over this stream that<br />
returns (stream, context) tuples each time it is iterated.<br />
DEPRECATED. Instead use the context-aware method appropriate,<br />
e.g. <a href="#Model">Model</a>.find_statements_context() or <a href="#Model">Model</a>.as_stream_context()</tt></dd>
</dl>
<dl>
<dt><a name="Stream-current" id="Stream-current"><strong>current</strong></a>(self)</dt>
<dd><tt>Return the current <a href="#Statement">Statement</a> on the <a href="#Stream">Stream</a></tt></dd>
</dl>
<dl>
<dt><a name="Stream-end" id="Stream-end"><strong>end</strong></a>(self)</dt>
<dd><tt>Return true if the stream is exhausted</tt></dd>
</dl>
<dl>
<dt><a name="Stream-next" id="Stream-next"><strong>next</strong></a>(self)</dt>
<dd><tt>Move to the next <a href="#Statement">Statement</a> on the <a href="#Stream">Stream</a></tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="TurtleParser" id="TurtleParser">class <strong>TurtleParser</strong></a>(<a href="#Parser">Parser</a>)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland Turtle <a href="#Parser">Parser</a> class<br />
<br />
import RDF<br />
parser=RDF.<a href="#TurtleParser">TurtleParser</a>()<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">
<dl>
<dt>Method resolution order:</dt>
<dd><a href="#TurtleParser">TurtleParser</a></dd>
<dd><a href="#Parser">Parser</a></dd>
<dd>__builtin__.object</dd>
</dl>
<hr />
Methods defined here:<br />
<dl>
<dt><a name="TurtleParser-__init__" id="TurtleParser-__init__"><strong>__init__</strong></a>(self)</dt>
</dl>
<hr />
Methods inherited from <a href="#Parser">Parser</a>:<br />
<dl>
<dt><a name="TurtleParser-__del__" id="TurtleParser-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="TurtleParser-get_feature" id="TurtleParser-get_feature"><strong>get_feature</strong></a>(self, uri)</dt>
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-namespaces_seen" id="TurtleParser-namespaces_seen"><strong>namespaces_seen</strong></a>(self)</dt>
<dd><tt>Get a dictionary of prefix/URI pairs for namespaces seen during parsing.</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-parse_as_stream" id="TurtleParser-parse_as_stream"><strong>parse_as_stream</strong></a>(self, uri, base_uri<font color="#909090">=None</font>)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content at<br />
a URI for the optional base URI or None if the parsing fails.<br />
<br />
(This depends on what URI support raptor provides to redland)<br />
<br />
for statement in parser.<a href="#TurtleParser-parse_as_stream">parse_as_stream</a>(""):<br />
print statement</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-parse_into_model" id="TurtleParser-parse_into_model"><strong>parse_into_model</strong></a>(self, model, uri, base_uri<font color="#909090">=None</font>, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content at the URI, for<br />
the optional base URI. Returns a boolean success or failure.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.<br />
<br />
parser.<a href="#TurtleParser-parse_into_model">parse_into_model</a>(model, "file:./foo.rdf",<br />
"http://example.com/foo.rdf")</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-parse_string_as_stream" id="TurtleParser-parse_string_as_stream"><strong>parse_string_as_stream</strong></a>(self, string, base_uri)</dt>
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content in<br />
string with the required base URI or None if the parsing fails.<br />
<br />
for statement in parser.<a href="#TurtleParser-parse_string_as_stream">parse_string_as_stream</a>(rdfstring, base_uri):<br />
print statement</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-parse_string_into_model" id="TurtleParser-parse_string_into_model"><strong>parse_string_into_model</strong></a>(self, model, string, base_uri, handler<font color="#909090">=None</font>)</dt>
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content string<br />
with the required base URI. Returns a boolean success or failure.<br />
<br />
If handler is given, an error handler with the signature<br />
def handler(code, level, facility, message, line, column, byte, file, uri)<br />
is called.</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-set_feature" id="TurtleParser-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt>
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri.</tt></dd>
</dl>
<dl>
<dt><a name="TurtleParser-set_uri_filter" id="TurtleParser-set_uri_filter"><strong>set_uri_filter</strong></a>(self, filter)</dt>
<dd><tt>Set a function for rejecting retrieval of URIs seen during parsing.<br />
<br />
Return False or 0 to not reject the URI<br />
<br />
def reject(uri):<br />
if "bad" == uri:<br />
return True<br />
return False<br />
<br />
parser.<a href="#TurtleParser-set_uri_filter">set_uri_filter</a>(reject)</tt></dd>
</dl>
<hr />
Data descriptors inherited from <a href="#Parser">Parser</a>:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#FFC8D8">
<td colspan="3" valign="bottom"> <br />
<font color="#000000" face="helvetica, arial"><a name="Uri" id="Uri">class <strong>Uri</strong></a>(__builtin__.object)</font></td>
</tr>
<tr bgcolor="#FFC8D8">
<td rowspan="2"><tt> </tt></td>
<td colspan="2"><tt>Redland URI Class<br />
<br />
import RDF<br />
uri1 = RDF.<a href="#Uri">Uri</a>("http://example.com/")<br />
uri2 = RDF.<a href="#Uri">Uri</a>(uri1)<br />
</tt></td>
</tr>
<tr>
<td> </td>
<td width="100%">Methods defined here:<br />
<dl>
<dt><a name="Uri-__del__" id="Uri-__del__"><strong>__del__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Uri-__eq__" id="Uri-__eq__"><strong>__eq__</strong></a>(self, other)</dt>
<dd><tt>Equality of RDF URI to another RDF URI.</tt></dd>
</dl>
<dl>
<dt><a name="Uri-__hash__" id="Uri-__hash__"><strong>__hash__</strong></a>(self)</dt>
</dl>
<dl>
<dt><a name="Uri-__init__" id="Uri-__init__"><strong>__init__</strong></a>(self, arg<font color="#909090">=None</font>, **args)</dt>
<dd><tt>Create an RDF URI (constructor).<br />
<br />
Creates a new RDF URI from either of the following forms:<br />
<br />
uri1 = RDF.<a href="#Uri">Uri</a>("http://example.com/")<br />
<br />
Create a URI from the given string.<br />
<br />
uri2 = RDF.<a href="#Uri">Uri</a>(uri1)<br />
<br />
Copy an existing URI uri1.</tt></dd>
</dl>
<dl>
<dt><a name="Uri-__ne__" id="Uri-__ne__"><strong>__ne__</strong></a>(self, other)</dt>
<dd><tt>Inequality of RDF URI to another RDF URI.</tt></dd>
</dl>
<dl>
<dt><a name="Uri-__str__" id="Uri-__str__"><strong>__str__</strong></a>(self)</dt>
<dd><tt>Get a string representation of an RDF URI.</tt></dd>
</dl>
<dl>
<dt><a name="Uri-__unicode__" id="Uri-__unicode__"><strong>__unicode__</strong></a>(self)</dt>
<dd><tt>Get a Unicode string representation of an RDF URI.</tt></dd>
</dl>
<hr />
Data descriptors defined here:<br />
<dl>
<dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl>
<dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#EEAA77">
<td colspan="3" valign="bottom"> <br />
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Functions</strong></big></font></td>
</tr>
<tr>
<td bgcolor="#EEAA77"><tt> </tt></td>
<td> </td>
<td width="100%">
<dl>
<dt><a id="debug" name="debug"><strong>debug</strong></a>(value<font color="#909090">=None</font>)</dt>
<dd><tt>Get/set Redland debugging output status.<br />
<br />
RDF.debug (1) # enable debugging<br />
if RDF.debug(): # test for debug mode</tt></dd>
</dl>
</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#55AA55">
<td colspan="3" valign="bottom"> <br />
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Data</strong></big></font></td>
</tr>
<tr>
<td bgcolor="#55AA55"><tt> </tt></td>
<td> </td>
<td width="100%"><strong>__all__</strong> = ['Node', 'Statement', 'Model', 'Iterator', 'Serializer', 'NTriplesSerializer', 'RDFXMLSerializer', 'Stream', 'Storage', 'MemoryStorage', 'HashStorage', 'Uri', 'Parser', 'TurtleParser', 'NTriplesParser', 'NS', 'Query', 'RDQLQuery', 'SPARQLQuery', 'debug']<br />
<strong>__author__</strong> = 'Dave Beckett - http://www.dajobe.org/, Edd Dumbi...sefulinc.com> and Matt Biddulph <mb@picdiary.com>'<br />
<strong>__date__</strong> = '$Date$'<br />
<strong>__version__</strong> = '1.1'</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section">
<tr bgcolor="#7799EE">
<td colspan="3" valign="bottom"> <br />
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Author</strong></big></font></td>
</tr>
<tr>
<td bgcolor="#7799EE"><tt> </tt></td>
<td> </td>
<td width="100%">Dave Beckett - <a href="http://www.dajobe.org/">http://www.dajobe.org/</a>, Edd Dumbill <edd@usefulinc.com> and Matt Biddulph <mb@picdiary.com></td>
</tr>
</table>
<hr />
<p>(C) Copyright 2000-2011 <a href="http://www.dajobe.org/">Dave Beckett</a>, Copyright 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p>
</body>
</html>