-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Manage all content negociation on API services #1226
Comments
The main issue will be to find a good library to transform from/to JSON-LD, where performances are good. If we could directly use the correct JSON-LD context, that would be great. There are some answers here: The most stable libraries all use the same Sink interface: https://rdf.js.org/#sink-interface. One solution could be to use https://github.com/rdfjs-base/parser-jsonld to parse JSON-LD to RDF.js quads, and then https://github.com/rdfjs-base/serializer-turtle to serialize RDF.js quads to Turtle. Haven't found a Turtle parser though... https://github.com/rdfjs/N3.js is not a good candidate since it doesn't support JSON-LD. |
I don't have any objections, but I'm afraid it will greatly reduce performance if an application wants to communicate with the server in turtle mode. |
Is there any app, in the past 4 years, which has been using Turtle instead of JSON-LD ? |
I agree with the statement about usage. |
We could maybe use the new JSONExt serializer to transform Turtle to JSON-LD |
We could create middleware functions for the I agree that we should keep an eye on performance (a general thing that we can improve on!). I'm not too worried though, my intution says that multiple round-trip-times between db and backend are by far the greater slow-down (happy to be disproven though :) ). |
We might even be able to use this to support dereferncing resources linked with certain predicates / join it with the DereferenceMixin. |
Problem
Turtle handling is broken for a long time (see #995). It's complicated to deal with several formats on the LdpService and TripleStoreService. Plus it's annoying to have to declare a
contentType
oraccept
param for every calls (see #542)Proposal
We should make it a rule that Moleculer services only handle JSON-LD data, because JSON is a first-class citizen on Moleculer, and more generally on javascript.
This means it is the responsibility of API services (we have a new, very functional LdpApiService) or actions to transform data from/to Turtle, before handing it to Moleculer services as JSON-LD. This means the TripleStoreService will not need to worry about content negociation anymore.
This way we can clean up the LdpService and TripeStoreService while fixing the Turtle handling.
We will need to add tests for the Turtle format, as none exist at the moment.
The text was updated successfully, but these errors were encountered: