sax2rdf | index /home/syosi/cvs-trunk/WWW/2000/10/swap/sax2rdf.py |
A parser for RDF/XML built on the sax2 interface;
derived from a parser for RDF/XML built on the xmllib XML parser.
To do: Passing on namesapce bindings!
(dwc: @@huh?)
(tbl: The bind call in the RDF stream API is used to pass
on the prefixes found, as hints only for generating readable output code)
- Add parsing of RDF bags
parses DAML_ONT_NS or List_NS lists, generates List_NS
References:
Python/XML HOWTO
The Python/XML Special Interest Group
xml-sig@python.org
(edited by amk1@bigfoot.com)
http://py-howto.sourceforge.net/xml-howto/xml-howto.html
http://www.megginson.com/SAX/applications.html#python.parsers
http://www.python.org/sigs/xml-sig/
How to on xmllib:
http://www.python.org/doc/howto/xml/node7.html
RDF grammar http://www.w3.org/TR/rdf-syntax-grammar/ esp sections 6 and 7
##################################### SAX pointers
First hit on Python SAX parser
http://www.gca.org/papers/xmleurope2000/papers/s28-04.html#N84395
Howto use SAX in python:
http://www.python.org/doc/howto/xml/SAX.html
Modules | ||||||
|
Classes | ||||||||||||||||||||||||
|
Functions | ||
|
Data | ||
ANONYMOUS = 3 DAML_ONT_NS = 'http://www.daml.org/2000/10/daml-ont#' DPO_NS = 'http://www.daml.org/2001/03/daml+oil#' FORMULA = 1 List_NS = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' NODE_MERGE_URI = 'http://www.w3.org/2000/10/swap/log#is' OWL_NS = 'http://www.w3.org/2002/07/owl#' RDF_NS_URI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' RDF_Specification = 'http://www.w3.org/TR/REC-rdf-syntax/' STATE_DESCRIPTION = 'Description (have subject)' STATE_LIST = 'within list' STATE_LITERAL = 'within literal' STATE_NOT_RDF = 'not RDF' STATE_NOVALUE = 'no value' STATE_NO_SUBJECT = 'no context' STATE_OUTERMOST = 'outermost level' STATE_VALUE = 'plain value' XML_NS_URI = 'http://www.w3.org/XML/1998/namespace' a = 'bagID' coreSyntaxTerms = ['RDF', 'ID', 'about', 'parseType', 'resource', 'nodeID', 'datatype'] feature_namespaces = 'http://xml.org/sax/features/namespaces' nodeElementExceptions = {'http://www.w3.org/1999/02/22-rdf-syntax-ns#ID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#about': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEach': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEachPrefix': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#bagID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#li': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#parseType': True, ...} oldTerms = ['aboutEach', 'aboutEachPrefix', 'bagID'] propertyAttributeExceptions = {'http://www.w3.org/1999/02/22-rdf-syntax-ns#Description': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#ID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#about': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEach': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEachPrefix': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#bagID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#li': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID': True, ...} propertyElementExceptions = {'http://www.w3.org/1999/02/22-rdf-syntax-ns#Description': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#ID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#about': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEach': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#aboutEachPrefix': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#bagID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#datatype': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID': True, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#parseType': True, ...} syntaxTerms = ['RDF', 'ID', 'about', 'parseType', 'resource', 'nodeID', 'datatype', 'Description', 'li'] tracking = 0 |