-
Notifications
You must be signed in to change notification settings - Fork 565
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
Issue 1003 #1005
Issue 1003 #1005
Conversation
close/open Travis |
# Conflicts: # test/test_issue1003.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very happy with these changes. For setting the base in the Graph class I would switch the overwriting behavior and for the Turtle serializer I don't like the side effect.
An argument for not changing the Turtle behaviors regarding setting self.base
is that we should stick to the same behavior which we have for TriG (
rdflib/rdflib/plugins/serializers/trig.py
Line 48 in 26710b0
def serialize(self, stream, base=None, encoding=None, |
def serialize(self, stream, base=None, encoding=None, **args): |
We should also make sure to have the base set for TriX, RDF/XML, and TriG (https://github.com/RDFLib/rdflib/tree/master/rdflib/plugins/serializers) |
OK, I'll make the same changes to all |
…(). Added RDF/XML, TriX & 1/2 TriG (incomplete)
I've made the changes I said I would above and got RDF/XML & TriX to work. TriG only 1/2 works since it can't express a base per graph, only one for the whole dataset/conjunctive graph. This means the full solution, which I have no time for, is to reverse QNAME any URI in any individual graph that doesn't use the same base as the dataset/conjunctive graph but the Turtle serializer, which the TriG serializer uses, doesn't keep track of things to make this easy! So there is a loss of info if multiple graphs within a dataset/conjunctive graph declare base URIs different to the dataset/conjunctive graph and then serialize to TriG... future work! |
I think this is not necessary. The base in general is not relevant info. It is just a convenience for serializations. So I think we do not need to go the extra mile here. Setting the base on a Graph object is also not necessary but I think a nice feature to give a hint to the Serializers. An I think the currently set base as attribute on a serialize method should always win over the base set in a graph. |
@nicholascar I have made the changes in the way as I would expect the behavior. Is this ok for you? Maybe @ashleysommer should now review this pullrequest (we should anyhow merge it after the 5.0.0 release). |
Hi @white-gecko great, I was just about to make the changes you just made! I'll approve and merge as @ashleysommer's not available at the moment. |
Adds
@base
to N3 & Turtle serializations, ifbase
is set in.serialize()
Closes #1003