| 1 |
<?xml version="1.0" encoding="iso-8859-1"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 4 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 5 |
<head> |
| 6 |
<title>Redland RDF Application Framework - Python API Reference</title> |
| 7 |
</head> |
| 8 |
<body> |
| 9 |
|
| 10 |
<h1 style="text-align:center">Redland RDF Application Framework - Python API Reference</h1> |
| 11 |
|
| 12 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="heading"> |
| 13 |
<tr bgcolor="#7799EE"> |
| 14 |
<td valign="bottom"> <br /> |
| 15 |
<font color="#FFFFFF" face="helvetica, arial"> <br /> |
| 16 |
<big><big><strong>RDF</strong></big></big> (version 1.1, $Date$)</font></td> |
| 17 |
<td align="right" valign="bottom"><font color="#FFFFFF" face="helvetica, arial"><a href=".">index</a><br /> |
| 18 |
</font></td> |
| 19 |
</tr> |
| 20 |
</table> |
| 21 |
|
| 22 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 23 |
<tr bgcolor="#AA55CC"> |
| 24 |
<td colspan="3" valign="bottom"> <br /> |
| 25 |
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Modules</strong></big></font></td> |
| 26 |
</tr> |
| 27 |
<tr> |
| 28 |
<td bgcolor="#AA55CC"><tt> </tt></td> |
| 29 |
<td> </td> |
| 30 |
<td width="100%"> |
| 31 |
<table width="100%" summary="list"> |
| 32 |
<tr> |
| 33 |
<td width="25%" valign="top">Redland<br /></td> |
| 34 |
<td width="25%" valign="top">string<br /></td> |
| 35 |
<td width="25%" valign="top">sys<br /></td> |
| 36 |
<td width="25%" valign="top"></td> |
| 37 |
</tr> |
| 38 |
</table> |
| 39 |
</td> |
| 40 |
</tr> |
| 41 |
</table> |
| 42 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 43 |
<tr bgcolor="#EE77AA"> |
| 44 |
<td colspan="3" valign="bottom"> <br /> |
| 45 |
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Classes</strong></big></font></td> |
| 46 |
</tr> |
| 47 |
<tr> |
| 48 |
<td bgcolor="#EE77AA"><tt> </tt></td> |
| 49 |
<td> </td> |
| 50 |
<td width="100%"> |
| 51 |
<dl> |
| 52 |
<dt><font face="helvetica, arial">__builtin__.object</font></dt> |
| 53 |
<dd> |
| 54 |
<dl> |
| 55 |
<dt><font face="helvetica, arial"><a href="#Iterator">Iterator</a></font></dt> |
| 56 |
<dt><font face="helvetica, arial"><a href="#Model">Model</a></font></dt> |
| 57 |
<dt><font face="helvetica, arial"><a href="#NS">NS</a></font></dt> |
| 58 |
<dt><font face="helvetica, arial"><a href="#Node">Node</a></font></dt> |
| 59 |
<dt><font face="helvetica, arial"><a href="#Parser">Parser</a></font></dt> |
| 60 |
<dd> |
| 61 |
<dl> |
| 62 |
<dt><font face="helvetica, arial"><a href="#NTriplesParser">NTriplesParser</a></font></dt> |
| 63 |
<dt><font face="helvetica, arial"><a href="#TurtleParser">TurtleParser</a></font></dt> |
| 64 |
</dl> |
| 65 |
</dd> |
| 66 |
<dt><font face="helvetica, arial"><a href="#Query">Query</a></font></dt> |
| 67 |
<dd> |
| 68 |
<dl> |
| 69 |
<dt><font face="helvetica, arial"><a href="#RDQLQuery">RDQLQuery</a></font></dt> |
| 70 |
<dt><font face="helvetica, arial"><a href="#SPARQLQuery">SPARQLQuery</a></font></dt> |
| 71 |
</dl> |
| 72 |
</dd> |
| 73 |
<dt><font face="helvetica, arial"><a href="#Serializer">Serializer</a></font></dt> |
| 74 |
<dd> |
| 75 |
<dl> |
| 76 |
<dt><font face="helvetica, arial"><a href="#NTriplesSerializer">NTriplesSerializer</a></font></dt> |
| 77 |
<dt><font face="helvetica, arial"><a href="#RDFXMLSerializer">RDFXMLSerializer</a></font></dt> |
| 78 |
</dl> |
| 79 |
</dd> |
| 80 |
<dt><font face="helvetica, arial"><a href="#Statement">Statement</a></font></dt> |
| 81 |
<dt><font face="helvetica, arial"><a href="#Storage">Storage</a></font></dt> |
| 82 |
<dd> |
| 83 |
<dl> |
| 84 |
<dt><font face="helvetica, arial"><a href="#HashStorage">HashStorage</a></font></dt> |
| 85 |
<dt><font face="helvetica, arial"><a href="#MemoryStorage">MemoryStorage</a></font></dt> |
| 86 |
</dl> |
| 87 |
</dd> |
| 88 |
<dt><font face="helvetica, arial"><a href="#Stream">Stream</a></font></dt> |
| 89 |
<dt><font face="helvetica, arial"><a href="#Uri">Uri</a></font></dt> |
| 90 |
</dl> |
| 91 |
</dd> |
| 92 |
</dl> |
| 93 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 94 |
<tr bgcolor="#FFC8D8"> |
| 95 |
<td colspan="3" valign="bottom"> <br /> |
| 96 |
<font color="#000000" face="helvetica, arial"><a name="HashStorage" id="HashStorage">class <strong>HashStorage</strong></a>(<a href="#Storage">Storage</a>)</font></td> |
| 97 |
</tr> |
| 98 |
<tr bgcolor="#FFC8D8"> |
| 99 |
<td rowspan="2"><tt> </tt></td> |
| 100 |
<td colspan="2"><tt>Redland Hashed <a href="#Storage">Storage</a> class<br /> |
| 101 |
<br /> |
| 102 |
import RDF<br /> |
| 103 |
h1=RDF.<a href="#HashStorage">HashStorage</a>("abc", options="hash-type='memory'")<br /> |
| 104 |
<br /> |
| 105 |
# Creating a storage with contexts enabled<br /> |
| 106 |
s=RDF.<a href="#HashStorage">HashStorage</a>("def", options="contexts='yes'")<br /> |
| 107 |
<br /> |
| 108 |
Class of hashed <a href="#Storage">Storage</a> for a particular type of hash (typically<br /> |
| 109 |
hash-type is "memory" or "bdb") and any other options.<br /> |
| 110 |
</tt></td> |
| 111 |
</tr> |
| 112 |
<tr> |
| 113 |
<td> </td> |
| 114 |
<td width="100%"> |
| 115 |
<dl> |
| 116 |
<dt>Method resolution order:</dt> |
| 117 |
<dd><a href="#HashStorage">HashStorage</a></dd> |
| 118 |
<dd><a href="#Storage">Storage</a></dd> |
| 119 |
<dd>__builtin__.object</dd> |
| 120 |
</dl> |
| 121 |
<hr /> |
| 122 |
Methods defined here:<br /> |
| 123 |
<dl> |
| 124 |
<dt><a name="HashStorage-__init__" id="HashStorage-__init__"><strong>__init__</strong></a>(self, hash_name, options<font color="#909090">=''</font>)</dt> |
| 125 |
</dl> |
| 126 |
<hr /> |
| 127 |
Methods inherited from <a href="#Storage">Storage</a>:<br /> |
| 128 |
<dl> |
| 129 |
<dt><a name="HashStorage-__del__" id="HashStorage-__del__"><strong>__del__</strong></a>(self)</dt> |
| 130 |
</dl> |
| 131 |
<hr /> |
| 132 |
Data descriptors inherited from <a href="#Storage">Storage</a>:<br /> |
| 133 |
<dl> |
| 134 |
<dt><strong>__dict__</strong></dt> |
| 135 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 136 |
</dl> |
| 137 |
<dl> |
| 138 |
<dt><strong>__weakref__</strong></dt> |
| 139 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 140 |
</dl> |
| 141 |
</td> |
| 142 |
</tr> |
| 143 |
</table> |
| 144 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 145 |
<tr bgcolor="#FFC8D8"> |
| 146 |
<td colspan="3" valign="bottom"> <br /> |
| 147 |
<font color="#000000" face="helvetica, arial"><a name="Iterator" id="Iterator">class <strong>Iterator</strong></a>(__builtin__.object)</font></td> |
| 148 |
</tr> |
| 149 |
<tr bgcolor="#FFC8D8"> |
| 150 |
<td rowspan="2"><tt> </tt></td> |
| 151 |
<td colspan="2"><tt>Redland <a href="#Node">Node</a> <a href="#Iterator">Iterator</a> class<br /> |
| 152 |
<br /> |
| 153 |
A class for iterating over a sequence of <a href="#Node">Node</a> s such as<br /> |
| 154 |
those returned from a <a href="#Model">Model</a> query. Some methods return<br /> |
| 155 |
<a href="#Iterator">Iterator</a> s or Python sequences. If this is used, it works<br /> |
| 156 |
as follows:<br /> |
| 157 |
<br /> |
| 158 |
iterator=model.get_targets_iterator(source, arc)<br /> |
| 159 |
while not iterator.<a href="#Iterator-end">end</a>():<br /> |
| 160 |
# get the current <a href="#Node">Node</a><br /> |
| 161 |
node=iterator.<a href="#Iterator-current">current</a>()<br /> |
| 162 |
# do something with it<br /> |
| 163 |
# (it is shared; you must copy it you want to keep it)<br /> |
| 164 |
...<br /> |
| 165 |
iterator.<a href="#Iterator-next">next</a>()<br /> |
| 166 |
iterator=None<br /> |
| 167 |
</tt></td> |
| 168 |
</tr> |
| 169 |
<tr> |
| 170 |
<td> </td> |
| 171 |
<td width="100%">Methods defined here:<br /> |
| 172 |
<dl> |
| 173 |
<dt><a name="Iterator-__del__" id="Iterator-__del__"><strong>__del__</strong></a>(self)</dt> |
| 174 |
</dl> |
| 175 |
<dl> |
| 176 |
<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> |
| 177 |
<dd><tt>Create an RDF <a href="#Iterator">Iterator</a> (constructor).</tt></dd> |
| 178 |
</dl> |
| 179 |
<dl> |
| 180 |
<dt><a name="Iterator-__iter__" id="Iterator-__iter__"><strong>__iter__</strong></a>(self)</dt> |
| 181 |
</dl> |
| 182 |
<dl> |
| 183 |
<dt><a name="Iterator-__next__" id="Iterator-__next__"><strong>__next__</strong></a>(self)</dt> |
| 184 |
<dd><tt>Move to the next object on the <a href="#Iterator">Iterator</a></tt></dd> |
| 185 |
</dl> |
| 186 |
<dl> |
| 187 |
<dt><a name="Iterator-context" id="Iterator-context"><strong>context</strong></a>(self)</dt> |
| 188 |
<dd><tt>Return the context <a href="#Node">Node</a> of the current object on the <a href="#Iterator">Iterator</a></tt></dd> |
| 189 |
</dl> |
| 190 |
<dl> |
| 191 |
<dt><a name="Iterator-current" id="Iterator-current"><strong>current</strong></a>(self)</dt> |
| 192 |
<dd><tt>Return the current object on the <a href="#Iterator">Iterator</a></tt></dd> |
| 193 |
</dl> |
| 194 |
<dl> |
| 195 |
<dt><a name="Iterator-end" id="Iterator-end"><strong>end</strong></a>(self)</dt> |
| 196 |
<dd><tt>Return true if the iterator is exhausted</tt></dd> |
| 197 |
</dl> |
| 198 |
<dl> |
| 199 |
<dt><a name="Iterator-have_elements" id="Iterator-have_elements"><strong>have_elements</strong></a>(self)</dt> |
| 200 |
</dl> |
| 201 |
<dl> |
| 202 |
<dt><a name="Iterator-next" id="Iterator-next"><strong>next</strong></a> = <a href="#Iterator-__next__">__next__</a>(self)</dt> |
| 203 |
</dl> |
| 204 |
<hr /> |
| 205 |
Data descriptors defined here:<br /> |
| 206 |
<dl> |
| 207 |
<dt><strong>__dict__</strong></dt> |
| 208 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 209 |
</dl> |
| 210 |
<dl> |
| 211 |
<dt><strong>__weakref__</strong></dt> |
| 212 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 213 |
</dl> |
| 214 |
</td> |
| 215 |
</tr> |
| 216 |
</table> |
| 217 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 218 |
<tr bgcolor="#FFC8D8"> |
| 219 |
<td colspan="3" valign="bottom"> <br /> |
| 220 |
<font color="#000000" face="helvetica, arial"><a name="MemoryStorage" id="MemoryStorage">class <strong>MemoryStorage</strong></a>(<a href="#Storage">Storage</a>)</font></td> |
| 221 |
</tr> |
| 222 |
<tr bgcolor="#FFC8D8"> |
| 223 |
<td rowspan="2"><tt> </tt></td> |
| 224 |
<td colspan="2"><tt>Redland memory <a href="#Storage">Storage</a> class<br /> |
| 225 |
<br /> |
| 226 |
import RDF<br /> |
| 227 |
h1=RDF.<a href="#MemoryStorage">MemoryStorage</a>()<br /> |
| 228 |
h1=RDF.<a href="#MemoryStorage">MemoryStorage</a>("abc")<br /> |
| 229 |
h2=RDF.<a href="#MemoryStorage">MemoryStorage</a>("abc", "write='no'")<br /> |
| 230 |
<br /> |
| 231 |
# Creating a storage with contexts enabled<br /> |
| 232 |
s = RDF.<a href="#MemoryStorage">MemoryStorage</a>(options_string="contexts='yes'")<br /> |
| 233 |
<br /> |
| 234 |
Class of memory <a href="#Storage">Storage</a> with optional name, additional options.<br /> |
| 235 |
</tt></td> |
| 236 |
</tr> |
| 237 |
<tr> |
| 238 |
<td> </td> |
| 239 |
<td width="100%"> |
| 240 |
<dl> |
| 241 |
<dt>Method resolution order:</dt> |
| 242 |
<dd><a href="#MemoryStorage">MemoryStorage</a></dd> |
| 243 |
<dd><a href="#Storage">Storage</a></dd> |
| 244 |
<dd>__builtin__.object</dd> |
| 245 |
</dl> |
| 246 |
<hr /> |
| 247 |
Methods defined here:<br /> |
| 248 |
<dl> |
| 249 |
<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> |
| 250 |
</dl> |
| 251 |
<hr /> |
| 252 |
Methods inherited from <a href="#Storage">Storage</a>:<br /> |
| 253 |
<dl> |
| 254 |
<dt><a name="MemoryStorage-__del__" id="MemoryStorage-__del__"><strong>__del__</strong></a>(self)</dt> |
| 255 |
</dl> |
| 256 |
<hr /> |
| 257 |
Data descriptors inherited from <a href="#Storage">Storage</a>:<br /> |
| 258 |
<dl> |
| 259 |
<dt><strong>__dict__</strong></dt> |
| 260 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 261 |
</dl> |
| 262 |
<dl> |
| 263 |
<dt><strong>__weakref__</strong></dt> |
| 264 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 265 |
</dl> |
| 266 |
</td> |
| 267 |
</tr> |
| 268 |
</table> |
| 269 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 270 |
<tr bgcolor="#FFC8D8"> |
| 271 |
<td colspan="3" valign="bottom"> <br /> |
| 272 |
<font color="#000000" face="helvetica, arial"><a name="Model" id="Model">class <strong>Model</strong></a>(__builtin__.object)</font></td> |
| 273 |
</tr> |
| 274 |
<tr bgcolor="#FFC8D8"> |
| 275 |
<td rowspan="2"><tt> </tt></td> |
| 276 |
<td colspan="2"><tt>Redland Graph class<br /> |
| 277 |
<br /> |
| 278 |
import RDF<br /> |
| 279 |
model = RDF.<a href="#Model">Model</a>(storage)<br /> |
| 280 |
<br /> |
| 281 |
The main interface to the Redland RDF graph (formed from triples, or<br /> |
| 282 |
RDF statements). There are many methods for adding, removing, querying<br /> |
| 283 |
statements and serializing them to/from syntaxes using the <a href="#Serializer">Serializer</a><br /> |
| 284 |
or <a href="#Parser">Parser</a> classes.<br /> |
| 285 |
<br /> |
| 286 |
Models can also be used as Python sequences to give every triple in the<br /> |
| 287 |
model:<br /> |
| 288 |
<br /> |
| 289 |
for statement in model:<br /> |
| 290 |
print statement<br /> |
| 291 |
<br /> |
| 292 |
Models have other aspects of sequence types. The following also works:<br /> |
| 293 |
<br /> |
| 294 |
if statement in model: # do whatever<br /> |
| 295 |
if (statement, context) in model: # do whatever<br /> |
| 296 |
<br /> |
| 297 |
del model[statement] # remove statement from model<br /> |
| 298 |
del model[statement, context] # ditto for context-aware model<br /> |
| 299 |
<br /> |
| 300 |
model.<a href="#Model-append">append</a>(statement) # append a statement<br /> |
| 301 |
model.<a href="#Model-append">append</a>(statement, context) # append statement with context<br /> |
| 302 |
<br /> |
| 303 |
num_items = len(model) # get number of statements in the model<br /> |
| 304 |
# works only with countable storages<br /> |
| 305 |
</tt></td> |
| 306 |
</tr> |
| 307 |
<tr> |
| 308 |
<td> </td> |
| 309 |
<td width="100%">Methods defined here:<br /> |
| 310 |
<dl> |
| 311 |
<dt><a name="Model-__contains__" id="Model-__contains__"><strong>__contains__</strong></a>(self, arg)</dt> |
| 312 |
</dl> |
| 313 |
<dl> |
| 314 |
<dt><a name="Model-__del__" id="Model-__del__"><strong>__del__</strong></a>(self)</dt> |
| 315 |
</dl> |
| 316 |
<dl> |
| 317 |
<dt><a name="Model-__delitem__" id="Model-__delitem__"><strong>__delitem__</strong></a>(self, arg)</dt> |
| 318 |
</dl> |
| 319 |
<dl> |
| 320 |
<dt><a name="Model-__init__" id="Model-__init__"><strong>__init__</strong></a>(self, storage<font color="#909090">=None</font>, **args)</dt> |
| 321 |
<dd><tt>Create an RDF <a href="#Model">Model</a> (constructor).<br /> |
| 322 |
<br /> |
| 323 |
Create a <a href="#Model">Model</a> from an existing <a href="#Storage">Storage</a> (most common use). <br /> |
| 324 |
<br /> |
| 325 |
Optional parameters:<br /> |
| 326 |
<br /> |
| 327 |
options_string - A string of options for the <a href="#Model">Model</a><br /> |
| 328 |
options_hash - A Hash of options for the <a href="#Model">Model</a><br /> |
| 329 |
<br /> |
| 330 |
m1 = RDF.<a href="#Model">Model</a>(s1)<br /> |
| 331 |
m1 = RDF.<a href="#Model">Model</a>(storage = s1)<br /> |
| 332 |
<br /> |
| 333 |
Copy an existing model m1, copying the underlying <a href="#Storage">Storage</a> of m1<br /> |
| 334 |
<br /> |
| 335 |
m2 = RDF.<a href="#Model">Model</a>(model = m1)<br /> |
| 336 |
<br /> |
| 337 |
Create a model using an in-memory storage.<br /> |
| 338 |
<br /> |
| 339 |
m3 = RDF.<a href="#Model">Model</a>()</tt></dd> |
| 340 |
</dl> |
| 341 |
<dl> |
| 342 |
<dt><a name="Model-__iter__" id="Model-__iter__"><strong>__iter__</strong></a>(self)</dt> |
| 343 |
</dl> |
| 344 |
<dl> |
| 345 |
<dt><a name="Model-__len__" id="Model-__len__"><strong>__len__</strong></a>(self)</dt> |
| 346 |
</dl> |
| 347 |
<dl> |
| 348 |
<dt><a name="Model-__str__" id="Model-__str__"><strong>__str__</strong></a>(self)</dt> |
| 349 |
</dl> |
| 350 |
<dl> |
| 351 |
<dt><a name="Model-__unicode__" id="Model-__unicode__"><strong>__unicode__</strong></a>(self)</dt> |
| 352 |
</dl> |
| 353 |
<dl> |
| 354 |
<dt><a name="Model-add" id="Model-add"><strong>add</strong></a>(self, subject, predicate, object)</dt> |
| 355 |
<dd><tt>Add the statement (subject,predicate,object) to the model.<br /> |
| 356 |
DEPRECATED. Use <a href="#Model">Model</a>.<a href="#Model-append">append</a>(<a href="#Statement">Statement</a>(s,p,o)) instead.</tt></dd> |
| 357 |
</dl> |
| 358 |
<dl> |
| 359 |
<dt><a name="Model-add_statement" id="Model-add_statement"><strong>add_statement</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt> |
| 360 |
<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 /> |
| 361 |
For Python idiom you should use <a href="#Model">Model</a>.<a href="#Model-append">append</a>() instead, which does<br /> |
| 362 |
the same thing.</tt></dd> |
| 363 |
</dl> |
| 364 |
<dl> |
| 365 |
<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> |
| 366 |
<dd><tt>Add the <a href="#Stream">Stream</a> of Statements to the <a href="#Model">Model</a> with the optional<br /> |
| 367 |
context <a href="#Node">Node</a></tt></dd> |
| 368 |
</dl> |
| 369 |
<dl> |
| 370 |
<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> |
| 371 |
<dd><tt>Add the <a href="#Statement">Statement</a> (subject,predicate, typed literal) to the <a href="#Model">Model</a><br /> |
| 372 |
where the typed literal is constructed from the<br /> |
| 373 |
literal string, optional XML language and optional datatype URI.<br /> |
| 374 |
DEPRECATED. Use <a href="#Model">Model</a>.<a href="#Model-append">append</a>(<a href="#Statement">Statement</a>(s,p,o)) instead.</tt></dd> |
| 375 |
</dl> |
| 376 |
<dl> |
| 377 |
<dt><a name="Model-append" id="Model-append"><strong>append</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt> |
| 378 |
<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 /> |
| 379 |
<br /> |
| 380 |
model.<a href="#Model-append">append</a>(<a href="#Statement">Statement</a>(s, p, o)</tt></dd> |
| 381 |
</dl> |
| 382 |
<dl> |
| 383 |
<dt><a name="Model-arcs" id="Model-arcs"><strong>arcs</strong></a> = <a href="#Model-get_predicates">get_predicates</a>(self, source, target)</dt> |
| 384 |
</dl> |
| 385 |
<dl> |
| 386 |
<dt><a name="Model-as_stream" id="Model-as_stream"><strong>as_stream</strong></a>(self, context<font color="#909090">=None</font>)</dt> |
| 387 |
<dd><tt>Return the <a href="#Model">Model</a> as a <a href="#Stream">Stream</a> of Statements. No need to use<br /> |
| 388 |
this explicitly, instead do:<br /> |
| 389 |
<br /> |
| 390 |
for statement in model:<br /> |
| 391 |
# process statement</tt></dd> |
| 392 |
</dl> |
| 393 |
<dl> |
| 394 |
<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> |
| 395 |
<dd><tt>Return the <a href="#Model">Model</a> as a <a href="#Stream">Stream</a> of (statement, context) tuples.<br /> |
| 396 |
<br /> |
| 397 |
for (s, c) in model.<a href="#Model-as_stream_context">as_stream_context</a>():<br /> |
| 398 |
# do whatever<br /> |
| 399 |
<br /> |
| 400 |
Specify the optional argument context if you want to hardwire<br /> |
| 401 |
the stream's context.</tt></dd> |
| 402 |
</dl> |
| 403 |
<dl> |
| 404 |
<dt><a name="Model-contains_statement" id="Model-contains_statement"><strong>contains_statement</strong></a>(self, statement)</dt> |
| 405 |
<dd><tt>Return true if the <a href="#Statement">Statement</a> is in the <a href="#Model">Model</a></tt></dd> |
| 406 |
</dl> |
| 407 |
<dl> |
| 408 |
<dt><a name="Model-contains_statement_context" id="Model-contains_statement_context"><strong>contains_statement_context</strong></a>(self, statement, context)</dt> |
| 409 |
<dd><tt>Return true if the <a href="#Statement">Statement</a> is in the <a href="#Model">Model</a> with the specified<br /> |
| 410 |
context. Note that the implementation is pretty inefficient.</tt></dd> |
| 411 |
</dl> |
| 412 |
<dl> |
| 413 |
<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> |
| 414 |
</dl> |
| 415 |
<dl> |
| 416 |
<dt><a name="Model-execute" id="Model-execute"><strong>execute</strong></a>(self, query)</dt> |
| 417 |
</dl> |
| 418 |
<dl> |
| 419 |
<dt><a name="Model-find_statements" id="Model-find_statements"><strong>find_statements</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt> |
| 420 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements matching the given <a href="#Statement">Statement</a> --<br /> |
| 421 |
any nodes with value None of the statement match any <a href="#Node">Node</a> in<br /> |
| 422 |
the <a href="#Model">Model</a>.<br /> |
| 423 |
<br /> |
| 424 |
Specify the optional argument context if you want to search<br /> |
| 425 |
only in one context.<br /> |
| 426 |
<br /> |
| 427 |
qs = RDF.<a href="#Statement">Statement</a>(subject = None,<br /> |
| 428 |
predicate = RDF.<a href="#Node">Node</a>(uri_string = "http://example.com/pred"),<br /> |
| 429 |
object = None)<br /> |
| 430 |
for statement in model.<a href="#Model-find_statements">find_statements</a>(qs):<br /> |
| 431 |
# do whatever</tt></dd> |
| 432 |
</dl> |
| 433 |
<dl> |
| 434 |
<dt><a name="Model-find_statements_context" id="Model-find_statements_context"><strong>find_statements_context</strong></a>(self, statement)</dt> |
| 435 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements with context, matching the given<br /> |
| 436 |
<a href="#Statement">Statement</a> -- any nodes with value None of the statement match<br /> |
| 437 |
any <a href="#Node">Node</a> in the <a href="#Model">Model</a>.<br /> |
| 438 |
<br /> |
| 439 |
qs = RDF.<a href="#Statement">Statement</a>(subject = None,<br /> |
| 440 |
predicate = RDF.<a href="#Node">Node</a>(uri_string = "http://example.com/pred"),<br /> |
| 441 |
object = None)<br /> |
| 442 |
for (statement, context) in model.<a href="#Model-find_statements_context">find_statements_context</a>(qs):<br /> |
| 443 |
# do whatever</tt></dd> |
| 444 |
</dl> |
| 445 |
<dl> |
| 446 |
<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> |
| 447 |
</dl> |
| 448 |
<dl> |
| 449 |
<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> |
| 450 |
</dl> |
| 451 |
<dl> |
| 452 |
<dt><a name="Model-get_contexts" id="Model-get_contexts"><strong>get_contexts</strong></a>(self)</dt> |
| 453 |
<dd><tt>Return a sequence of context Nodes in the <a href="#Model">Model</a>.</tt></dd> |
| 454 |
</dl> |
| 455 |
<dl> |
| 456 |
<dt><a name="Model-get_feature" id="Model-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 457 |
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Model">Model</a> feature URI uri</tt></dd> |
| 458 |
</dl> |
| 459 |
<dl> |
| 460 |
<dt><a name="Model-get_predicate" id="Model-get_predicate"><strong>get_predicate</strong></a>(self, source, target)</dt> |
| 461 |
<dd><tt>Return one <a href="#Node">Node</a> in the <a href="#Model">Model</a> matching (source, ?, target).<br /> |
| 462 |
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> |
| 463 |
</dl> |
| 464 |
<dl> |
| 465 |
<dt><a name="Model-get_predicates" id="Model-get_predicates"><strong>get_predicates</strong></a>(self, source, target)</dt> |
| 466 |
<dd><tt>Return a sequence of Nodes that are the predicates<br /> |
| 467 |
of Statements in the <a href="#Model">Model</a> matching (source, ?, target).<br /> |
| 468 |
<br /> |
| 469 |
Instead of specifying a <a href="#Node">Node</a> for source, you can shortcut with<br /> |
| 470 |
a <a href="#Uri">Uri</a>, and with a <a href="#Uri">Uri</a> or string for target.<br /> |
| 471 |
<br /> |
| 472 |
e.g.<br /> |
| 473 |
model.<a href="#Model-get_predicates">get_predicates</a>(<a href="#Uri">Uri</a>("http://example.com/me"), "Fred")</tt></dd> |
| 474 |
</dl> |
| 475 |
<dl> |
| 476 |
<dt><a name="Model-get_predicates_context" id="Model-get_predicates_context"><strong>get_predicates_context</strong></a>(self, source, target)</dt> |
| 477 |
<dd><tt>As for <a href="#Model">Model</a>.get_predicates but returns a list of <br /> |
| 478 |
(statement, context) tuples.</tt></dd> |
| 479 |
</dl> |
| 480 |
<dl> |
| 481 |
<dt><a name="Model-get_source" id="Model-get_source"><strong>get_source</strong></a>(self, predicate, target)</dt> |
| 482 |
<dd><tt>Return one <a href="#Node">Node</a> in the <a href="#Model">Model</a> matching (?, predicate, target).<br /> |
| 483 |
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> |
| 484 |
</dl> |
| 485 |
<dl> |
| 486 |
<dt><a name="Model-get_sources" id="Model-get_sources"><strong>get_sources</strong></a>(self, predicate, target)</dt> |
| 487 |
<dd><tt>Return a sequence of <a href="#Node">Node</a> s that are the source<br /> |
| 488 |
of Statements in the <a href="#Model">Model</a> matching (?, predicate, target).<br /> |
| 489 |
<br /> |
| 490 |
Instead of specifying a <a href="#Node">Node</a> for predicate, you can shortcut with<br /> |
| 491 |
a <a href="#Uri">Uri</a>, and with a <a href="#Uri">Uri</a> or string for target.<br /> |
| 492 |
<br /> |
| 493 |
e.g.<br /> |
| 494 |
model.<a href="#Model-get_sources">get_sources</a>(<a href="#Uri">Uri</a>("http://example.com/name"), "Fred")</tt></dd> |
| 495 |
</dl> |
| 496 |
<dl> |
| 497 |
<dt><a name="Model-get_sources_context" id="Model-get_sources_context"><strong>get_sources_context</strong></a>(self, predicate, target)</dt> |
| 498 |
<dd><tt>As for <a href="#Model">Model</a>.get_sources but returns a list of <br /> |
| 499 |
(statement, context) tuples.</tt></dd> |
| 500 |
</dl> |
| 501 |
<dl> |
| 502 |
<dt><a name="Model-get_target" id="Model-get_target"><strong>get_target</strong></a>(self, source, predicate)</dt> |
| 503 |
<dd><tt>Return one <a href="#Node">Node</a> in the <a href="#Model">Model</a> matching (source, predicate, ?).<br /> |
| 504 |
The source and predicate can be a <a href="#Node">Node</a> or <a href="#Uri">Uri</a>.</tt></dd> |
| 505 |
</dl> |
| 506 |
<dl> |
| 507 |
<dt><a name="Model-get_targets" id="Model-get_targets"><strong>get_targets</strong></a>(self, source, predicate)</dt> |
| 508 |
<dd><tt>Return a sequence of Nodes that are the targets<br /> |
| 509 |
of Statements in the <a href="#Model">Model</a> matching (source, predicate, ?).<br /> |
| 510 |
<br /> |
| 511 |
Instead of specifying a <a href="#Node">Node</a> for source or predicate, you<br /> |
| 512 |
can shortcut with a <a href="#Uri">Uri</a>.<br /> |
| 513 |
<br /> |
| 514 |
e.g.<br /> |
| 515 |
<br /> |
| 516 |
model.<a href="#Model-get_targets">get_targets</a>(<a href="#Uri">Uri</a>("http://example.com/me"), prednode)</tt></dd> |
| 517 |
</dl> |
| 518 |
<dl> |
| 519 |
<dt><a name="Model-get_targets_context" id="Model-get_targets_context"><strong>get_targets_context</strong></a>(self, source, predicate)</dt> |
| 520 |
<dd><tt>As for <a href="#Model">Model</a>.get_targets but returns a list of <br /> |
| 521 |
(statement, context) tuples.</tt></dd> |
| 522 |
</dl> |
| 523 |
<dl> |
| 524 |
<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> |
| 525 |
<dd><tt>Load triples into the <a href="#Model">Model</a> from a URI in a syntax.<br /> |
| 526 |
Returns a boolean success or failure.<br /> |
| 527 |
<br /> |
| 528 |
If no parser name is given, the parser to use is guessed.<br /> |
| 529 |
<br /> |
| 530 |
If handler is given, an error handler with the signature<br /> |
| 531 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 532 |
is called.</tt></dd> |
| 533 |
</dl> |
| 534 |
<dl> |
| 535 |
<dt><a name="Model-predicates" id="Model-predicates"><strong>predicates</strong></a> = <a href="#Model-get_predicates">get_predicates</a>(self, source, target)</dt> |
| 536 |
</dl> |
| 537 |
<dl> |
| 538 |
<dt><a name="Model-remove_statement" id="Model-remove_statement"><strong>remove_statement</strong></a>(self, statement, context<font color="#909090">=None</font>)</dt> |
| 539 |
<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 /> |
| 540 |
This is used by the __delitem__ method. Preferred way of removing a<br /> |
| 541 |
<a href="#Statement">Statement</a> is:<br /> |
| 542 |
<br /> |
| 543 |
del model[statement]<br /> |
| 544 |
del model[statement, context]</tt></dd> |
| 545 |
</dl> |
| 546 |
<dl> |
| 547 |
<dt><a name="Model-remove_statements_with_context" id="Model-remove_statements_with_context"><strong>remove_statements_with_context</strong></a>(self, context)</dt> |
| 548 |
<dd><tt>Remove all Statements from the <a href="#Model">Model</a> with the given context <a href="#Node">Node</a></tt></dd> |
| 549 |
</dl> |
| 550 |
<dl> |
| 551 |
<dt><a name="Model-run_as_statements" id="Model-run_as_statements"><strong>run_as_statements</strong></a>(self, query)</dt> |
| 552 |
</dl> |
| 553 |
<dl> |
| 554 |
<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> |
| 555 |
</dl> |
| 556 |
<dl> |
| 557 |
<dt><a name="Model-set_feature" id="Model-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 558 |
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Model">Model</a> feature URI uri.</tt></dd> |
| 559 |
</dl> |
| 560 |
<dl> |
| 561 |
<dt><a name="Model-size" id="Model-size"><strong>size</strong></a>(self)</dt> |
| 562 |
<dd><tt>Return the size of the <a href="#Model">Model</a> in number of statements.<br /> |
| 563 |
Returns a value < 0 if number of statements not countable.</tt></dd> |
| 564 |
</dl> |
| 565 |
<dl> |
| 566 |
<dt><a name="Model-sources" id="Model-sources"><strong>sources</strong></a> = <a href="#Model-get_sources">get_sources</a>(self, predicate, target)</dt> |
| 567 |
</dl> |
| 568 |
<dl> |
| 569 |
<dt><a name="Model-sync" id="Model-sync"><strong>sync</strong></a>(self)</dt> |
| 570 |
<dd><tt>Synchronise the <a href="#Model">Model</a> with the underlying <a href="#Storage">Storage</a>.</tt></dd> |
| 571 |
</dl> |
| 572 |
<dl> |
| 573 |
<dt><a name="Model-targets" id="Model-targets"><strong>targets</strong></a> = <a href="#Model-get_targets">get_targets</a>(self, source, predicate)</dt> |
| 574 |
</dl> |
| 575 |
<dl> |
| 576 |
<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> |
| 577 |
<dd><tt>Serialize the <a href="#Model">Model</a> to a syntax.<br /> |
| 578 |
<br /> |
| 579 |
print model.<a href="#Model-to_string">to_string</a>(base_uri="http://example.org/base")<br /> |
| 580 |
<br /> |
| 581 |
If no serializer name is given, the default serializer RDF/XML is used.</tt></dd> |
| 582 |
</dl> |
| 583 |
<hr /> |
| 584 |
Data descriptors defined here:<br /> |
| 585 |
<dl> |
| 586 |
<dt><strong>__dict__</strong></dt> |
| 587 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 588 |
</dl> |
| 589 |
<dl> |
| 590 |
<dt><strong>__weakref__</strong></dt> |
| 591 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 592 |
</dl> |
| 593 |
</td> |
| 594 |
</tr> |
| 595 |
</table> |
| 596 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 597 |
<tr bgcolor="#FFC8D8"> |
| 598 |
<td colspan="3" valign="bottom"> <br /> |
| 599 |
<font color="#000000" face="helvetica, arial"><a name="NS" id="NS">class <strong>NS</strong></a>(__builtin__.object)</font></td> |
| 600 |
</tr> |
| 601 |
<tr bgcolor="#FFC8D8"> |
| 602 |
<td rowspan="2"><tt> </tt></td> |
| 603 |
<td colspan="2"><tt>Redland Namespace Utility Class<br /> |
| 604 |
<br /> |
| 605 |
import RDF<br /> |
| 606 |
nspace = RDF.<a href="#NS">NS</a>("http://example.com/foo#")<br /> |
| 607 |
<br /> |
| 608 |
# creates an RDF <a href="#Node">Node</a> for http://example.com/foo#blah <br /> |
| 609 |
node1 = nspace.blah<br /> |
| 610 |
<br /> |
| 611 |
# creates an RDF <a href="#Node">Node</a> for http://example.com/foo#blah <br /> |
| 612 |
node2 = nspace['blah']<br /> |
| 613 |
<br /> |
| 614 |
A class for generating RDF Nodes with URIs from the same vocabulary<br /> |
| 615 |
(such as XML Namespace) varying only in the appended name in<br /> |
| 616 |
the vocabulary. Each node returned is a pointer to a shared copy.<br /> |
| 617 |
</tt></td> |
| 618 |
</tr> |
| 619 |
<tr> |
| 620 |
<td> </td> |
| 621 |
<td width="100%">Methods defined here:<br /> |
| 622 |
<dl> |
| 623 |
<dt><a name="NS-__getattr__" id="NS-__getattr__"><strong>__getattr__</strong></a>(self, localName)</dt> |
| 624 |
</dl> |
| 625 |
<dl> |
| 626 |
<dt><a name="NS-__getitem__" id="NS-__getitem__"><strong>__getitem__</strong></a>(self, localName)</dt> |
| 627 |
</dl> |
| 628 |
<dl> |
| 629 |
<dt><a name="NS-__init__" id="NS-__init__"><strong>__init__</strong></a>(self, prefix)</dt> |
| 630 |
</dl> |
| 631 |
<hr /> |
| 632 |
Data descriptors defined here:<br /> |
| 633 |
<dl> |
| 634 |
<dt><strong>__dict__</strong></dt> |
| 635 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 636 |
</dl> |
| 637 |
<dl> |
| 638 |
<dt><strong>__weakref__</strong></dt> |
| 639 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 640 |
</dl> |
| 641 |
</td> |
| 642 |
</tr> |
| 643 |
</table> |
| 644 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 645 |
<tr bgcolor="#FFC8D8"> |
| 646 |
<td colspan="3" valign="bottom"> <br /> |
| 647 |
<font color="#000000" face="helvetica, arial"><a name="NTriplesParser" id="NTriplesParser">class <strong>NTriplesParser</strong></a>(<a href="#Parser">Parser</a>)</font></td> |
| 648 |
</tr> |
| 649 |
<tr bgcolor="#FFC8D8"> |
| 650 |
<td rowspan="2"><tt> </tt></td> |
| 651 |
<td colspan="2"><tt>Redland N-Triples <a href="#Parser">Parser</a> class<br /> |
| 652 |
<br /> |
| 653 |
import RDF<br /> |
| 654 |
parser=RDF.<a href="#NTriplesParser">NTriplesParser</a>()<br /> |
| 655 |
</tt></td> |
| 656 |
</tr> |
| 657 |
<tr> |
| 658 |
<td> </td> |
| 659 |
<td width="100%"> |
| 660 |
<dl> |
| 661 |
<dt>Method resolution order:</dt> |
| 662 |
<dd><a href="#NTriplesParser">NTriplesParser</a></dd> |
| 663 |
<dd><a href="#Parser">Parser</a></dd> |
| 664 |
<dd>__builtin__.object</dd> |
| 665 |
</dl> |
| 666 |
<hr /> |
| 667 |
Methods defined here:<br /> |
| 668 |
<dl> |
| 669 |
<dt><a name="NTriplesParser-__init__" id="NTriplesParser-__init__"><strong>__init__</strong></a>(self)</dt> |
| 670 |
</dl> |
| 671 |
<hr /> |
| 672 |
Methods inherited from <a href="#Parser">Parser</a>:<br /> |
| 673 |
<dl> |
| 674 |
<dt><a name="NTriplesParser-__del__" id="NTriplesParser-__del__"><strong>__del__</strong></a>(self)</dt> |
| 675 |
</dl> |
| 676 |
<dl> |
| 677 |
<dt><a name="NTriplesParser-get_feature" id="NTriplesParser-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 678 |
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri</tt></dd> |
| 679 |
</dl> |
| 680 |
<dl> |
| 681 |
<dt><a name="NTriplesParser-namespaces_seen" id="NTriplesParser-namespaces_seen"><strong>namespaces_seen</strong></a>(self)</dt> |
| 682 |
<dd><tt>Get a dictionary of prefix/URI pairs for namespaces seen during parsing.</tt></dd> |
| 683 |
</dl> |
| 684 |
<dl> |
| 685 |
<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> |
| 686 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content at<br /> |
| 687 |
a URI for the optional base URI or None if the parsing fails.<br /> |
| 688 |
<br /> |
| 689 |
(This depends on what URI support raptor provides to redland)<br /> |
| 690 |
<br /> |
| 691 |
for statement in parser.<a href="#NTriplesParser-parse_as_stream">parse_as_stream</a>(""):<br /> |
| 692 |
print statement</tt></dd> |
| 693 |
</dl> |
| 694 |
<dl> |
| 695 |
<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> |
| 696 |
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content at the URI, for<br /> |
| 697 |
the optional base URI. Returns a boolean success or failure.<br /> |
| 698 |
<br /> |
| 699 |
If handler is given, an error handler with the signature<br /> |
| 700 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 701 |
is called.<br /> |
| 702 |
<br /> |
| 703 |
parser.<a href="#NTriplesParser-parse_into_model">parse_into_model</a>(model, "file:./foo.rdf",<br /> |
| 704 |
"http://example.com/foo.rdf")</tt></dd> |
| 705 |
</dl> |
| 706 |
<dl> |
| 707 |
<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> |
| 708 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content in<br /> |
| 709 |
string with the required base URI or None if the parsing fails.<br /> |
| 710 |
<br /> |
| 711 |
for statement in parser.<a href="#NTriplesParser-parse_string_as_stream">parse_string_as_stream</a>(rdfstring, base_uri):<br /> |
| 712 |
print statement</tt></dd> |
| 713 |
</dl> |
| 714 |
<dl> |
| 715 |
<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> |
| 716 |
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content string<br /> |
| 717 |
with the required base URI. Returns a boolean success or failure.<br /> |
| 718 |
<br /> |
| 719 |
If handler is given, an error handler with the signature<br /> |
| 720 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 721 |
is called.</tt></dd> |
| 722 |
</dl> |
| 723 |
<dl> |
| 724 |
<dt><a name="NTriplesParser-set_feature" id="NTriplesParser-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 725 |
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri.</tt></dd> |
| 726 |
</dl> |
| 727 |
<dl> |
| 728 |
<dt><a name="NTriplesParser-set_uri_filter" id="NTriplesParser-set_uri_filter"><strong>set_uri_filter</strong></a>(self, filter)</dt> |
| 729 |
<dd><tt>Set a function for rejecting retrieval of URIs seen during parsing.<br /> |
| 730 |
<br /> |
| 731 |
Return False or 0 to not reject the URI<br /> |
| 732 |
<br /> |
| 733 |
def reject(uri):<br /> |
| 734 |
if "bad" == uri:<br /> |
| 735 |
return True<br /> |
| 736 |
return False<br /> |
| 737 |
<br /> |
| 738 |
parser.<a href="#NTriplesParser-set_uri_filter">set_uri_filter</a>(reject)</tt></dd> |
| 739 |
</dl> |
| 740 |
<hr /> |
| 741 |
Data descriptors inherited from <a href="#Parser">Parser</a>:<br /> |
| 742 |
<dl> |
| 743 |
<dt><strong>__dict__</strong></dt> |
| 744 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 745 |
</dl> |
| 746 |
<dl> |
| 747 |
<dt><strong>__weakref__</strong></dt> |
| 748 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 749 |
</dl> |
| 750 |
</td> |
| 751 |
</tr> |
| 752 |
</table> |
| 753 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 754 |
<tr bgcolor="#FFC8D8"> |
| 755 |
<td colspan="3" valign="bottom"> <br /> |
| 756 |
<font color="#000000" face="helvetica, arial"><a name="NTriplesSerializer" id="NTriplesSerializer">class <strong>NTriplesSerializer</strong></a>(<a href="#Serializer">Serializer</a>)</font></td> |
| 757 |
</tr> |
| 758 |
<tr bgcolor="#FFC8D8"> |
| 759 |
<td rowspan="2"><tt> </tt></td> |
| 760 |
<td colspan="2"><tt>Redland N-Triples <a href="#Serializer">Serializer</a> class<br /> |
| 761 |
<br /> |
| 762 |
import RDF<br /> |
| 763 |
ser=RDF.<a href="#NTriplesSerializer">NTriplesSerializer</a>()<br /> |
| 764 |
</tt></td> |
| 765 |
</tr> |
| 766 |
<tr> |
| 767 |
<td> </td> |
| 768 |
<td width="100%"> |
| 769 |
<dl> |
| 770 |
<dt>Method resolution order:</dt> |
| 771 |
<dd><a href="#NTriplesSerializer">NTriplesSerializer</a></dd> |
| 772 |
<dd><a href="#Serializer">Serializer</a></dd> |
| 773 |
<dd>__builtin__.object</dd> |
| 774 |
</dl> |
| 775 |
<hr /> |
| 776 |
Methods defined here:<br /> |
| 777 |
<dl> |
| 778 |
<dt><a name="NTriplesSerializer-__init__" id="NTriplesSerializer-__init__"><strong>__init__</strong></a>(self)</dt> |
| 779 |
</dl> |
| 780 |
<hr /> |
| 781 |
Methods inherited from <a href="#Serializer">Serializer</a>:<br /> |
| 782 |
<dl> |
| 783 |
<dt><a name="NTriplesSerializer-__del__" id="NTriplesSerializer-__del__"><strong>__del__</strong></a>(self)</dt> |
| 784 |
</dl> |
| 785 |
<dl> |
| 786 |
<dt><a name="NTriplesSerializer-get_feature" id="NTriplesSerializer-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 787 |
<dd><tt>Return the value of <a href="#Serializer">Serializer</a> feature URI uri</tt></dd> |
| 788 |
</dl> |
| 789 |
<dl> |
| 790 |
<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> |
| 791 |
<dd><tt>Serialize to filename name the <a href="#Model">Model</a> model using the<br /> |
| 792 |
optional base URI.</tt></dd> |
| 793 |
</dl> |
| 794 |
<dl> |
| 795 |
<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> |
| 796 |
<dd><tt>Serialize to a string using the optional base URI.</tt></dd> |
| 797 |
</dl> |
| 798 |
<dl> |
| 799 |
<dt><a name="NTriplesSerializer-serialize_stream_to_string" id="NTriplesSerializer-serialize_stream_to_string"><strong>serialize_stream_to_string</strong></a>(self, stream, base_uri<font color="#909090">=None</font>)</dt> |
| 800 |
<dd><tt>Serialize a stream to a string using the optional base URI.</tt></dd> |
| 801 |
</dl> |
| 802 |
<dl> |
| 803 |
<dt><a name="NTriplesSerializer-set_feature" id="NTriplesSerializer-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 804 |
<dd><tt>Set the value of <a href="#Serializer">Serializer</a> feature URI uri.</tt></dd> |
| 805 |
</dl> |
| 806 |
<dl> |
| 807 |
<dt><a name="NTriplesSerializer-set_namespace" id="NTriplesSerializer-set_namespace"><strong>set_namespace</strong></a>(self, prefix, uri)</dt> |
| 808 |
<dd><tt>Set a namespace prefix and URI for the <a href="#Serializer">Serializer</a> to use.</tt></dd> |
| 809 |
</dl> |
| 810 |
<hr /> |
| 811 |
Data descriptors inherited from <a href="#Serializer">Serializer</a>:<br /> |
| 812 |
<dl> |
| 813 |
<dt><strong>__dict__</strong></dt> |
| 814 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 815 |
</dl> |
| 816 |
<dl> |
| 817 |
<dt><strong>__weakref__</strong></dt> |
| 818 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 819 |
</dl> |
| 820 |
</td> |
| 821 |
</tr> |
| 822 |
</table> |
| 823 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 824 |
<tr bgcolor="#FFC8D8"> |
| 825 |
<td colspan="3" valign="bottom"> <br /> |
| 826 |
<font color="#000000" face="helvetica, arial"><a name="Node" id="Node">class <strong>Node</strong></a>(__builtin__.object)</font></td> |
| 827 |
</tr> |
| 828 |
<tr bgcolor="#FFC8D8"> |
| 829 |
<td rowspan="2"><tt> </tt></td> |
| 830 |
<td colspan="2"><tt>Redland <a href="#Node">Node</a> (RDF Resource, Property, Literal) Class<br /> |
| 831 |
<br /> |
| 832 |
import RDF<br /> |
| 833 |
<br /> |
| 834 |
node1=RDF.<a href="#Node">Node</a>()<br /> |
| 835 |
<br /> |
| 836 |
node2=RDF.<a href="#Node">Node</a>(RDF.<a href="#Uri">Uri</a>("http://example.com/"))<br /> |
| 837 |
node3=RDF.<a href="#Node">Node</a>("Hello, World!")<br /> |
| 838 |
<br /> |
| 839 |
node4=RDF.<a href="#Node">Node</a>(uri_string="http://example.com/")<br /> |
| 840 |
node5=RDF.<a href="#Node">Node</a>(literal="<tag>content</tag>", is_wf_xml=1)<br /> |
| 841 |
node6=RDF.<a href="#Node">Node</a>(blank="abc")<br /> |
| 842 |
node7=RDF.<a href="#Node">Node</a>(node5)<br /> |
| 843 |
...<br /> |
| 844 |
<br /> |
| 845 |
print node2<br /> |
| 846 |
if node7.<a href="#Node-is_resource">is_resource</a>():<br /> |
| 847 |
print "Resource with URI", node7.uri<br /> |
| 848 |
<br /> |
| 849 |
if node5.<a href="#Node-is_blank">is_blank</a>():<br /> |
| 850 |
print "Resource with blank node name ", node5.blank_identifier<br /> |
| 851 |
</tt></td> |
| 852 |
</tr> |
| 853 |
<tr> |
| 854 |
<td> </td> |
| 855 |
<td width="100%">Methods defined here:<br /> |
| 856 |
<dl> |
| 857 |
<dt><a name="Node-__del__" id="Node-__del__"><strong>__del__</strong></a>(self)</dt> |
| 858 |
<dd><tt>Free an RDF <a href="#Node">Node</a> (destructor).</tt></dd> |
| 859 |
</dl> |
| 860 |
<dl> |
| 861 |
<dt><a name="Node-__eq__" id="Node-__eq__"><strong>__eq__</strong></a>(self, other)</dt> |
| 862 |
<dd><tt>Equality of an RDF <a href="#Node">Node</a> compared to another RDF <a href="#Node">Node</a>.</tt></dd> |
| 863 |
</dl> |
| 864 |
<dl> |
| 865 |
<dt><a name="Node-__hash__" id="Node-__hash__"><strong>__hash__</strong></a>(self)</dt> |
| 866 |
</dl> |
| 867 |
<dl> |
| 868 |
<dt><a name="Node-__init__" id="Node-__init__"><strong>__init__</strong></a>(self, arg<font color="#909090">=None</font>, **args)</dt> |
| 869 |
<dd><tt>Create an RDF <a href="#Node">Node</a> (constructor).<br /> |
| 870 |
<br /> |
| 871 |
Resource or Property node creation:<br /> |
| 872 |
<br /> |
| 873 |
n1 = <a href="#Node">Node</a>(<a href="#Uri">Uri</a>("http://example.com/foo"))<br /> |
| 874 |
<br /> |
| 875 |
String literal node creation (see below for more complex<br /> |
| 876 |
ways of building literals.)<br /> |
| 877 |
<br /> |
| 878 |
n2 = <a href="#Node">Node</a>("foo")<br /> |
| 879 |
<br /> |
| 880 |
<a href="#Node">Node</a> copying:<br /> |
| 881 |
<br /> |
| 882 |
n3 = <a href="#Node">Node</a>(n1)<br /> |
| 883 |
<br /> |
| 884 |
Or create a new RDF <a href="#Node">Node</a> using the following named parameters:<br /> |
| 885 |
<br /> |
| 886 |
uri_string - create a resource node from a string URI<br /> |
| 887 |
uri - create a resource node from a URI object<br /> |
| 888 |
literal - create a literal node from a literal string <br /> |
| 889 |
datatype - the datatype URI<br /> |
| 890 |
is_wf_xml - the literal is XML (alternative to datatype)<br /> |
| 891 |
language - the literal XML language<br /> |
| 892 |
blank - create a resource node from with a blank node identiifer<br /> |
| 893 |
node - copy a node</tt></dd> |
| 894 |
</dl> |
| 895 |
<dl> |
| 896 |
<dt><a name="Node-__ne__" id="Node-__ne__"><strong>__ne__</strong></a>(self, other)</dt> |
| 897 |
<dd><tt>Inequality of an RDF <a href="#Node">Node</a> compared to another RDF <a href="#Node">Node</a>.</tt></dd> |
| 898 |
</dl> |
| 899 |
<dl> |
| 900 |
<dt><a name="Node-__str__" id="Node-__str__"><strong>__str__</strong></a>(self)</dt> |
| 901 |
<dd><tt>Get a string representation of an RDF <a href="#Node">Node</a>.</tt></dd> |
| 902 |
</dl> |
| 903 |
<dl> |
| 904 |
<dt><a name="Node-__unicode__" id="Node-__unicode__"><strong>__unicode__</strong></a>(self)</dt> |
| 905 |
<dd><tt>Get a Unicode string representation of an RDF <a href="#Node">Node</a>.</tt></dd> |
| 906 |
</dl> |
| 907 |
<dl> |
| 908 |
<dt><a name="Node-is_blank" id="Node-is_blank"><strong>is_blank</strong></a>(self)</dt> |
| 909 |
<dd><tt>Return true if node is a blank node</tt></dd> |
| 910 |
</dl> |
| 911 |
<dl> |
| 912 |
<dt><a name="Node-is_literal" id="Node-is_literal"><strong>is_literal</strong></a>(self)</dt> |
| 913 |
<dd><tt>Return true if node is a literal</tt></dd> |
| 914 |
</dl> |
| 915 |
<dl> |
| 916 |
<dt><a name="Node-is_resource" id="Node-is_resource"><strong>is_resource</strong></a>(self)</dt> |
| 917 |
<dd><tt>Return true if node is a resource with a URI</tt></dd> |
| 918 |
</dl> |
| 919 |
<hr /> |
| 920 |
Data descriptors defined here:<br /> |
| 921 |
<dl> |
| 922 |
<dt><strong>__dict__</strong></dt> |
| 923 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 924 |
</dl> |
| 925 |
<dl> |
| 926 |
<dt><strong>__weakref__</strong></dt> |
| 927 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 928 |
</dl> |
| 929 |
<dl> |
| 930 |
<dt><strong>blank</strong></dt> |
| 931 |
<dd><tt>The blank node identifier</tt></dd> |
| 932 |
</dl> |
| 933 |
<dl> |
| 934 |
<dt><strong>blank_identifier</strong></dt> |
| 935 |
<dd><tt>The node identifier of a blank node</tt></dd> |
| 936 |
</dl> |
| 937 |
<dl> |
| 938 |
<dt><strong>literal</strong></dt> |
| 939 |
<dd><tt>A tuple of the string, language and datatype values of the node</tt></dd> |
| 940 |
</dl> |
| 941 |
<dl> |
| 942 |
<dt><strong>literal_value</strong></dt> |
| 943 |
<dd><tt>A dictionary containing the value of the node literal with keys string, language and datatype</tt></dd> |
| 944 |
</dl> |
| 945 |
<dl> |
| 946 |
<dt><strong>type</strong></dt> |
| 947 |
<dd><tt>The node type, an integer</tt></dd> |
| 948 |
</dl> |
| 949 |
<dl> |
| 950 |
<dt><strong>uri</strong></dt> |
| 951 |
<dd><tt>The URI of a resource node</tt></dd> |
| 952 |
</dl> |
| 953 |
</td> |
| 954 |
</tr> |
| 955 |
</table> |
| 956 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 957 |
<tr bgcolor="#FFC8D8"> |
| 958 |
<td colspan="3" valign="bottom"> <br /> |
| 959 |
<font color="#000000" face="helvetica, arial"><a name="Parser" id="Parser">class <strong>Parser</strong></a>(__builtin__.object)</font></td> |
| 960 |
</tr> |
| 961 |
<tr bgcolor="#FFC8D8"> |
| 962 |
<td rowspan="2"><tt> </tt></td> |
| 963 |
<td colspan="2"><tt>Redland Syntax <a href="#Parser">Parser</a> Class<br /> |
| 964 |
<br /> |
| 965 |
import RDF<br /> |
| 966 |
parser1=RDF.<a href="#Parser">Parser</a>()<br /> |
| 967 |
parser2=RDF.<a href="#Parser">Parser</a>(name="rdfxml")<br /> |
| 968 |
parser3=RDF.<a href="#Parser">Parser</a>(mime_type="application/rdf+xml")<br /> |
| 969 |
<br /> |
| 970 |
stream=parser2.<a href="#Parser-parse_as_stream">parse_as_stream</a>("file://dir/file.rdf")<br /> |
| 971 |
parser3.<a href="#Parser-parse_into_model">parse_into_model</a>(model, "file://dir/file.rdf", "http://example.org/")<br /> |
| 972 |
<br /> |
| 973 |
The default parser type if not given explicitly is raptor,<br /> |
| 974 |
for the RDF/XML syntax.<br /> |
| 975 |
</tt></td> |
| 976 |
</tr> |
| 977 |
<tr> |
| 978 |
<td> </td> |
| 979 |
<td width="100%">Methods defined here:<br /> |
| 980 |
<dl> |
| 981 |
<dt><a name="Parser-__del__" id="Parser-__del__"><strong>__del__</strong></a>(self)</dt> |
| 982 |
</dl> |
| 983 |
<dl> |
| 984 |
<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> |
| 985 |
<dd><tt>Create an RDF <a href="#Parser">Parser</a> (constructor).<br /> |
| 986 |
<br /> |
| 987 |
Create a new RDF <a href="#Parser">Parser</a> for a particular syntax. The parser is<br /> |
| 988 |
chosen by the fields given to the constructor, all of which are<br /> |
| 989 |
optional. When any are given, they must all match. The default<br /> |
| 990 |
parser is chosen if none are given, which is RDF/XML in the<br /> |
| 991 |
standard configuration of Raptor.<br /> |
| 992 |
<br /> |
| 993 |
name - parser syntax name<br /> |
| 994 |
mime_type - syntax mime type<br /> |
| 995 |
uri - URI identifying the syntax</tt></dd> |
| 996 |
</dl> |
| 997 |
<dl> |
| 998 |
<dt><a name="Parser-get_feature" id="Parser-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 999 |
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri</tt></dd> |
| 1000 |
</dl> |
| 1001 |
<dl> |
| 1002 |
<dt><a name="Parser-namespaces_seen" id="Parser-namespaces_seen"><strong>namespaces_seen</strong></a>(self)</dt> |
| 1003 |
<dd><tt>Get a dictionary of prefix/URI pairs for namespaces seen during parsing.</tt></dd> |
| 1004 |
</dl> |
| 1005 |
<dl> |
| 1006 |
<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> |
| 1007 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content at<br /> |
| 1008 |
a URI for the optional base URI or None if the parsing fails.<br /> |
| 1009 |
<br /> |
| 1010 |
(This depends on what URI support raptor provides to redland)<br /> |
| 1011 |
<br /> |
| 1012 |
for statement in parser.<a href="#Parser-parse_as_stream">parse_as_stream</a>(""):<br /> |
| 1013 |
print statement</tt></dd> |
| 1014 |
</dl> |
| 1015 |
<dl> |
| 1016 |
<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> |
| 1017 |
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content at the URI, for<br /> |
| 1018 |
the optional base URI. Returns a boolean success or failure.<br /> |
| 1019 |
<br /> |
| 1020 |
If handler is given, an error handler with the signature<br /> |
| 1021 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 1022 |
is called.<br /> |
| 1023 |
<br /> |
| 1024 |
parser.<a href="#Parser-parse_into_model">parse_into_model</a>(model, "file:./foo.rdf",<br /> |
| 1025 |
"http://example.com/foo.rdf")</tt></dd> |
| 1026 |
</dl> |
| 1027 |
<dl> |
| 1028 |
<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> |
| 1029 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content in<br /> |
| 1030 |
string with the required base URI or None if the parsing fails.<br /> |
| 1031 |
<br /> |
| 1032 |
for statement in parser.<a href="#Parser-parse_string_as_stream">parse_string_as_stream</a>(rdfstring, base_uri):<br /> |
| 1033 |
print statement</tt></dd> |
| 1034 |
</dl> |
| 1035 |
<dl> |
| 1036 |
<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> |
| 1037 |
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content string<br /> |
| 1038 |
with the required base URI. Returns a boolean success or failure.<br /> |
| 1039 |
<br /> |
| 1040 |
If handler is given, an error handler with the signature<br /> |
| 1041 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 1042 |
is called.</tt></dd> |
| 1043 |
</dl> |
| 1044 |
<dl> |
| 1045 |
<dt><a name="Parser-set_feature" id="Parser-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 1046 |
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri.</tt></dd> |
| 1047 |
</dl> |
| 1048 |
<dl> |
| 1049 |
<dt><a name="Parser-set_uri_filter" id="Parser-set_uri_filter"><strong>set_uri_filter</strong></a>(self, filter)</dt> |
| 1050 |
<dd><tt>Set a function for rejecting retrieval of URIs seen during parsing.<br /> |
| 1051 |
<br /> |
| 1052 |
Return False or 0 to not reject the URI<br /> |
| 1053 |
<br /> |
| 1054 |
def reject(uri):<br /> |
| 1055 |
if "bad" == uri:<br /> |
| 1056 |
return True<br /> |
| 1057 |
return False<br /> |
| 1058 |
<br /> |
| 1059 |
parser.<a href="#Parser-set_uri_filter">set_uri_filter</a>(reject)</tt></dd> |
| 1060 |
</dl> |
| 1061 |
<hr /> |
| 1062 |
Data descriptors defined here:<br /> |
| 1063 |
<dl> |
| 1064 |
<dt><strong>__dict__</strong></dt> |
| 1065 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1066 |
</dl> |
| 1067 |
<dl> |
| 1068 |
<dt><strong>__weakref__</strong></dt> |
| 1069 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1070 |
</dl> |
| 1071 |
</td> |
| 1072 |
</tr> |
| 1073 |
</table> |
| 1074 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1075 |
<tr bgcolor="#FFC8D8"> |
| 1076 |
<td colspan="3" valign="bottom"> <br /> |
| 1077 |
<font color="#000000" face="helvetica, arial"><a name="Query" id="Query">class <strong>Query</strong></a>(__builtin__.object)</font></td> |
| 1078 |
</tr> |
| 1079 |
<tr bgcolor="#FFC8D8"> |
| 1080 |
<td rowspan="2"><tt> </tt></td> |
| 1081 |
<td colspan="2"><tt>Redland <a href="#Query">Query</a> interface class<br /> |
| 1082 |
<br /> |
| 1083 |
import RDF<br /> |
| 1084 |
<br /> |
| 1085 |
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 /> |
| 1086 |
q2 = RDF.<a href="#Query">Query</a>("- - -", query_language="triples")<br /> |
| 1087 |
q3 = RDF.<a href="#Query">Query</a>("select $a where ...", query_language="sparql")<br /> |
| 1088 |
<br /> |
| 1089 |
results=q1.<a href="#Query-execute">execute</a>(model)<br /> |
| 1090 |
for result in results:<br /> |
| 1091 |
print result['a']<br /> |
| 1092 |
print result['c']<br /> |
| 1093 |
<br /> |
| 1094 |
for statement in q2.<a href="#Query-execute">execute</a>().as_stream(model):<br /> |
| 1095 |
print statement<br /> |
| 1096 |
</tt></td> |
| 1097 |
</tr> |
| 1098 |
<tr> |
| 1099 |
<td> </td> |
| 1100 |
<td width="100%">Methods defined here:<br /> |
| 1101 |
<dl> |
| 1102 |
<dt><a name="Query-__del__" id="Query-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1103 |
</dl> |
| 1104 |
<dl> |
| 1105 |
<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">='sparql'</font>, query_uri<font color="#909090">=None</font>)</dt> |
| 1106 |
</dl> |
| 1107 |
<dl> |
| 1108 |
<dt><a name="Query-execute" id="Query-execute"><strong>execute</strong></a>(self, model)</dt> |
| 1109 |
</dl> |
| 1110 |
<dl> |
| 1111 |
<dt><a name="Query-get_limit" id="Query-get_limit"><strong>get_limit</strong></a>(self)</dt> |
| 1112 |
</dl> |
| 1113 |
<dl> |
| 1114 |
<dt><a name="Query-get_offset" id="Query-get_offset"><strong>get_offset</strong></a>(self)</dt> |
| 1115 |
</dl> |
| 1116 |
<dl> |
| 1117 |
<dt><a name="Query-set_limit" id="Query-set_limit"><strong>set_limit</strong></a>(self, limit)</dt> |
| 1118 |
</dl> |
| 1119 |
<dl> |
| 1120 |
<dt><a name="Query-set_offset" id="Query-set_offset"><strong>set_offset</strong></a>(self, offset)</dt> |
| 1121 |
</dl> |
| 1122 |
<hr /> |
| 1123 |
Data descriptors defined here:<br /> |
| 1124 |
<dl> |
| 1125 |
<dt><strong>__dict__</strong></dt> |
| 1126 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1127 |
</dl> |
| 1128 |
<dl> |
| 1129 |
<dt><strong>__weakref__</strong></dt> |
| 1130 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1131 |
</dl> |
| 1132 |
</td> |
| 1133 |
</tr> |
| 1134 |
</table> |
| 1135 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1136 |
<tr bgcolor="#FFC8D8"> |
| 1137 |
<td colspan="3" valign="bottom"> <br /> |
| 1138 |
<font color="#000000" face="helvetica, arial"><a name="RDFXMLSerializer" id="RDFXMLSerializer">class <strong>RDFXMLSerializer</strong></a>(<a href="#Serializer">Serializer</a>)</font></td> |
| 1139 |
</tr> |
| 1140 |
<tr bgcolor="#FFC8D8"> |
| 1141 |
<td rowspan="2"><tt> </tt></td> |
| 1142 |
<td colspan="2"><tt>Redland RDF/XML <a href="#Serializer">Serializer</a> class<br /> |
| 1143 |
<br /> |
| 1144 |
import RDF<br /> |
| 1145 |
ser=RDF.<a href="#RDFXMLSerializer">RDFXMLSerializer</a>()<br /> |
| 1146 |
</tt></td> |
| 1147 |
</tr> |
| 1148 |
<tr> |
| 1149 |
<td> </td> |
| 1150 |
<td width="100%"> |
| 1151 |
<dl> |
| 1152 |
<dt>Method resolution order:</dt> |
| 1153 |
<dd><a href="#RDFXMLSerializer">RDFXMLSerializer</a></dd> |
| 1154 |
<dd><a href="#Serializer">Serializer</a></dd> |
| 1155 |
<dd>__builtin__.object</dd> |
| 1156 |
</dl> |
| 1157 |
<hr /> |
| 1158 |
Methods defined here:<br /> |
| 1159 |
<dl> |
| 1160 |
<dt><a name="RDFXMLSerializer-__init__" id="RDFXMLSerializer-__init__"><strong>__init__</strong></a>(self)</dt> |
| 1161 |
</dl> |
| 1162 |
<hr /> |
| 1163 |
Methods inherited from <a href="#Serializer">Serializer</a>:<br /> |
| 1164 |
<dl> |
| 1165 |
<dt><a name="RDFXMLSerializer-__del__" id="RDFXMLSerializer-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1166 |
</dl> |
| 1167 |
<dl> |
| 1168 |
<dt><a name="RDFXMLSerializer-get_feature" id="RDFXMLSerializer-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 1169 |
<dd><tt>Return the value of <a href="#Serializer">Serializer</a> feature URI uri</tt></dd> |
| 1170 |
</dl> |
| 1171 |
<dl> |
| 1172 |
<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> |
| 1173 |
<dd><tt>Serialize to filename name the <a href="#Model">Model</a> model using the<br /> |
| 1174 |
optional base URI.</tt></dd> |
| 1175 |
</dl> |
| 1176 |
<dl> |
| 1177 |
<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> |
| 1178 |
<dd><tt>Serialize to a string using the optional base URI.</tt></dd> |
| 1179 |
</dl> |
| 1180 |
<dl> |
| 1181 |
<dt><a name="RDFXMLSerializer-serialize_stream_to_string" id="RDFXMLSerializer-serialize_stream_to_string"><strong>serialize_stream_to_string</strong></a>(self, stream, base_uri<font color="#909090">=None</font>)</dt> |
| 1182 |
<dd><tt>Serialize a stream to a string using the optional base URI.</tt></dd> |
| 1183 |
</dl> |
| 1184 |
<dl> |
| 1185 |
<dt><a name="RDFXMLSerializer-set_feature" id="RDFXMLSerializer-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 1186 |
<dd><tt>Set the value of <a href="#Serializer">Serializer</a> feature URI uri.</tt></dd> |
| 1187 |
</dl> |
| 1188 |
<dl> |
| 1189 |
<dt><a name="RDFXMLSerializer-set_namespace" id="RDFXMLSerializer-set_namespace"><strong>set_namespace</strong></a>(self, prefix, uri)</dt> |
| 1190 |
<dd><tt>Set a namespace prefix and URI for the <a href="#Serializer">Serializer</a> to use.</tt></dd> |
| 1191 |
</dl> |
| 1192 |
<hr /> |
| 1193 |
Data descriptors inherited from <a href="#Serializer">Serializer</a>:<br /> |
| 1194 |
<dl> |
| 1195 |
<dt><strong>__dict__</strong></dt> |
| 1196 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1197 |
</dl> |
| 1198 |
<dl> |
| 1199 |
<dt><strong>__weakref__</strong></dt> |
| 1200 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1201 |
</dl> |
| 1202 |
</td> |
| 1203 |
</tr> |
| 1204 |
</table> |
| 1205 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1206 |
<tr bgcolor="#FFC8D8"> |
| 1207 |
<td colspan="3" valign="bottom"> <br /> |
| 1208 |
<font color="#000000" face="helvetica, arial"><a name="RDQLQuery" id="RDQLQuery">class <strong>RDQLQuery</strong></a>(<a href="#Query">Query</a>)</font></td> |
| 1209 |
</tr> |
| 1210 |
<tr bgcolor="#FFC8D8"> |
| 1211 |
<td rowspan="2"><tt> </tt></td> |
| 1212 |
<td colspan="2"><tt>Redland RDQL <a href="#Query">Query</a> class<br /> |
| 1213 |
</tt></td> |
| 1214 |
</tr> |
| 1215 |
<tr> |
| 1216 |
<td> </td> |
| 1217 |
<td width="100%"> |
| 1218 |
<dl> |
| 1219 |
<dt>Method resolution order:</dt> |
| 1220 |
<dd><a href="#RDQLQuery">RDQLQuery</a></dd> |
| 1221 |
<dd><a href="#Query">Query</a></dd> |
| 1222 |
<dd>__builtin__.object</dd> |
| 1223 |
</dl> |
| 1224 |
<hr /> |
| 1225 |
Methods defined here:<br /> |
| 1226 |
<dl> |
| 1227 |
<dt><a name="RDQLQuery-__init__" id="RDQLQuery-__init__"><strong>__init__</strong></a>(self, querystring, base_uri<font color="#909090">=None</font>)</dt> |
| 1228 |
</dl> |
| 1229 |
<hr /> |
| 1230 |
Methods inherited from <a href="#Query">Query</a>:<br /> |
| 1231 |
<dl> |
| 1232 |
<dt><a name="RDQLQuery-__del__" id="RDQLQuery-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1233 |
</dl> |
| 1234 |
<dl> |
| 1235 |
<dt><a name="RDQLQuery-execute" id="RDQLQuery-execute"><strong>execute</strong></a>(self, model)</dt> |
| 1236 |
</dl> |
| 1237 |
<dl> |
| 1238 |
<dt><a name="RDQLQuery-get_limit" id="RDQLQuery-get_limit"><strong>get_limit</strong></a>(self)</dt> |
| 1239 |
</dl> |
| 1240 |
<dl> |
| 1241 |
<dt><a name="RDQLQuery-get_offset" id="RDQLQuery-get_offset"><strong>get_offset</strong></a>(self)</dt> |
| 1242 |
</dl> |
| 1243 |
<dl> |
| 1244 |
<dt><a name="RDQLQuery-set_limit" id="RDQLQuery-set_limit"><strong>set_limit</strong></a>(self, limit)</dt> |
| 1245 |
</dl> |
| 1246 |
<dl> |
| 1247 |
<dt><a name="RDQLQuery-set_offset" id="RDQLQuery-set_offset"><strong>set_offset</strong></a>(self, offset)</dt> |
| 1248 |
</dl> |
| 1249 |
<hr /> |
| 1250 |
Data descriptors inherited from <a href="#Query">Query</a>:<br /> |
| 1251 |
<dl> |
| 1252 |
<dt><strong>__dict__</strong></dt> |
| 1253 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1254 |
</dl> |
| 1255 |
<dl> |
| 1256 |
<dt><strong>__weakref__</strong></dt> |
| 1257 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1258 |
</dl> |
| 1259 |
</td> |
| 1260 |
</tr> |
| 1261 |
</table> |
| 1262 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1263 |
<tr bgcolor="#FFC8D8"> |
| 1264 |
<td colspan="3" valign="bottom"> <br /> |
| 1265 |
<font color="#000000" face="helvetica, arial"><a name="SPARQLQuery" id="SPARQLQuery">class <strong>SPARQLQuery</strong></a>(<a href="#Query">Query</a>)</font></td> |
| 1266 |
</tr> |
| 1267 |
<tr bgcolor="#FFC8D8"> |
| 1268 |
<td rowspan="2"><tt> </tt></td> |
| 1269 |
<td colspan="2"><tt>Redland SPARQL <a href="#Query">Query</a> class<br /> |
| 1270 |
</tt></td> |
| 1271 |
</tr> |
| 1272 |
<tr> |
| 1273 |
<td> </td> |
| 1274 |
<td width="100%"> |
| 1275 |
<dl> |
| 1276 |
<dt>Method resolution order:</dt> |
| 1277 |
<dd><a href="#SPARQLQuery">SPARQLQuery</a></dd> |
| 1278 |
<dd><a href="#Query">Query</a></dd> |
| 1279 |
<dd>__builtin__.object</dd> |
| 1280 |
</dl> |
| 1281 |
<hr /> |
| 1282 |
Methods defined here:<br /> |
| 1283 |
<dl> |
| 1284 |
<dt><a name="SPARQLQuery-__init__" id="SPARQLQuery-__init__"><strong>__init__</strong></a>(self, querystring, base_uri<font color="#909090">=None</font>)</dt> |
| 1285 |
</dl> |
| 1286 |
<hr /> |
| 1287 |
Methods inherited from <a href="#Query">Query</a>:<br /> |
| 1288 |
<dl> |
| 1289 |
<dt><a name="SPARQLQuery-__del__" id="SPARQLQuery-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1290 |
</dl> |
| 1291 |
<dl> |
| 1292 |
<dt><a name="SPARQLQuery-execute" id="SPARQLQuery-execute"><strong>execute</strong></a>(self, model)</dt> |
| 1293 |
</dl> |
| 1294 |
<dl> |
| 1295 |
<dt><a name="SPARQLQuery-get_limit" id="SPARQLQuery-get_limit"><strong>get_limit</strong></a>(self)</dt> |
| 1296 |
</dl> |
| 1297 |
<dl> |
| 1298 |
<dt><a name="SPARQLQuery-get_offset" id="SPARQLQuery-get_offset"><strong>get_offset</strong></a>(self)</dt> |
| 1299 |
</dl> |
| 1300 |
<dl> |
| 1301 |
<dt><a name="SPARQLQuery-set_limit" id="SPARQLQuery-set_limit"><strong>set_limit</strong></a>(self, limit)</dt> |
| 1302 |
</dl> |
| 1303 |
<dl> |
| 1304 |
<dt><a name="SPARQLQuery-set_offset" id="SPARQLQuery-set_offset"><strong>set_offset</strong></a>(self, offset)</dt> |
| 1305 |
</dl> |
| 1306 |
<hr /> |
| 1307 |
Data descriptors inherited from <a href="#Query">Query</a>:<br /> |
| 1308 |
<dl> |
| 1309 |
<dt><strong>__dict__</strong></dt> |
| 1310 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1311 |
</dl> |
| 1312 |
<dl> |
| 1313 |
<dt><strong>__weakref__</strong></dt> |
| 1314 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1315 |
</dl> |
| 1316 |
</td> |
| 1317 |
</tr> |
| 1318 |
</table> |
| 1319 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1320 |
<tr bgcolor="#FFC8D8"> |
| 1321 |
<td colspan="3" valign="bottom"> <br /> |
| 1322 |
<font color="#000000" face="helvetica, arial"><a name="Serializer" id="Serializer">class <strong>Serializer</strong></a>(__builtin__.object)</font></td> |
| 1323 |
</tr> |
| 1324 |
<tr bgcolor="#FFC8D8"> |
| 1325 |
<td rowspan="2"><tt> </tt></td> |
| 1326 |
<td colspan="2"><tt>Redland Syntax <a href="#Serializer">Serializer</a> Class<br /> |
| 1327 |
<br /> |
| 1328 |
import RDF<br /> |
| 1329 |
ser1=RDF.<a href="#Serializer">Serializer</a>()<br /> |
| 1330 |
<br /> |
| 1331 |
ser2=RDF.<a href="#Serializer">Serializer</a>(mime_type="application/rdf+xml")<br /> |
| 1332 |
<br /> |
| 1333 |
ser3=RDF.<a href="#Serializer">Serializer</a>(name="ntriples")<br /> |
| 1334 |
<br /> |
| 1335 |
A class for turning a <a href="#Model">Model</a> into a syntax serialization (at present<br /> |
| 1336 |
only to local files).<br /> |
| 1337 |
</tt></td> |
| 1338 |
</tr> |
| 1339 |
<tr> |
| 1340 |
<td> </td> |
| 1341 |
<td width="100%">Methods defined here:<br /> |
| 1342 |
<dl> |
| 1343 |
<dt><a name="Serializer-__del__" id="Serializer-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1344 |
</dl> |
| 1345 |
<dl> |
| 1346 |
<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> |
| 1347 |
<dd><tt>Create an RDF <a href="#Serializer">Serializer</a> (constructor).<br /> |
| 1348 |
<br /> |
| 1349 |
The arguments name, mime_type and uri are all optional and<br /> |
| 1350 |
when omitted the default serialization syntax is used. If<br /> |
| 1351 |
any arguments are given, they must all match for an appropriate<br /> |
| 1352 |
syntax to be chosen. For example, RDF/XML has a MIME type of<br /> |
| 1353 |
'application/rdf+xml' so this can be given with the mime_type<br /> |
| 1354 |
argument, however the N-Triples has none, so the 'ntriples' name<br /> |
| 1355 |
must be used. Most syntaxes have URIs.</tt></dd> |
| 1356 |
</dl> |
| 1357 |
<dl> |
| 1358 |
<dt><a name="Serializer-get_feature" id="Serializer-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 1359 |
<dd><tt>Return the value of <a href="#Serializer">Serializer</a> feature URI uri</tt></dd> |
| 1360 |
</dl> |
| 1361 |
<dl> |
| 1362 |
<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> |
| 1363 |
<dd><tt>Serialize to filename name the <a href="#Model">Model</a> model using the<br /> |
| 1364 |
optional base URI.</tt></dd> |
| 1365 |
</dl> |
| 1366 |
<dl> |
| 1367 |
<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> |
| 1368 |
<dd><tt>Serialize to a string using the optional base URI.</tt></dd> |
| 1369 |
</dl> |
| 1370 |
<dl> |
| 1371 |
<dt><a name="Serializer-serialize_stream_to_string" id="Serializer-serialize_stream_to_string"><strong>serialize_stream_to_string</strong></a>(self, stream, base_uri<font color="#909090">=None</font>)</dt> |
| 1372 |
<dd><tt>Serialize a stream to a string using the optional base URI.</tt></dd> |
| 1373 |
</dl> |
| 1374 |
<dl> |
| 1375 |
<dt><a name="Serializer-set_feature" id="Serializer-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 1376 |
<dd><tt>Set the value of <a href="#Serializer">Serializer</a> feature URI uri.</tt></dd> |
| 1377 |
</dl> |
| 1378 |
<dl> |
| 1379 |
<dt><a name="Serializer-set_namespace" id="Serializer-set_namespace"><strong>set_namespace</strong></a>(self, prefix, uri)</dt> |
| 1380 |
<dd><tt>Set a namespace prefix and URI for the <a href="#Serializer">Serializer</a> to use.</tt></dd> |
| 1381 |
</dl> |
| 1382 |
<hr /> |
| 1383 |
Data descriptors defined here:<br /> |
| 1384 |
<dl> |
| 1385 |
<dt><strong>__dict__</strong></dt> |
| 1386 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1387 |
</dl> |
| 1388 |
<dl> |
| 1389 |
<dt><strong>__weakref__</strong></dt> |
| 1390 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1391 |
</dl> |
| 1392 |
</td> |
| 1393 |
</tr> |
| 1394 |
</table> |
| 1395 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1396 |
<tr bgcolor="#FFC8D8"> |
| 1397 |
<td colspan="3" valign="bottom"> <br /> |
| 1398 |
<font color="#000000" face="helvetica, arial"><a name="Statement" id="Statement">class <strong>Statement</strong></a>(__builtin__.object)</font></td> |
| 1399 |
</tr> |
| 1400 |
<tr bgcolor="#FFC8D8"> |
| 1401 |
<td rowspan="2"><tt> </tt></td> |
| 1402 |
<td colspan="2"><tt>Redland <a href="#Statement">Statement</a> (triple) class. The main means of manipulating<br /> |
| 1403 |
statements is by the subject, predicate and object properties.<br /> |
| 1404 |
<br /> |
| 1405 |
import RDF<br /> |
| 1406 |
statement1 = RDF.<a href="#Statement">Statement</a>(node1, node2, node3)<br /> |
| 1407 |
statement2 = RDF.<a href="#Statement">Statement</a>(statement = statement1)<br /> |
| 1408 |
<br /> |
| 1409 |
if statement2.subject.is_resource():<br /> |
| 1410 |
print "statement2 subject is URI ",statement2.subject.uri<br /> |
| 1411 |
<br /> |
| 1412 |
statement.object = <a href="#Node">Node</a>("hello, world")<br /> |
| 1413 |
</tt></td> |
| 1414 |
</tr> |
| 1415 |
<tr> |
| 1416 |
<td> </td> |
| 1417 |
<td width="100%">Methods defined here:<br /> |
| 1418 |
<dl> |
| 1419 |
<dt><a name="Statement-__del__" id="Statement-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1420 |
</dl> |
| 1421 |
<dl> |
| 1422 |
<dt><a name="Statement-__eq__" id="Statement-__eq__"><strong>__eq__</strong></a>(self, other)</dt> |
| 1423 |
<dd><tt>Equality of an RDF <a href="#Statement">Statement</a> compared to another RDF <a href="#Statement">Statement</a>.</tt></dd> |
| 1424 |
</dl> |
| 1425 |
<dl> |
| 1426 |
<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> |
| 1427 |
<dd><tt>Constructor for <a href="#Statement">Statement</a>.<br /> |
| 1428 |
<br /> |
| 1429 |
Create a <a href="#Statement">Statement</a> from three <a href="#Node">Node</a> objects.<br /> |
| 1430 |
<br /> |
| 1431 |
s1 = RDF.<a href="#Statement">Statement</a>(subjnode, prednode, objnode)<br /> |
| 1432 |
<br /> |
| 1433 |
A <a href="#Node">Node</a> argument can be replaced with <a href="#Uri">Uri</a> or string to<br /> |
| 1434 |
shortcut <a href="#Node">Node</a> creation.<br /> |
| 1435 |
<br /> |
| 1436 |
s2 = RDF.<a href="#Statement">Statement</a>(<a href="#Uri">Uri</a>(""), <a href="#Uri">Uri</a>(""), "baz")<br /> |
| 1437 |
<br /> |
| 1438 |
Copy an existing <a href="#Statement">Statement</a> s1.<br /> |
| 1439 |
<br /> |
| 1440 |
s3 = RDF.<a href="#Statement">Statement</a>(statement=s1)</tt></dd> |
| 1441 |
</dl> |
| 1442 |
<dl> |
| 1443 |
<dt><a name="Statement-__ne__" id="Statement-__ne__"><strong>__ne__</strong></a>(self, other)</dt> |
| 1444 |
<dd><tt>Inequality of an RDF <a href="#Statement">Statement</a> compared to another RDF <a href="#Statement">Statement</a>.</tt></dd> |
| 1445 |
</dl> |
| 1446 |
<dl> |
| 1447 |
<dt><a name="Statement-__str__" id="Statement-__str__"><strong>__str__</strong></a>(self)</dt> |
| 1448 |
</dl> |
| 1449 |
<dl> |
| 1450 |
<dt><a name="Statement-__unicode__" id="Statement-__unicode__"><strong>__unicode__</strong></a>(self)</dt> |
| 1451 |
</dl> |
| 1452 |
<dl> |
| 1453 |
<dt><a name="Statement-matches" id="Statement-matches"><strong>matches</strong></a>(self, other)</dt> |
| 1454 |
<dd><tt>Comparison of this potentially incomplete RDF <a href="#Statement">Statement</a> compared to another RDF <a href="#Statement">Statement</a>.</tt></dd> |
| 1455 |
</dl> |
| 1456 |
<hr /> |
| 1457 |
Data descriptors defined here:<br /> |
| 1458 |
<dl> |
| 1459 |
<dt><strong>__dict__</strong></dt> |
| 1460 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1461 |
</dl> |
| 1462 |
<dl> |
| 1463 |
<dt><strong>__weakref__</strong></dt> |
| 1464 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1465 |
</dl> |
| 1466 |
<dl> |
| 1467 |
<dt><strong>object</strong></dt> |
| 1468 |
<dd><tt>The object node of the statement.</tt></dd> |
| 1469 |
</dl> |
| 1470 |
<dl> |
| 1471 |
<dt><strong>predicate</strong></dt> |
| 1472 |
<dd><tt>The predicate node of the statement.</tt></dd> |
| 1473 |
</dl> |
| 1474 |
<dl> |
| 1475 |
<dt><strong>subject</strong></dt> |
| 1476 |
<dd><tt>The subject node of the statement.</tt></dd> |
| 1477 |
</dl> |
| 1478 |
</td> |
| 1479 |
</tr> |
| 1480 |
</table> |
| 1481 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1482 |
<tr bgcolor="#FFC8D8"> |
| 1483 |
<td colspan="3" valign="bottom"> <br /> |
| 1484 |
<font color="#000000" face="helvetica, arial"><a name="Storage" id="Storage">class <strong>Storage</strong></a>(__builtin__.object)</font></td> |
| 1485 |
</tr> |
| 1486 |
<tr bgcolor="#FFC8D8"> |
| 1487 |
<td rowspan="2"><tt> </tt></td> |
| 1488 |
<td colspan="2"><tt>Redland <a href="#Statement">Statement</a> <a href="#Storage">Storage</a> class<br /> |
| 1489 |
<br /> |
| 1490 |
import RDF<br /> |
| 1491 |
storage=RDF.<a href="#Storage">Storage</a>(storage_name="memory")<br /> |
| 1492 |
<br /> |
| 1493 |
The Redland abstraction for storing RDF graphs as Statements.<br /> |
| 1494 |
<br /> |
| 1495 |
There are no user methods (can only be constructed).<br /> |
| 1496 |
<br /> |
| 1497 |
You should normally use a specialized class such as <a href="#MemoryStorage">MemoryStorage</a> or<br /> |
| 1498 |
<a href="#HashStorage">HashStorage</a> in preference to this class.<br /> |
| 1499 |
</tt></td> |
| 1500 |
</tr> |
| 1501 |
<tr> |
| 1502 |
<td> </td> |
| 1503 |
<td width="100%">Methods defined here:<br /> |
| 1504 |
<dl> |
| 1505 |
<dt><a name="Storage-__del__" id="Storage-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1506 |
</dl> |
| 1507 |
<dl> |
| 1508 |
<dt><a name="Storage-__init__" id="Storage-__init__"><strong>__init__</strong></a>(self, **args)</dt> |
| 1509 |
<dd><tt>Create an RDF <a href="#Storage">Storage</a> (constructor).<br /> |
| 1510 |
<br /> |
| 1511 |
Create a new RDF <a href="#Storage">Storage</a> using any of these forms<br /> |
| 1512 |
<br /> |
| 1513 |
s1=RDF.<a href="#Storage">Storage</a>(storage_name="name",options_string="")<br /> |
| 1514 |
<br /> |
| 1515 |
Create a <a href="#Storage">Storage</a> of the given type. Currently the built in storage<br /> |
| 1516 |
names that are always present are 'memory', 'hashes', 'file' and<br /> |
| 1517 |
'uri'. 'bdb' is available when Sleepycat / BerkeleyDB is compiled<br /> |
| 1518 |
in, 'mysql' when MySQL is compiled in, and 'sqlite' when SQLite is<br /> |
| 1519 |
compiled in. If storage_name is omitted, it defaults to 'memory'.<br /> |
| 1520 |
<br /> |
| 1521 |
The argument 'name' can be used when the storage needs a name<br /> |
| 1522 |
to operate, such as used for a filename or URI:<br /> |
| 1523 |
<br /> |
| 1524 |
s1=RDF.<a href="#Storage">Storage</a>(storage_name="file", name='/filename',options_string="")<br /> |
| 1525 |
<br /> |
| 1526 |
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 /> |
| 1527 |
<br /> |
| 1528 |
<br /> |
| 1529 |
The required argument options_string allows additional store-specific<br /> |
| 1530 |
options to be given, some of which are required by certain stores.<br /> |
| 1531 |
This uses the following form:<br /> |
| 1532 |
<br /> |
| 1533 |
s3=RDF.<a href="#Storage">Storage</a>(storage_name="name", name='abc',<br /> |
| 1534 |
options_string="key1='value1', key2='value2', ...")<br /> |
| 1535 |
<br /> |
| 1536 |
for multiple key/value option pairs, option values are always<br /> |
| 1537 |
surrounded by single quotes.<br /> |
| 1538 |
<br /> |
| 1539 |
The common options are:<br /> |
| 1540 |
new - optional and takes a boolean value (default false)<br /> |
| 1541 |
If true, it deletes any existing store and creates a new one<br /> |
| 1542 |
otherwise if false (default) open an existing store.<br /> |
| 1543 |
<br /> |
| 1544 |
write - optional and takes a boolean value (default true)<br /> |
| 1545 |
If true (default) the <a href="#Storage">Storage</a> is opened read-write otherwise<br /> |
| 1546 |
if false the storage is opened read-only and for file-based<br /> |
| 1547 |
Storages or those with locks, may be opened with shared-readers.<br /> |
| 1548 |
<br /> |
| 1549 |
Some storage types have additional options:<br /> |
| 1550 |
<br /> |
| 1551 |
storage_name 'hashes' has options:<br /> |
| 1552 |
hash-type - the name of any hash type supported.<br /> |
| 1553 |
'memory' (default), 'file' hash types are always present. 'bdb' is<br /> |
| 1554 |
available when BerkeleyDB is compiled in,<br /> |
| 1555 |
dir - the directory name to create the files in (default '.')<br /> |
| 1556 |
mode - the file creation mode (default 0644 octal)<br /> |
| 1557 |
<br /> |
| 1558 |
storage_name 'mysql' has options:<br /> |
| 1559 |
host - required MySQL database hostname<br /> |
| 1560 |
port - optional MySQL database port (defaults to 3306)<br /> |
| 1561 |
database - required MySQL database name<br /> |
| 1562 |
user - required MySQL database user<br /> |
| 1563 |
password - required MySQL database password<br /> |
| 1564 |
<br /> |
| 1565 |
stoage name 'sqlite' has options:<br /> |
| 1566 |
synchronous - optional value off, normal or full<br /> |
| 1567 |
<br /> |
| 1568 |
The other form is:<br /> |
| 1569 |
s4=RDF.<a href="#Storage">Storage</a>(storage=s1)<br /> |
| 1570 |
Copy an existing <a href="#Storage">Storage</a> s1.<br /> |
| 1571 |
<br /> |
| 1572 |
<br /> |
| 1573 |
Note: there are convience classes to create a memory storage<br /> |
| 1574 |
s5=RDF.<a href="#MemoryStorage">MemoryStorage</a>()<br /> |
| 1575 |
<br /> |
| 1576 |
and Hash storage:<br /> |
| 1577 |
# memory hash<br /> |
| 1578 |
s6=RDF.<a href="#HashStorage">HashStorage</a>('abc')<br /> |
| 1579 |
<br /> |
| 1580 |
# specified bdb hash stored in files named 'def'*<br /> |
| 1581 |
s7=RDF.<a href="#HashStorage">HashStorage</a>('def', options="hash-type='bdb'")</tt></dd> |
| 1582 |
</dl> |
| 1583 |
<hr /> |
| 1584 |
Data descriptors defined here:<br /> |
| 1585 |
<dl> |
| 1586 |
<dt><strong>__dict__</strong></dt> |
| 1587 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1588 |
</dl> |
| 1589 |
<dl> |
| 1590 |
<dt><strong>__weakref__</strong></dt> |
| 1591 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1592 |
</dl> |
| 1593 |
</td> |
| 1594 |
</tr> |
| 1595 |
</table> |
| 1596 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1597 |
<tr bgcolor="#FFC8D8"> |
| 1598 |
<td colspan="3" valign="bottom"> <br /> |
| 1599 |
<font color="#000000" face="helvetica, arial"><a name="Stream" id="Stream">class <strong>Stream</strong></a>(__builtin__.object)</font></td> |
| 1600 |
</tr> |
| 1601 |
<tr bgcolor="#FFC8D8"> |
| 1602 |
<td rowspan="2"><tt> </tt></td> |
| 1603 |
<td colspan="2"><tt>Redland <a href="#Statement">Statement</a> <a href="#Stream">Stream</a> class<br /> |
| 1604 |
<br /> |
| 1605 |
A class encapsulating a sequence of Statements, such as<br /> |
| 1606 |
those returned from a <a href="#Model">Model</a> query. Can be used as a Python<br /> |
| 1607 |
sequence.<br /> |
| 1608 |
<br /> |
| 1609 |
stream = model.find_statements(query_statement)<br /> |
| 1610 |
for statement in stream:<br /> |
| 1611 |
# do whatever with 'statement'<br /> |
| 1612 |
# note it is shared and will go out of scope, so you must<br /> |
| 1613 |
# copy it if you want it to stay around<br /> |
| 1614 |
<br /> |
| 1615 |
You should not normally find yourself needing to use this<br /> |
| 1616 |
class explicitly.<br /> |
| 1617 |
</tt></td> |
| 1618 |
</tr> |
| 1619 |
<tr> |
| 1620 |
<td> </td> |
| 1621 |
<td width="100%">Methods defined here:<br /> |
| 1622 |
<dl> |
| 1623 |
<dt><a name="Stream-__del__" id="Stream-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1624 |
</dl> |
| 1625 |
<dl> |
| 1626 |
<dt><a name="Stream-__init__" id="Stream-__init__"><strong>__init__</strong></a>(self, object, creator)</dt> |
| 1627 |
<dd><tt>Create an RDF <a href="#Stream">Stream</a> (constructor).</tt></dd> |
| 1628 |
</dl> |
| 1629 |
<dl> |
| 1630 |
<dt><a name="Stream-__iter__" id="Stream-__iter__"><strong>__iter__</strong></a>(self)</dt> |
| 1631 |
</dl> |
| 1632 |
<dl> |
| 1633 |
<dt><a name="Stream-__next__" id="Stream-__next__"><strong>__next__</strong></a>(self)</dt> |
| 1634 |
<dd><tt>Move to the next <a href="#Statement">Statement</a> on the <a href="#Stream">Stream</a></tt></dd> |
| 1635 |
</dl> |
| 1636 |
<dl> |
| 1637 |
<dt><a name="Stream-context" id="Stream-context"><strong>context</strong></a>(self)</dt> |
| 1638 |
<dd><tt>Return the context <a href="#Node">Node</a> of the current object on the <a href="#Stream">Stream</a></tt></dd> |
| 1639 |
</dl> |
| 1640 |
<dl> |
| 1641 |
<dt><a name="Stream-context_iter" id="Stream-context_iter"><strong>context_iter</strong></a>(self)</dt> |
| 1642 |
<dd><tt>Return an iterator over this stream that<br /> |
| 1643 |
returns (stream, context) tuples each time it is iterated.<br /> |
| 1644 |
DEPRECATED. Instead use the context-aware method appropriate,<br /> |
| 1645 |
e.g. <a href="#Model">Model</a>.find_statements_context() or <a href="#Model">Model</a>.as_stream_context()</tt></dd> |
| 1646 |
</dl> |
| 1647 |
<dl> |
| 1648 |
<dt><a name="Stream-current" id="Stream-current"><strong>current</strong></a>(self)</dt> |
| 1649 |
<dd><tt>Return the current <a href="#Statement">Statement</a> on the <a href="#Stream">Stream</a></tt></dd> |
| 1650 |
</dl> |
| 1651 |
<dl> |
| 1652 |
<dt><a name="Stream-end" id="Stream-end"><strong>end</strong></a>(self)</dt> |
| 1653 |
<dd><tt>Return true if the stream is exhausted</tt></dd> |
| 1654 |
</dl> |
| 1655 |
<dl> |
| 1656 |
<dt><a name="Stream-next" id="Stream-next"><strong>next</strong></a> = <a href="#Stream-__next__">__next__</a>(self)</dt> |
| 1657 |
</dl> |
| 1658 |
<hr /> |
| 1659 |
Data descriptors defined here:<br /> |
| 1660 |
<dl> |
| 1661 |
<dt><strong>__dict__</strong></dt> |
| 1662 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1663 |
</dl> |
| 1664 |
<dl> |
| 1665 |
<dt><strong>__weakref__</strong></dt> |
| 1666 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1667 |
</dl> |
| 1668 |
</td> |
| 1669 |
</tr> |
| 1670 |
</table> |
| 1671 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1672 |
<tr bgcolor="#FFC8D8"> |
| 1673 |
<td colspan="3" valign="bottom"> <br /> |
| 1674 |
<font color="#000000" face="helvetica, arial"><a name="TurtleParser" id="TurtleParser">class <strong>TurtleParser</strong></a>(<a href="#Parser">Parser</a>)</font></td> |
| 1675 |
</tr> |
| 1676 |
<tr bgcolor="#FFC8D8"> |
| 1677 |
<td rowspan="2"><tt> </tt></td> |
| 1678 |
<td colspan="2"><tt>Redland Turtle <a href="#Parser">Parser</a> class<br /> |
| 1679 |
<br /> |
| 1680 |
import RDF<br /> |
| 1681 |
parser=RDF.<a href="#TurtleParser">TurtleParser</a>()<br /> |
| 1682 |
</tt></td> |
| 1683 |
</tr> |
| 1684 |
<tr> |
| 1685 |
<td> </td> |
| 1686 |
<td width="100%"> |
| 1687 |
<dl> |
| 1688 |
<dt>Method resolution order:</dt> |
| 1689 |
<dd><a href="#TurtleParser">TurtleParser</a></dd> |
| 1690 |
<dd><a href="#Parser">Parser</a></dd> |
| 1691 |
<dd>__builtin__.object</dd> |
| 1692 |
</dl> |
| 1693 |
<hr /> |
| 1694 |
Methods defined here:<br /> |
| 1695 |
<dl> |
| 1696 |
<dt><a name="TurtleParser-__init__" id="TurtleParser-__init__"><strong>__init__</strong></a>(self)</dt> |
| 1697 |
</dl> |
| 1698 |
<hr /> |
| 1699 |
Methods inherited from <a href="#Parser">Parser</a>:<br /> |
| 1700 |
<dl> |
| 1701 |
<dt><a name="TurtleParser-__del__" id="TurtleParser-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1702 |
</dl> |
| 1703 |
<dl> |
| 1704 |
<dt><a name="TurtleParser-get_feature" id="TurtleParser-get_feature"><strong>get_feature</strong></a>(self, uri)</dt> |
| 1705 |
<dd><tt>Return the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri</tt></dd> |
| 1706 |
</dl> |
| 1707 |
<dl> |
| 1708 |
<dt><a name="TurtleParser-namespaces_seen" id="TurtleParser-namespaces_seen"><strong>namespaces_seen</strong></a>(self)</dt> |
| 1709 |
<dd><tt>Get a dictionary of prefix/URI pairs for namespaces seen during parsing.</tt></dd> |
| 1710 |
</dl> |
| 1711 |
<dl> |
| 1712 |
<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> |
| 1713 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content at<br /> |
| 1714 |
a URI for the optional base URI or None if the parsing fails.<br /> |
| 1715 |
<br /> |
| 1716 |
(This depends on what URI support raptor provides to redland)<br /> |
| 1717 |
<br /> |
| 1718 |
for statement in parser.<a href="#TurtleParser-parse_as_stream">parse_as_stream</a>(""):<br /> |
| 1719 |
print statement</tt></dd> |
| 1720 |
</dl> |
| 1721 |
<dl> |
| 1722 |
<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> |
| 1723 |
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content at the URI, for<br /> |
| 1724 |
the optional base URI. Returns a boolean success or failure.<br /> |
| 1725 |
<br /> |
| 1726 |
If handler is given, an error handler with the signature<br /> |
| 1727 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 1728 |
is called.<br /> |
| 1729 |
<br /> |
| 1730 |
parser.<a href="#TurtleParser-parse_into_model">parse_into_model</a>(model, "file:./foo.rdf",<br /> |
| 1731 |
"http://example.com/foo.rdf")</tt></dd> |
| 1732 |
</dl> |
| 1733 |
<dl> |
| 1734 |
<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> |
| 1735 |
<dd><tt>Return a <a href="#Stream">Stream</a> of Statements from parsing the content in<br /> |
| 1736 |
string with the required base URI or None if the parsing fails.<br /> |
| 1737 |
<br /> |
| 1738 |
for statement in parser.<a href="#TurtleParser-parse_string_as_stream">parse_string_as_stream</a>(rdfstring, base_uri):<br /> |
| 1739 |
print statement</tt></dd> |
| 1740 |
</dl> |
| 1741 |
<dl> |
| 1742 |
<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> |
| 1743 |
<dd><tt>Parse into the <a href="#Model">Model</a> model from the content string<br /> |
| 1744 |
with the required base URI. Returns a boolean success or failure.<br /> |
| 1745 |
<br /> |
| 1746 |
If handler is given, an error handler with the signature<br /> |
| 1747 |
def handler(code, level, facility, message, line, column, byte, file, uri)<br /> |
| 1748 |
is called.</tt></dd> |
| 1749 |
</dl> |
| 1750 |
<dl> |
| 1751 |
<dt><a name="TurtleParser-set_feature" id="TurtleParser-set_feature"><strong>set_feature</strong></a>(self, uri, value)</dt> |
| 1752 |
<dd><tt>Set the <a href="#Node">Node</a> value of <a href="#Parser">Parser</a> feature URI uri.</tt></dd> |
| 1753 |
</dl> |
| 1754 |
<dl> |
| 1755 |
<dt><a name="TurtleParser-set_uri_filter" id="TurtleParser-set_uri_filter"><strong>set_uri_filter</strong></a>(self, filter)</dt> |
| 1756 |
<dd><tt>Set a function for rejecting retrieval of URIs seen during parsing.<br /> |
| 1757 |
<br /> |
| 1758 |
Return False or 0 to not reject the URI<br /> |
| 1759 |
<br /> |
| 1760 |
def reject(uri):<br /> |
| 1761 |
if "bad" == uri:<br /> |
| 1762 |
return True<br /> |
| 1763 |
return False<br /> |
| 1764 |
<br /> |
| 1765 |
parser.<a href="#TurtleParser-set_uri_filter">set_uri_filter</a>(reject)</tt></dd> |
| 1766 |
</dl> |
| 1767 |
<hr /> |
| 1768 |
Data descriptors inherited from <a href="#Parser">Parser</a>:<br /> |
| 1769 |
<dl> |
| 1770 |
<dt><strong>__dict__</strong></dt> |
| 1771 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1772 |
</dl> |
| 1773 |
<dl> |
| 1774 |
<dt><strong>__weakref__</strong></dt> |
| 1775 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1776 |
</dl> |
| 1777 |
</td> |
| 1778 |
</tr> |
| 1779 |
</table> |
| 1780 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1781 |
<tr bgcolor="#FFC8D8"> |
| 1782 |
<td colspan="3" valign="bottom"> <br /> |
| 1783 |
<font color="#000000" face="helvetica, arial"><a name="Uri" id="Uri">class <strong>Uri</strong></a>(__builtin__.object)</font></td> |
| 1784 |
</tr> |
| 1785 |
<tr bgcolor="#FFC8D8"> |
| 1786 |
<td rowspan="2"><tt> </tt></td> |
| 1787 |
<td colspan="2"><tt>Redland URI Class<br /> |
| 1788 |
<br /> |
| 1789 |
import RDF<br /> |
| 1790 |
uri1 = RDF.<a href="#Uri">Uri</a>("http://example.com/")<br /> |
| 1791 |
uri2 = RDF.<a href="#Uri">Uri</a>(uri1)<br /> |
| 1792 |
</tt></td> |
| 1793 |
</tr> |
| 1794 |
<tr> |
| 1795 |
<td> </td> |
| 1796 |
<td width="100%">Methods defined here:<br /> |
| 1797 |
<dl> |
| 1798 |
<dt><a name="Uri-__del__" id="Uri-__del__"><strong>__del__</strong></a>(self)</dt> |
| 1799 |
</dl> |
| 1800 |
<dl> |
| 1801 |
<dt><a name="Uri-__eq__" id="Uri-__eq__"><strong>__eq__</strong></a>(self, other)</dt> |
| 1802 |
<dd><tt>Equality of RDF URI to another RDF URI.</tt></dd> |
| 1803 |
</dl> |
| 1804 |
<dl> |
| 1805 |
<dt><a name="Uri-__hash__" id="Uri-__hash__"><strong>__hash__</strong></a>(self)</dt> |
| 1806 |
</dl> |
| 1807 |
<dl> |
| 1808 |
<dt><a name="Uri-__init__" id="Uri-__init__"><strong>__init__</strong></a>(self, arg<font color="#909090">=None</font>, **args)</dt> |
| 1809 |
<dd><tt>Create an RDF URI (constructor).<br /> |
| 1810 |
<br /> |
| 1811 |
Creates a new RDF URI from either of the following forms:<br /> |
| 1812 |
<br /> |
| 1813 |
uri1 = RDF.<a href="#Uri">Uri</a>("http://example.com/")<br /> |
| 1814 |
<br /> |
| 1815 |
Create a URI from the given string.<br /> |
| 1816 |
<br /> |
| 1817 |
uri2 = RDF.<a href="#Uri">Uri</a>(uri1)<br /> |
| 1818 |
<br /> |
| 1819 |
Copy an existing URI uri1.</tt></dd> |
| 1820 |
</dl> |
| 1821 |
<dl> |
| 1822 |
<dt><a name="Uri-__ne__" id="Uri-__ne__"><strong>__ne__</strong></a>(self, other)</dt> |
| 1823 |
<dd><tt>Inequality of RDF URI to another RDF URI.</tt></dd> |
| 1824 |
</dl> |
| 1825 |
<dl> |
| 1826 |
<dt><a name="Uri-__str__" id="Uri-__str__"><strong>__str__</strong></a>(self)</dt> |
| 1827 |
<dd><tt>Get a string representation of an RDF URI.</tt></dd> |
| 1828 |
</dl> |
| 1829 |
<dl> |
| 1830 |
<dt><a name="Uri-__unicode__" id="Uri-__unicode__"><strong>__unicode__</strong></a>(self)</dt> |
| 1831 |
<dd><tt>Get a Unicode string representation of an RDF URI.</tt></dd> |
| 1832 |
</dl> |
| 1833 |
<hr /> |
| 1834 |
Data descriptors defined here:<br /> |
| 1835 |
<dl> |
| 1836 |
<dt><strong>__dict__</strong></dt> |
| 1837 |
<dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| 1838 |
</dl> |
| 1839 |
<dl> |
| 1840 |
<dt><strong>__weakref__</strong></dt> |
| 1841 |
<dd><tt>list of weak references to the object (if defined)</tt></dd> |
| 1842 |
</dl> |
| 1843 |
</td> |
| 1844 |
</tr> |
| 1845 |
</table> |
| 1846 |
</td> |
| 1847 |
</tr> |
| 1848 |
</table> |
| 1849 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1850 |
<tr bgcolor="#EEAA77"> |
| 1851 |
<td colspan="3" valign="bottom"> <br /> |
| 1852 |
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Functions</strong></big></font></td> |
| 1853 |
</tr> |
| 1854 |
<tr> |
| 1855 |
<td bgcolor="#EEAA77"><tt> </tt></td> |
| 1856 |
<td> </td> |
| 1857 |
<td width="100%"> |
| 1858 |
<dl> |
| 1859 |
<dt><a id="debug" name="debug"><strong>debug</strong></a>(value<font color="#909090">=None</font>)</dt> |
| 1860 |
<dd><tt>Get/set Redland debugging output status.<br /> |
| 1861 |
<br /> |
| 1862 |
RDF.debug (1) # enable debugging<br /> |
| 1863 |
if RDF.debug(): # test for debug mode</tt></dd> |
| 1864 |
</dl> |
| 1865 |
</td> |
| 1866 |
</tr> |
| 1867 |
</table> |
| 1868 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1869 |
<tr bgcolor="#55AA55"> |
| 1870 |
<td colspan="3" valign="bottom"> <br /> |
| 1871 |
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Data</strong></big></font></td> |
| 1872 |
</tr> |
| 1873 |
<tr> |
| 1874 |
<td bgcolor="#55AA55"><tt> </tt></td> |
| 1875 |
<td> </td> |
| 1876 |
<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 /> |
| 1877 |
<strong>__author__</strong> = 'Dave Beckett - http://www.dajobe.org/, Edd Dumbi...sefulinc.com> and Matt Biddulph <[email protected]>'<br /> |
| 1878 |
<strong>__date__</strong> = '$Date$'<br /> |
| 1879 |
<strong>__version__</strong> = '1.1'</td> |
| 1880 |
</tr> |
| 1881 |
</table> |
| 1882 |
<table width="100%" cellspacing="0" cellpadding="2" border="0" summary="section"> |
| 1883 |
<tr bgcolor="#7799EE"> |
| 1884 |
<td colspan="3" valign="bottom"> <br /> |
| 1885 |
<font color="#FFFFFF" face="helvetica, arial"><big><strong>Author</strong></big></font></td> |
| 1886 |
</tr> |
| 1887 |
<tr> |
| 1888 |
<td bgcolor="#7799EE"><tt> </tt></td> |
| 1889 |
<td> </td> |
| 1890 |
<td width="100%">Dave Beckett - <a href="http://www.dajobe.org/">http://www.dajobe.org/</a>, Edd Dumbill <[email protected]> and Matt Biddulph <[email protected]></td> |
| 1891 |
</tr> |
| 1892 |
</table> |
| 1893 |
<hr /> |
| 1894 |
|
| 1895 |
<p>(C) Copyright 2000-2014 <a href="http://www.dajobe.org/">Dave Beckett</a>, Copyright 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 1896 |
|
| 1897 |
</body> |
| 1898 |
</html> |