Open ghost opened 12 years ago
It would seem that you have encountered a modelling issue.
Deep in the rdflib.plugins.serializers.rdfxml.PrettyXMLSerializer code are the lines:
if first(store.objects(object, RDF.first)): # may not have type RDF.List
self.__serialized[object] = 1
# TODO: warn that any assertions on object other than
# RDF.first and RDF.rest are ignored... including RDF.List
writer.attribute(RDF.parseType, "Collection")
Assuming I read it correctly, this seems to be exactly what you are seeing. The assertions made on foo:thing have been ignored.
I have implemented the TODO and added a UserWarning.
I don't know why the assertions are ignored but the intention is explicit.
None of the vanilla XML, Notation3 or NTriples serializations suffer from this limitation.
Sorry for commenting to an old issue, but neither do I understand why some assertions are ignored, can't they just be taken into account?
Using Apache Jena's rdfdiff
I can confirm that models produced by vanilla XML serializer and Turtle serializer are equal but the one generated by PrettyXmlSerializer
is not.
@kouralex best to open an issue, but if something is wrong with RDFLib we are happy to have it fixed, but RDFLib is entirely community-driven.
@aucampia yes, and as I have maintained an open source software, I understand. I was just wondering if there are some specification that let one to omit some declarations/assertions but that does not seem to be the case - hence the comment. I am not overly into/interested in the (RDF/)XML format(s), in my use case I am basically just offering different serializations of the graph to the user. Therefore, I can use the plain XML version (or use another program to generate RDF/XML-ABBREV) if I want to, so this indeed is not an issue to me.
@kouralex if a triple is in asserted in the input source it should be in the output, so if it is ignored it is a bug. I actually don't think this should have been closed, as it seems the last communication on this made it clear it is still a problem.
azarot...@gmail.com, 2011-06-22T17:10:07.000Z
What steps will reproduce the problem?
What is the expected output? What do you see instead?
Equivalent of n3, or regular xml.
What version of the product are you using? On what operating system?
3.1, MacOSX