how to control QName usage n3 and turtle serializers

18 views
Skip to first unread message

László Török

unread,
Nov 2, 2011, 5:51:50 AM11/2/11
to rdfli...@googlegroups.com
Hi,


I've started to use rdflib for a project @work. I've been trying to parse rdf/xml and output n3 or turtle.

I'm using the in-memory graph store for manipulation.

One issue that has been giving me a hard time is that I don't seem be able to control whether the URI's are serialized as full URIs or in qname format.

(http://example.org/#thing vs. ex:thing)

It seems this is handled by the getQName method in turtle.py.

The issue is caused by:

...
pfx = self.store.store.prefix(uri)
# in no case try to make a prefix if gen_prefix==False
if not gen_prefix and pfx is None:
            return None
...

and in memory.py:

def prefix(self, namespace):
        return self.__prefix.get(namespace, None)

which I believe is a simple string comparison.

Q: Is this intentional? Shouldn't prefix() be using the namespace manager to perform the lookup?

Thanks


--
László Török

Skype: laczoka2000
Twitter: @laczoka

Reply all
Reply to author
Forward
0 new messages