Sleepycat store modifies namespace prefixes · Issue #201 · RDFLib/rdflib (original) (raw)
I'm using rdflib 3.2.0 (installed from pypi) on Ubuntu 12.04beta2 amd64, python 2.7.3rc2.
When I parse several source files into a Graph backed by a Sleepycat store, the namespace prefixes are modified so that "1" is added to each.
Example:
Python 2.7.3rc2 (default, Mar 22 2012, 04:35:15)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
>>> g = rdflib.Graph(store='Sleepycat')
>>> g.open('mytempdir', True)
1
>>> g.parse('http://www.w3.org/People/Berners-Lee/card.rdf')
<Graph identifier=lXgaiQOA0 (<class 'rdflib.graph.Graph'>)>
>>> list(g.namespaces())
[(u'', rdflib.term.URIRef('http://xmlns.com/foaf/0.1/')), (u'cc', rdflib.term.URIRef('http://creativecommons.org/ns#')), (u'cert', rdflib.term.URIRef('http://www.w3.org/ns/auth/cert#')), (u'con', rdflib.term.URIRef('http://www.w3.org/2000/10/swap/pim/contact#')), (u'dc', rdflib.term.URIRef('http://purl.org/dc/elements/1.1/')), (u'dct', rdflib.term.URIRef('http://purl.org/dc/terms/')), (u'doap', rdflib.term.URIRef('http://usefulinc.com/ns/doap#')), (u'geo', rdflib.term.URIRef('http://www.w3.org/2003/01/geo/wgs84_pos#')), (u'owl', rdflib.term.URIRef('http://www.w3.org/2002/07/owl#')), (u'rdf1', rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#')), (u'rdfs', rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#')), (u'xml', rdflib.term.URIRef('http://www.w3.org/XML/1998/namespace'))]
So far so good, now let's parse the same input again:
>>> g.parse('http://www.w3.org/People/Berners-Lee/card.rdf')
<Graph identifier=lXgaiQOA0 (<class 'rdflib.graph.Graph'>)>
>>> list(g.namespaces())
[(u'', rdflib.term.URIRef('http://xmlns.com/foaf/0.1/')), (u'cc1', rdflib.term.URIRef('http://creativecommons.org/ns#')), (u'cert1', rdflib.term.URIRef('http://www.w3.org/ns/auth/cert#')), (u'con1', rdflib.term.URIRef('http://www.w3.org/2000/10/swap/pim/contact#')), (u'dc1', rdflib.term.URIRef('http://purl.org/dc/elements/1.1/')), (u'dct1', rdflib.term.URIRef('http://purl.org/dc/terms/')), (u'default1', rdflib.term.URIRef('http://xmlns.com/foaf/0.1/')), (u'doap1', rdflib.term.URIRef('http://usefulinc.com/ns/doap#')), (u'geo1', rdflib.term.URIRef('http://www.w3.org/2003/01/geo/wgs84_pos#')), (u'owl1', rdflib.term.URIRef('http://www.w3.org/2002/07/owl#')), (u'rdf1', rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#')), (u'rdfs', rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#')), (u'xml', rdflib.term.URIRef('http://www.w3.org/XML/1998/namespace'))]
Suddenly all the namespace prefixes (except for some reason xml, rdfs and the empty prefix) have had 1 appended to them. Serialized files will also use these modified namespaces. I would expect the original namespace prefixes to be used instead.
This does not happen if I use a Memory store instead of Sleepycat.