-
Notifications
You must be signed in to change notification settings - Fork 146
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
Skip n3 parser for jsonld #358
Conversation
d22d57d
to
069bae3
Compare
@fletcher91 Good work. I don't have opinions on whether or not we should adopt the |
Fixed |
35eab77
to
c2683a6
Compare
I've added parsing to collections by default, which can be disabled for json-ld, n3, and turtle by setting This also relates to #137 in that formula/store now accept the datafactory to be overridden by the end-user (as suggested to me by @RubenVerborgh), though all defaults are still there and no user-change should be required to keep current behaviour. Note the added |
91df63e
to
a0be184
Compare
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.
Looks good as far as I can see -- just looking at the clllections part
a0be184
to
ed6b494
Compare
Fixed and rebased a typo I noticed. Edit: Changes work properly now |
9ea7462
to
1175c96
Compare
The current implementation contains some methods which are like the spec DataFactory interface but have small distinctions. E.g. `namedNode` is called `sym`, `literal` accepts three rather than two arguments. This commit applies the canonical methods of the rdfjs tf DataFactory interface to the store. End-users can also overwrite the used factory via a constructor argument. This also replaces the use of sameTerm for the spec version equals, which was already present in the code (sameTerm returned the result of equals).
Toggling the collections flag on the datafactory supports object will disable the generation of collection objects in-memory. It is still enabled by default for rdflib.
1175c96
to
14c4ae5
Compare
+1 from me. @fletcher91 - I don't suppose you know how to fix #364 by any chance? I tried it out with your branch from this PR, and it still gives that error. This is not to say this PR shouldn't be merged - totally should, I'm just curious if you know a fix. |
@dmitrizagidulin This PR focuses on parsing, not serialization, so that's not a surprise to me. Looking at serialize.js it also goes through the n3 code, but that's no wonder since the jsonld package has a very peculiar API for converting from/to statements (the docs call a serialized n-quads formatted string 'rdf'). They also support js objects in toRDF, so circumventing the N3 library for serialization is also possible. Note that that functionality can't be used for parsing since they don't support collections as termtype, otherwise this code (jsonldparser.js) could be a lot simpler |
@fletcher91 Thanks, np. |
@fletcher91, could you write a small note on what's changed that users of rdflib might want to be aware of? And I presume this does not change the public API? |
@Vinnl This shouldn't break the current API (only expand upon). The main thing is that the store has an additional property In addition, util.js contains some new functions ( |
Thanks, I'll merge and release tomorrow, given that it's been approved. |
Correction: I'm just merging for now, not releasing. Our CI setup isn't extensive enough to give me confidence that this won't break anything, and we're also releasing and deploying new versions of all the Data Browser libraries (mashlib, solid-panes, solid-ui) today, so I'd like to only include those changes there for now. Let me know if that's problematic for anyone. |
@Vinnl Could you publish a prerelease version? It'll be easier to test in downstream projects |
@fletcher91 Sure, |
This removes the n3 library step when parsing json-ld.
I made two prior commit in order to make it possible for the implementation to use the proper rdfjs task force data factory methods on formula/indexed formula/store.