Skip to content
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

Add json-ld to CONTENT_TYPE_TO_RDFLIB_FORMAT ? #21

Closed
Gerbert-Kaandorp opened this issue May 8, 2024 · 1 comment
Closed

Add json-ld to CONTENT_TYPE_TO_RDFLIB_FORMAT ? #21

Gerbert-Kaandorp opened this issue May 8, 2024 · 1 comment

Comments

@Gerbert-Kaandorp
Copy link

Gerbert-Kaandorp commented May 8, 2024

Hi Vincent,

Thank you for writing this endpoint around rdfLib!
I enjoy using it for my local development where i can just use this instead of a more complex setup.

There is just a small compatibility issue with parsing the results for my needs.
The easiest format to parse for my services is json.
So it would be awesome to get a json-ld response back after say a CONSTRUCT query.
Now we can only get turtle or xml.
I believe it should be as simple as adding it to CONTENT_TYPE_TO_RDFLIB_FORMAT
Would you mind having a look ?

Happy coding :)
Gerbert

https://rdflib.readthedocs.io/en/stable/plugin_serializers.html

It is also possible to pass a mime-type for the format parameter:

why not just pass the mime-type?

@vemonet
Copy link
Owner

vemonet commented May 24, 2024

Hi @Gerbert-Kaandorp , thanks for the suggestion! I added JSON-LD to output types, and I took the opportunity to also add support for n3, ntriples, nquads, trix and trig

It is available in the latest release v0.5.1

We have this list of supported mime types to be able to parse and handle accept headers with multiple mime types for content negotiation, I don't think RDFLib handles those use cases

And we need to also handles mime type for SELECT queries (we are working with the return type of graph.query(), not graph.serialize())

@vemonet vemonet closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants