rdflib2rdf
index
/home/syosi/CVS-local/WWW/2000/10/swap/rdflib2rdf.py

This rdflib2rdf module provides code for glueing rdflib's rdf/xml
parser to cwm.
 
STATUS:
 
First pass, partially working, some questions.
 
 
QUESTIONS:
 
Does the context need to change per bag? I have assumed for the moment
not, as it breaks (or complicates) the interface between the parser
and the store.
 
Is there already or is there any interest in a ContextSink interface
to simplify the interface between the parser and the store? If
desired, I would be happy to help with any refactors that would be
needed. To better describe what I am thinking, I have implemented a
ContextSink enough to serve the purpose needed for this module.
 
Is urlparse.urljoin from the Python standard library buggy? RDFLib
uses urlparse.urljoin and I noticed that the differences between it
and uriparse.join are causing the test cases to fail (export
PYTHONPATH=..;python2.3 retest.py -n -f regression.n3). For example:
    file:/devel/WWW/2000/10/swap/test/animal.rdf#
    vs.
    file:///devel/WWW/2000/10/swap/test/animal.rdf#
 
Not really a question but... RDFLib's RDF/XML parser at the moment
does not make it easy to get to the namespace binding information. And
the way sax2rdf currently calls bind it looks like there will be
issues if a prefix gets redefined. Here is a question re:
this... should passing the namespace information to the store be a
[mandatory] part of the interface? or does it cause to much grief in
practice not too?
 
 
TO RUN: (cwm with rdflib's rdf/xml parser)
 
Double check that you have rdflib-1.2.x installed :)
  * Download from http://rdflib.net/stable/
  * extract
  * cd root of distribution
  * python2.2 setup.py install
 
Change the following line in cwm.py from:
    return sax2rdf.RDFXMLParser(...
to:
    return rdflib2rdf.RDFXMLParser(...
 
--eikeon, http://eikeon.com/

 
Modules
       
diag
uripath

 
Classes
       
RDFXMLParser
__builtin__.object
ContextSink

 
class ContextSink(__builtin__.object)
     Methods defined here:
__init__(self, sink, openFormula, thisDoc=None, flags='', why=None)
makeStatement(self, (predicate, subject, object))
newBlankNode(self)
newLiteral(self, s)
newSymbol(self, uri)

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'ContextSink' objects>
list of weak references to the object (if defined)

 
class RDFXMLParser
     Methods defined here:
__init__(self, sink, formulaURI, thisDoc, flags='', why=None)
add(self, (s, p, o))
Add triple to the sink (rdflib.syntax.parser.Parser calls
this method).
feed(self, buffer)
load(self, uri, baseURI='')

 
Data
        FORMULA = 1