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

rdflib.collections issues #223

Closed
gromgull opened this issue Jul 6, 2012 · 5 comments
Closed

rdflib.collections issues #223

gromgull opened this issue Jul 6, 2012 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@gromgull
Copy link
Member

gromgull commented Jul 6, 2012

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.

@gromgull
Copy link
Member Author

gromgull commented Jul 6, 2012

Also, no type rdf:List statement is added ...

@gromgull
Copy link
Member Author

gromgull commented Jul 6, 2012

Correction, the list is ALWAYS closed (nil is always the rest of the last element), there is no way to leave the list open though.

@wwaites
Copy link
Member

wwaites commented Jan 19, 2017

This one just bit me

@wwaites wwaites self-assigned this Jan 19, 2017
@gromgull gromgull added this to the rdflib 4.2.2 milestone Jan 19, 2017
@gromgull
Copy link
Member Author

@wwaites if you find a fix in the next weeks we can get it into 4.2.2!

wwaites pushed a commit to wwaites/rdflib that referenced this issue Jan 19, 2017
@wwaites
Copy link
Member

wwaites commented Jan 19, 2017

Near as I can tell, it is safe to remove this assertion. Graph.items checks for recursion on the list structure itself . This check is simply incorrect for rdf:List that is quite unrestricted. There is no type that I know of with set semantics so I can't see where the assertion can ever be correct even for containers.

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