-
Notifications
You must be signed in to change notification settings - Fork 555
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
Changes to graph.serialize() #1183
Conversation
1) Change default format from 'xml' to 'turtle' 2) If destination is None and encoding is None, output a str, not bytes 3) Add a new convenience method to print the Graph contents (turtle by default) Lots of fixes in tests to adapt to these changes (serialize is used a lot to check graph state in tests). Blacked files which were involved in this change.
Note after these changes you can still get Eg: |
Just made a small edit to allow doctests to pass, awaiting Travis result |
I understand the idea and I like that it is made easier now that a user does not need to ncessarily deal with the encoding, but having utf-8 per default. On the other hand I think it might confuse some users if adding the encoding parameter does not bring a string anymore but byte instead. This leads me to the more general question, why do we use ByteIO for the streams, why not StringIO instead? |
Yes it might the first time, but this will be one of the changelog notes for 6.0.0, so they will be notified and hopefully only see the issue the first time.
Perhaps just due to a lack of consistent development? Would you like to convert across to StringIO everywhere? @ashleysommer, is that sensible? Sounds fine to me to have string as default unless it's slow for large datasets. Can always be converted back |
Fix AttributeError of serialize(). With backwards compatibility for rdflib==5.0.0, as its the last python 2 release and as long as pyLODE might still support rdflib 5.0.0
…alize fix #145 caused by RDFLib/rdflib#1183 (rdflib 6.0.0) Thanks for the fix @drahnreb!
This is part of our work to simplify and modernize the methods on
rdflib.Graph
to clean up the API surface of the Graph.These are some long-overdue changes to
serialize()
. This is a slightly breaking change, so will be coming as part of RDFLib 6.0.0, but is done in such a way as to minimize breakage as much as possible.These changes are:
serialize()
destination=None
andencoding=None
, output is astr
, notbytes
g.print(format="trig")
Lots of fixes in tests to adapt to these changes (serialize is used a lot to check graph state in tests).
Blacked files which were involved in this change.