gjhiggins/rdflib — Issue #179: serialize(format="pretty-xml") fails on cyclic links
Author: gjhiggins
Created: 2011-10-19 01:36:14+00:00
State: open

Originally filed by jman...@gmail.com on 2011-08-13T00:28:24

When cyclically related nodes are serialized with format="pretty-xml", the nodeID for the outermost node is not included. This leaves the inner node making a dangling (unresolved) reference. See below for details...

--------------
What steps will reproduce the problem?

$ [Fresh Ubuntu 11.04 install]
$ sudo easy_install -U "rdflib>=3.0.0"

$ python

from rdflib import *
g = Graph()
g.bind("j", URIRef("http://example.com#"))

g.add((a, RDF.type, URIRef("http://example.com#a")))
g.add((b, RDF.type, URIRef("http://example.com#b")))

g.add((a, URIRef("htt://example.com#linkedto"), b))
g.add((b, URIRef("htt://example.com#linkedto"), a))

print g.serialize(format="pretty-xml")

--------------
What is the expected output?

--------------
What do you see instead?

The node of type does *not* have a nodeID assigned, meaning that the reference is broken! Exact output below:

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

$ [Fresh Ubuntu 11.04 install]
$ sudo easy_install -U "rdflib>=3.0.0"