Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sleepycat store modifies namespace prefixes #201

Closed
osma opened this issue Apr 12, 2012 · 2 comments
Closed

Sleepycat store modifies namespace prefixes #201

osma opened this issue Apr 12, 2012 · 2 comments
Labels
bug Something isn't working

Comments

@osma
Copy link

osma commented Apr 12, 2012

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.

@osma
Copy link
Author

osma commented Apr 12, 2012

I tested this also on Ubuntu 10.04 32-bit, Python 2.6.5. Same result.

@gromgull
Copy link
Member

I can confirm this is broken - I've had a tab open with a half-written bug report for some weeks. I'll try to dig into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants