forked from linkeddata/swap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotation3.html
525 lines (414 loc) · 32.7 KB
/
notation3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module notation3</title>
<style type="text/css"><!--
TT { font-family: lucidatypewriter, lucida console, courier }
--></style></head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>notation3</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/devel/WWW/2000/10/swap/notation3.py">/devel/WWW/2000/10/swap/notation3.py</a></font></td></tr></table>
<p><tt>$Id$<br>
<br>
<br>
This module implements basic sources and sinks for RDF data.<br>
It defines a stream interface for such data.<br>
It has a command line interface, can work as a web query engine,<br>
and has built in <a href="#-test">test</a>(), all of which demosntrate how it is used.<br>
<br>
To make a new RDF processor, subclass <a href="RDFSink.html#RDFSink">RDFSink</a>.<br>
<br>
See also:<br>
<br>
Notation 3<br>
<a href="http://www.w3.org/DesignIssues/Notation3">http://www.w3.org/DesignIssues/Notation3</a><br>
<br>
Closed World Machine - and RDF Processor<br>
http;//www.w3.org/2000/10/swap/cwm<br>
<br>
To DO: See also "@@" in comments<br>
<br>
Internationlization:<br>
- Decode incoming N3 file as unicode<br>
- Encode outgoing file<br>
- unicode \u (??) escapes in parse<br>
- unicode \u (??) escapes in string output<br>
<br>
Note currently unicode strings work in this code<br>
but fail when they are output into the python debugger<br>
interactive window.<br>
<br>
______________________________________________<br>
<br>
Module originally by Dan Connolly, includeing notation3<br>
parser and RDF generator. TimBL added RDF stream model<br>
and N3 generation.<br>
<br>
DWC:<br>
oops... I'm not doing qname expansion as described<br>
there (i.e. adding a # if it's not already there).<br>
<br>
I allow unprefixed qnames, so not all barenames<br>
are keywords.<br>
<br>
---- hmmmm ... not expandable - a bit of a trap.<br>
<br>
I haven't done quoting yet.<br>
<br>
idea: migrate toward CSS notation?<br>
<br>
idea: use notation3 for wiki record keeping.</tt></p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="RDFSink.html">RDFSink</a><br>
<a href="StringIO.html">StringIO</a><br>
<a href="cgi.html">cgi</a><br>
<a href="codecs.html">codecs</a><br>
</td><td width="25%" valign=top><a href="diag.html">diag</a><br>
<a href="random.html">random</a><br>
<a href="re.html">re</a><br>
<a href="string.html">string</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
<a href="thing.html">thing</a><br>
<a href="time.html">time</a><br>
<a href="types.html">types</a><br>
</td><td width="25%" valign=top><a href="uripath.html">uripath</a><br>
<a href="urllib.html">urllib</a><br>
</td></tr></table></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="RDFSink.html#RDFSink">RDFSink.RDFSink</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="notation3.html#Reifier">Reifier</a>
</font></dt><dt><font face="helvetica, arial"><a href="notation3.html#ToN3">ToN3</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="notation3.html#SinkParser">SinkParser</a>
</font></dt><dt><font face="helvetica, arial"><a href="exceptions.html#SyntaxError">exceptions.SyntaxError</a>(<a href="exceptions.html#StandardError">exceptions.StandardError</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="notation3.html#BadSyntax">BadSyntax</a>
</font></dt></dl>
</dd>
</dl>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="BadSyntax">class <strong>BadSyntax</strong></a>(<a href="exceptions.html#SyntaxError">exceptions.SyntaxError</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2> </td></tr>
<tr><td> </td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="notation3.html#BadSyntax">BadSyntax</a></dd>
<dd><a href="exceptions.html#SyntaxError">exceptions.SyntaxError</a></dd>
<dd><a href="exceptions.html#StandardError">exceptions.StandardError</a></dd>
<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="BadSyntax-__init__"><strong>__init__</strong></a>(self, uri, lines, str, i, why)</dt></dl>
<dl><dt><a name="BadSyntax-__str__"><strong>__str__</strong></a>(self)</dt></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = None</dl>
<dl><dt><strong>__module__</strong> = 'notation3'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<hr>
Data and non-method functions inherited from <a href="exceptions.html#SyntaxError">exceptions.SyntaxError</a>:<br>
<dl><dt><strong>filename</strong> = None</dl>
<dl><dt><strong>lineno</strong> = None</dl>
<dl><dt><strong>msg</strong> = ''<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<dl><dt><strong>offset</strong> = None</dl>
<dl><dt><strong>print_file_and_line</strong> = None</dl>
<dl><dt><strong>text</strong> = None</dl>
<hr>
Methods inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br>
<dl><dt><a name="BadSyntax-__getitem__"><strong>__getitem__</strong></a>(...)</dt></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Reifier">class <strong>Reifier</strong></a>(<a href="RDFSink.html#RDFSink">RDFSink.RDFSink</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2> </td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Reifier-__init__"><strong>__init__</strong></a>(self, sink, inputContextURI, flat<font color="#909090">=0</font>, genPrefix<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-bind"><strong>bind</strong></a>(self, prefix, uri)</dt></dl>
<dl><dt><a name="Reifier-endDoc"><strong>endDoc</strong></a>(self, rootFormulaPair<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-makeComment"><strong>makeComment</strong></a>(self, str)</dt></dl>
<dl><dt><a name="Reifier-makeStatement"><strong>makeStatement</strong></a>(self, tuple, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-startDoc"><strong>startDoc</strong></a>(self)</dt></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = None</dl>
<dl><dt><strong>__module__</strong> = 'notation3'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<hr>
Methods inherited from <a href="RDFSink.html#RDFSink">RDFSink.RDFSink</a>:<br>
<dl><dt><a name="Reifier-checkNewId"><strong>checkNewId</strong></a>(self, uri)</dt><dd><tt>The store can override this to raise an exception if the<br>
id is not in fact new. This is useful because it is usfeul<br>
to generate IDs with useful diagnostic ways but this lays them<br>
open to possibly clashing in pathalogical cases.</tt></dd></dl>
<dl><dt><a name="Reifier-genId"><strong>genId</strong></a>(self)</dt></dl>
<dl><dt><a name="Reifier-newBlankNode"><strong>newBlankNode</strong></a>(self, context, uri<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-newExistential"><strong>newExistential</strong></a>(self, context, uri<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-newFormula"><strong>newFormula</strong></a>(self, uri<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-newLiteral"><strong>newLiteral</strong></a>(self, str, dt<font color="#909090">=None</font>, lang<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-newSymbol"><strong>newSymbol</strong></a>(self, uri)</dt></dl>
<dl><dt><a name="Reifier-newUniversal"><strong>newUniversal</strong></a>(self, context, uri<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Reifier-reopen"><strong>reopen</strong></a>(self)</dt><dd><tt>Un-End a document<br>
<br>
If you have added stuff to a document, thought you were done, and<br>
then want to add more, call this to get back into the sate that makeSatement<br>
is again acceptable. Remember to end the document again when done.</tt></dd></dl>
<dl><dt><a name="Reifier-setDefaultNamespace"><strong>setDefaultNamespace</strong></a>(self, uri)</dt><dd><tt>Pass on a binding hint for later use in output<br>
<br>
This really is just a hint. The parser calls this to pass on the default namespace which<br>
it came across, as this is a useful hint for a human readable prefix for output<br>
of the same namespace. Otherwise, output processors will have to invent<br>
or avoid useing namespaces, which will look ugly.</tt></dd></dl>
<dl><dt><a name="Reifier-setGenPrefix"><strong>setGenPrefix</strong></a>(self, genPrefix)</dt></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="SinkParser">class <strong>SinkParser</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2> </td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="SinkParser-__init__"><strong>__init__</strong></a>(self, sink, thisDoc, baseURI<font color="#909090">=None</font>, bindings<font color="#909090">={}</font>, genPrefix<font color="#909090">=''</font>, metaURI<font color="#909090">=None</font>, formulaURI<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt><dd><tt> note: namespace names should *not* end in #;<br>
the # will get added during qname processing</tt></dd></dl>
<dl><dt><a name="SinkParser-anonymousNode"><strong>anonymousNode</strong></a>(self, ln)</dt><dd><tt>Remember or generate a term for one of these _: anonymous nodes</tt></dd></dl>
<dl><dt><a name="SinkParser-bind"><strong>bind</strong></a>(self, qn, uri)</dt></dl>
<dl><dt><a name="SinkParser-checkDot"><strong>checkDot</strong></a>(self, str, i)</dt></dl>
<dl><dt><a name="SinkParser-directive"><strong>directive</strong></a>(self, str, i)</dt></dl>
<dl><dt><a name="SinkParser-directiveOrStatement"><strong>directiveOrStatement</strong></a>(self, str, h)</dt></dl>
<dl><dt><a name="SinkParser-endDoc"><strong>endDoc</strong></a>(self)</dt><dd><tt>Signal end fo document and stop parsing. returns formula</tt></dd></dl>
<dl><dt><a name="SinkParser-feed"><strong>feed</strong></a>(self, octets)</dt><dd><tt>Feed an octet stream tothe parser<br>
<br>
if <a href="#BadSyntax">BadSyntax</a> is raised, the string<br>
passed in the exception object is the<br>
remainder after any statements have been parsed.<br>
So if there is more data to feed to the<br>
parser, it should be straightforward to recover.</tt></dd></dl>
<dl><dt><a name="SinkParser-formula"><strong>formula</strong></a>(self)</dt></dl>
<dl><dt><a name="SinkParser-here"><strong>here</strong></a>(self, i)</dt><dd><tt>String generated from position in file<br>
<br>
This is for repeatability when refering people to bnodes in a document.<br>
This has diagnostic uses less formally, as it should point one to which <br>
bnode the arbitrary identifier actually is. It gives the<br>
line and character number of the '[' charcacter or path character<br>
which introduced the blank node. The first blank node is boringly _L1C1.</tt></dd></dl>
<dl><dt><a name="SinkParser-item"><strong>item</strong></a>(self, str, i, res)</dt></dl>
<dl><dt><a name="SinkParser-load"><strong>load</strong></a>(self, uri, baseURI<font color="#909090">=''</font>)</dt><dd><tt>Parses a document of the given URI and returns its top level formula</tt></dd></dl>
<dl><dt><a name="SinkParser-loadBuf"><strong>loadBuf</strong></a>(self, buf)</dt><dd><tt>Parses a buffer and returns its top level formula</tt></dd></dl>
<dl><dt><a name="SinkParser-loadStream"><strong>loadStream</strong></a>(self, stream)</dt></dl>
<dl><dt><a name="SinkParser-makeStatement"><strong>makeStatement</strong></a>(self, quadruple)</dt></dl>
<dl><dt><a name="SinkParser-node"><strong>node</strong></a>(self, str, i, res, subjectAlready<font color="#909090">=None</font>)</dt><dd><tt>Parse the <node> production.<br>
Space is now skipped once at the beginning<br>
instead of in multipe calls to <a href="#SinkParser-skipSpace">skipSpace</a>().</tt></dd></dl>
<dl><dt><a name="SinkParser-nodeOrLiteral"><strong>nodeOrLiteral</strong></a>(self, str, i, res)</dt></dl>
<dl><dt><a name="SinkParser-object"><strong>object</strong></a>(self, str, i, res)</dt></dl>
<dl><dt><a name="SinkParser-object_list"><strong>object_list</strong></a>(self, str, i, res)</dt></dl>
<dl><dt><a name="SinkParser-path"><strong>path</strong></a>(self, str, i, res)</dt><dd><tt>Parse the path production.</tt></dd></dl>
<dl><dt><a name="SinkParser-prop"><strong>prop</strong></a>(self, str, i, res)</dt></dl>
<dl><dt><a name="SinkParser-property_list"><strong>property_list</strong></a>(self, str, i, subj)</dt><dd><tt>Parse property list<br>
Leaves the terminating punctuation in the buffer</tt></dd></dl>
<dl><dt><a name="SinkParser-qname"><strong>qname</strong></a>(self, str, i, res)</dt><dd><tt>xyz:def -> ('xyz', 'def')<br>
If not in keywords and keywordsSet: def -> ('', 'def')<br>
:def -> ('', 'def')</tt></dd></dl>
<dl><dt><a name="SinkParser-skipSpace"><strong>skipSpace</strong></a>(self, str, i)</dt><dd><tt>Skip white space, newlines and comments.<br>
return -1 if EOF, else position of first non-ws character</tt></dd></dl>
<dl><dt><a name="SinkParser-startDoc"><strong>startDoc</strong></a>(self)</dt></dl>
<dl><dt><a name="SinkParser-statement"><strong>statement</strong></a>(self, str, i)</dt></dl>
<dl><dt><a name="SinkParser-strconst"><strong>strconst</strong></a>(self, str, i, delim)</dt><dd><tt>parse an N3 string constant delimited by delim.<br>
return index, val</tt></dd></dl>
<dl><dt><a name="SinkParser-subject"><strong>subject</strong></a>(self, str, i, res)</dt></dl>
<dl><dt><a name="SinkParser-tok"><strong>tok</strong></a>(self, tok, str, i)</dt><dd><tt>Check for keyword. Space must have been stripped on entry and<br>
we must not be at end of file.</tt></dd></dl>
<dl><dt><a name="SinkParser-uEscape"><strong>uEscape</strong></a>(self, str, i, startline)</dt></dl>
<dl><dt><a name="SinkParser-uri_ref2"><strong>uri_ref2</strong></a>(self, str, i, res)</dt><dd><tt>Generate uri from n3 representation.<br>
<br>
Note that the RDF convention of directly concatenating<br>
NS and local name is now used though I prefer inserting a '#'<br>
to make the namesapces look more like what XML folks expect.</tt></dd></dl>
<dl><dt><a name="SinkParser-variable"><strong>variable</strong></a>(self, str, i, res)</dt><dd><tt> ?abc -> <a href="#SinkParser-variable">variable</a>(:abc)</tt></dd></dl>
<dl><dt><a name="SinkParser-verb"><strong>verb</strong></a>(self, str, i, res)</dt><dd><tt> has _prop_<br>
is _prop_ of<br>
a<br>
=<br>
_prop_<br>
>- prop -><br>
<- prop -<<br>
_operator_</tt></dd></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = None</dl>
<dl><dt><strong>__module__</strong> = 'notation3'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="ToN3">class <strong>ToN3</strong></a>(<a href="RDFSink.html#RDFSink">RDFSink.RDFSink</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>Serializer output sink for N3<br>
<br>
keeps track of most recent subject and predicate reuses them.<br>
Adapted from Dan's ToRDFParser(Parser);<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ToN3-__init__"><strong>__init__</strong></a>(self, write, base<font color="#909090">=None</font>, genPrefix<font color="#909090">=None</font>, noLists<font color="#909090">=0</font>, quiet<font color="#909090">=0</font>, flags<font color="#909090">=''</font>)</dt></dl>
<dl><dt><a name="ToN3-_endStatement"><strong>_endStatement</strong></a>(self)</dt></dl>
<dl><dt><a name="ToN3-_makeSubjPred"><strong>_makeSubjPred</strong></a>(self, context, subj, pred)</dt></dl>
<dl><dt><a name="ToN3-_newline"><strong>_newline</strong></a>(self, extra<font color="#909090">=0</font>)</dt></dl>
<dl><dt><a name="ToN3-bind"><strong>bind</strong></a>(self, prefixString, uri)</dt><dd><tt> Just accepting a convention here</tt></dd></dl>
<dl><dt><a name="ToN3-endAnonymous"><strong>endAnonymous</strong></a>(self, subject, verb)</dt></dl>
<dl><dt><a name="ToN3-endAnonymousNode"><strong>endAnonymousNode</strong></a>(self, subj<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-endBagNamed"><strong>endBagNamed</strong></a>(self, subj)</dt></dl>
<dl><dt><a name="ToN3-endBagObject"><strong>endBagObject</strong></a>(self, pred, subj)</dt></dl>
<dl><dt><a name="ToN3-endBagSubject"><strong>endBagSubject</strong></a>(self, subj)</dt></dl>
<dl><dt><a name="ToN3-endDoc"><strong>endDoc</strong></a>(self, rootFormulaPair<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-makeComment"><strong>makeComment</strong></a>(self, str)</dt></dl>
<dl><dt><a name="ToN3-makeStatement"><strong>makeStatement</strong></a>(self, triple, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-representationOf"><strong>representationOf</strong></a>(self, context, pair)</dt><dd><tt> Representation of a thing in the output stream<br>
<br>
Regenerates genids if required.<br>
Uses prefix dictionary to use qname syntax if possible.</tt></dd></dl>
<dl><dt><a name="ToN3-setDefaultNamespace"><strong>setDefaultNamespace</strong></a>(self, uri)</dt></dl>
<dl><dt><a name="ToN3-startAnonymous"><strong>startAnonymous</strong></a>(self, triple, isList<font color="#909090">=0</font>)</dt></dl>
<dl><dt><a name="ToN3-startAnonymousNode"><strong>startAnonymousNode</strong></a>(self, subj, isList<font color="#909090">=0</font>)</dt></dl>
<dl><dt><a name="ToN3-startBagNamed"><strong>startBagNamed</strong></a>(self, context, subj)</dt></dl>
<dl><dt><a name="ToN3-startBagObject"><strong>startBagObject</strong></a>(self, triple)</dt></dl>
<dl><dt><a name="ToN3-startBagSubject"><strong>startBagSubject</strong></a>(self, context)</dt></dl>
<dl><dt><a name="ToN3-startDoc"><strong>startDoc</strong></a>(self)</dt></dl>
<hr>
Data and non-method functions defined here:<br>
<dl><dt><strong>__doc__</strong> = "Serializer output sink for N3<font color="#c040c0">\n</font> <font color="#c040c0">\n</font> keeps t... Adapted from Dan's ToRDFParser(Parser);<font color="#c040c0">\n</font> "<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<dl><dt><strong>__module__</strong> = 'notation3'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<dl><dt><strong>flagDocumentation</strong> = 'Flags for N3 output are as follows:-<font color="#c040c0">\n</font> <font color="#c040c0">\n</font>a ...is" and "()" special syntax should be suppresed.<font color="#c040c0">\n</font>'<dd><tt>str(object) -> string<br>
<br>
Return a nice string representation of the object.<br>
If the argument is a string, the return value is the same object.</tt></dl>
<hr>
Methods inherited from <a href="RDFSink.html#RDFSink">RDFSink.RDFSink</a>:<br>
<dl><dt><a name="ToN3-checkNewId"><strong>checkNewId</strong></a>(self, uri)</dt><dd><tt>The store can override this to raise an exception if the<br>
id is not in fact new. This is useful because it is usfeul<br>
to generate IDs with useful diagnostic ways but this lays them<br>
open to possibly clashing in pathalogical cases.</tt></dd></dl>
<dl><dt><a name="ToN3-genId"><strong>genId</strong></a>(self)</dt></dl>
<dl><dt><a name="ToN3-newBlankNode"><strong>newBlankNode</strong></a>(self, context, uri<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-newExistential"><strong>newExistential</strong></a>(self, context, uri<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-newFormula"><strong>newFormula</strong></a>(self, uri<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-newLiteral"><strong>newLiteral</strong></a>(self, str, dt<font color="#909090">=None</font>, lang<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-newSymbol"><strong>newSymbol</strong></a>(self, uri)</dt></dl>
<dl><dt><a name="ToN3-newUniversal"><strong>newUniversal</strong></a>(self, context, uri<font color="#909090">=None</font>, why<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="ToN3-reopen"><strong>reopen</strong></a>(self)</dt><dd><tt>Un-End a document<br>
<br>
If you have added stuff to a document, thought you were done, and<br>
then want to add more, call this to get back into the sate that makeSatement<br>
is again acceptable. Remember to end the document again when done.</tt></dd></dl>
<dl><dt><a name="ToN3-setGenPrefix"><strong>setGenPrefix</strong></a>(self, genPrefix)</dt></dl>
</td></tr></table></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-convert"><strong>convert</strong></a>(form, env)</dt><dd><tt> raises KeyError if the form data is missing required fields.</tt></dd></dl>
<dl><dt><a name="-doCommand"><strong>doCommand</strong></a>()</dt><dd><tt>Command line RDF/N3 tool<br>
<br>
<command> <options> <inputURIs><br>
<br>
-rdf1out Output in RDF M&S 1.0 insead of n3 (only works with -pipe at the moment)<br>
-help print this message<br>
-chatty Verbose output of questionable use<br>
<br>
See also: cwm</tt></dd></dl>
<dl><dt><a name="-dummy"><strong>dummy</strong></a>()</dt></dl>
<dl><dt><a name="-hexify"><strong>hexify</strong></a>(ustr)</dt><dd><tt>Use URL encoding to return an ASCII string corresponding to the given unicode</tt></dd></dl>
<dl><dt><a name="-serveRequest"><strong>serveRequest</strong></a>(env)</dt></dl>
<dl><dt><a name="-showForm"><strong>showForm</strong></a>()</dt></dl>
<dl><dt><a name="-stringToN3"><strong>stringToN3</strong></a>(str)</dt><dd><tt>#"</tt></dd></dl>
<dl><dt><a name="-stripCR"><strong>stripCR</strong></a>(str)</dt></dl>
<dl><dt><a name="-test"><strong>test</strong></a>()</dt></dl>
</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>ADDED_HASH</strong> = '#'<br>
<strong>ALL4</strong> = (0, 1, 2, 3)<br>
<strong>ANONYMOUS</strong> = 3<br>
<strong>CONTEXT</strong> = 0<br>
<strong>DAML_LISTS</strong> = 1<br>
<strong>DAML_equivalentTo</strong> = (0, 'http://www.daml.org/2001/03/daml+oil#equivalentTo')<br>
<strong>DAML_equivalentTo_URI</strong> = 'http://www.daml.org/2001/03/daml+oil#equivalentTo'<br>
<strong>DOUBLE_DATATYPE</strong> = 'http://www.w3.org/2001/XMLSchema#double'<br>
<strong>Escapes</strong> = {'"': '"', r'\': r'\', 'a': '<font color="#c040c0">\x07</font>', 'b': '<font color="#c040c0">\x08</font>', 'f': '<font color="#c040c0">\x0c</font>', 'n': '<font color="#c040c0">\n</font>', 'r': '<font color="#c040c0">\r</font>', 't': '<font color="#c040c0">\t</font>', 'v': '<font color="#c040c0">\x0b</font>'}<br>
<strong>INTEGER_DATATYPE</strong> = 'http://www.w3.org/2001/XMLSchema#integer'<br>
<strong>LITERAL</strong> = 2<br>
<strong>LOG_implies_URI</strong> = 'http://www.w3.org/2000/10/swap/log#implies'<br>
<strong>List_NS</strong> = 'http://www.daml.org/2001/03/daml+oil#'<br>
<strong>Logic_NS</strong> = 'http://www.w3.org/2000/10/swap/log#'<br>
<strong>N3CommentCharacter</strong> = '#'<br>
<strong>N3_Empty</strong> = (0, 'http://www.daml.org/2001/03/daml+oil#Empty')<br>
<strong>N3_List</strong> = (0, 'http://www.daml.org/2001/03/daml+oil#List')<br>
<strong>N3_first</strong> = (0, 'http://www.daml.org/2001/03/daml+oil#first')<br>
<strong>N3_forAll_URI</strong> = 'http://www.w3.org/2000/10/swap/log#forAll'<br>
<strong>N3_forSome_URI</strong> = 'http://www.w3.org/2000/10/swap/log#forSome'<br>
<strong>N3_nil</strong> = (0, 'http://www.daml.org/2001/03/daml+oil#nil')<br>
<strong>N3_rest</strong> = (0, 'http://www.daml.org/2001/03/daml+oil#rest')<br>
<strong>OBJ</strong> = 3<br>
<strong>PARTS</strong> = (1, 2, 3)<br>
<strong>PRED</strong> = 1<br>
<strong>RDF_NS_URI</strong> = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'<br>
<strong>RDF_spec</strong> = 'http://www.w3.org/TR/REC-rdf-syntax/'<br>
<strong>RDF_type</strong> = (0, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type')<br>
<strong>RDF_type_URI</strong> = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'<br>
<strong>SUBJ</strong> = 2<br>
<strong>SYMBOL</strong> = 0<br>
<strong>__file__</strong> = './notation3.pyc'<br>
<strong>__name__</strong> = 'notation3'<br>
<strong>_notNameChars</strong> = '<font color="#c040c0">\t\r\n</font> !"#$%&<font color="#c040c0">\'</font>()*.,+/;:<=>?@[<font color="#c040c0">\\</font>]^`{|}~'<br>
<strong>_rdfns</strong> = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'<br>
<strong>digitstring</strong> = <_sre.SRE_Pattern object><br>
<strong>eof</strong> = <_sre.SRE_Pattern object><br>
<strong>eol</strong> = <_sre.SRE_Pattern object><br>
<strong>forbidden1</strong> = <_sre.SRE_Pattern object><br>
<strong>forbidden2</strong> = <_sre.SRE_Pattern object><br>
<strong>interesting</strong> = <_sre.SRE_Pattern object><br>
<strong>langcode</strong> = <_sre.SRE_Pattern object><br>
<strong>number_syntax</strong> = <_sre.SRE_Pattern object><br>
<strong>option_noregen</strong> = 0<br>
<strong>parsesTo_URI</strong> = 'http://www.w3.org/2000/10/swap/log#parsesTo'<br>
<strong>signed_integer</strong> = <_sre.SRE_Pattern object><br>
<strong>ws</strong> = <_sre.SRE_Pattern object></td></tr></table>
</body></html>