rdflib.collections issues · Issue #223 · RDFLib/rdflib (original) (raw)

@gromgull

Adding the same element twice to a collection triggers an exception when serializing the graph, but this shouldn't be a problem:

/usr/local/lib/python2.7/dist-packages/rdflib/collection.pyc in __len__(self)
     77         links=set()
     78         for item in self.graph.items(self.uri):
---> 79             assert item not in links,"There is a loop in the RDF list! (%s has been processed before)"%item
     80             links.add(item)
     81             count += 1

AssertionError: There is a loop in the RDF list! (http://www.w3.org/2000/01/rdf-schema#Class has been processed before)

There is also no way to close the list, appending RDF.nil adds another bnode with first->nil and rest->nil.