gjhiggins/rdflib — Issue #34: no-op Store.namespaces() breaks RDF/XML serialization
Author: gjhiggins
Created: 2011-10-19 01:00:56+00:00
State: open

Originally filed by dorian.t...@gmail.com on 2008-12-21T18:51:35

What steps will reproduce the problem?

Run Graph.serialize() off a Redland back-end (or presumably anything else
in which Store.namespaces() is a stub)

What is the expected output? What do you see instead?

Traceback (most recent call last):
File "experimental/scan.py", line 473, in
d.run()
File "experimental/scan.py", line 438, in run
print self.model.serialize() #format='n3') File
"/var/lib/python-support/python2.5/rdflib/Graph.py", line 628, in serialize
return serializer.serialize(destination, base=base, encoding=encoding,
**arg
s)
File "/var/lib/python-support/python2.5/rdflib/syntax/serializer.py",
line 28,
in serialize
self.serializer.serialize(stream, base=base, encoding=encoding)
File
"/var/lib/python-support/python2.5/rdflib/syntax/serializers/XMLSerialize
r.py", line 50, in serialize
bindings = list(self.__bindings())
File
"/var/lib/python-support/python2.5/rdflib/syntax/serializers/XMLSerialize
r.py", line 26, in __bindings
prefix, namespace, name = nm.compute_qname(predicate)
File
"/var/lib/python-support/python2.5/rdflib/syntax/NamespaceManager.py", li
ne 62, in compute_qname
prefix = "_%s" % len(list(self.store.namespaces()))
TypeError: 'NoneType' object is not iterable

What version of the product are you using? On what operating system?

rdflib 2.4.0
Python 2.5.2

Redland 1.0.7

Linux deuce 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 GNU/Linux

Ubuntu 8.10 (intrepid)

Please provide any additional information below.

The base class rdflib.store.Store should probably have a fallback method of
handling namespace maps. Stores that don't implement their own namespace
maps should just inherit the fallback. N3 output is not affected.