-
Notifications
You must be signed in to change notification settings - Fork 22
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 Support #16
Comments
This is indeed something I'd like to add -- especially since I am involved in JSON-LD 1.1 :-) JSON-LD 1.1 is about to enter the CR period, which means that the spec is now stable, and implementations are called for. I'm aware of three projects in Rust (by decreasing order of recent activity):
I'm willing to contribute to the first one, in order to help bring it to full compliance. Feel free to do so too, the more the merrier :-) Once it is functional, I definitely plan to integrate it to sophia. Here again, any help is welcome. |
ok, awesome! glad to see things are all generally moving forward and what not. I'll start contributing as I can :) |
I had not seen the 1.1 spec work before, so I'll be checking that out too. |
FYI, 1bad729 indtroduced the crate sophia_jsonld. Ir is very incomplete at the moment (only supports the serialization from RDF algorithm), but that's a start... |
I may start work on this soon. As it seems Sophia, Rio, and Oxigraph are very focused on performance, I think it may be beneficial to create two submodules of I will probably look at other JSON parsers in rust to get some inspiration. I'm a little inclined to just built the system on top of an existing well-maintained JSON parser like serde's I'd appreciate any thoughts or feedback people had before I jump in! |
It looks like a great idea! I would love having |
@alexkreidler agreed, a streaming JSON-LD parser/serializer would be very nice, in addition to a standard one. |
@pchampin Based on the current support for Json-ld (https://github.com/pchampin/sophia_rs/tree/main/jsonld) do you know how we could convert a JSON-LD document to a RDF DataSet? I am working on implementing URDNA2015 (https://w3c-ccg.github.io/rdf-dataset-canonicalization/spec/#canonicalization-algorithm) and while I would love to utilize Sophia for the RDF functionality I can't seem to figure out how to handle the conversion from JSON-LD to RDF with Sophia |
yes, implementing JSON-LD to RDF was in my plans. |
Okay awesome, if there's anyway I can help let me know! I'm happy to contribute if needed |
@LuisOsta finally I managed to come up with something. It's in commit 50980bf. As can be seen in the commit message, it still have a number of limitations. Regarding the first one (requires input in expanded form), a library such as https://github.com/timothee-haudebourg/json-ld can be use to expand arbitrary JSON-LD before passing it to Sophia. The reason why I didn't integrate it into Sophia is that this library requires nightly features, and I prefer Sophia to be available on stable Rust. But hopefully, the feature that The other limitations require a little more work on the parser it self. Any PR is welcome ;) |
Awesome, and I think that the json-ld library will hopefully be stabilized soon -timothee-haudebourg/json-ld#39. Let me review the commit you linked |
@pchampin The JSON-LD library has now been stabilized in timothee-haudebourg/json-ld#39 with the latest stable version being |
@LuisOsta yes, that's on my radar, but thanks for the ping |
@LuisOsta I just commited a first implementation of RDF C14N, based on https://www.w3.org/TR/rdf-canon . JSON-LD is the next item on my list... |
That's great to hear! Also @pchampin I just wanted to get a better understanding of what JSON-LD support would be like. Would Sophia support the URDNA2015 RDF normalization algorithm described in https://w3c.github.io/rdf-canon/spec/. (Which we would use in order to create the Data Integrity Proofs needed to create JSON-LD Verifiable Credentials. Or would Sophia be something we would use to implement the URDNA2015 RDF normalization algorithm ourselves? Just want to make sure we can prepare accordingly. Would love if it was the former but completely understand if its gonna be the latter. |
Sophia is an RDF library. It allows you to handle RDF graphs and datasets that conform to the RDF abstract syntax (actually a superset of it). Sophia provides a number of parsers and serializers for, well, parsing graphs/datasets from different formats, and serializing them back in those formats. It currently supports RDF/XML, N-Triples, N-Quads, Turtle, TriG. JSON-LD support will come as yet another parser and yet another serializer. The serializer will allow options for specifying a specific context, so that you can control how the produced JSON looks. It will be based on timothee-haudebourg/json-ld.
Since yesterday, Sophia provides a function that accepts any Dataset, and produces the normalized nquads as a String. So when we support JSON-LD, you will be able to load any JSON-LD document into a Dataset, and normalize that dataset as you would do with jsonld.js or pyld. Finally, notice that:
Hope this helps |
Okay awesome that makes perfect sense, thank you so much! |
Closing, as JSON-LD support is now integrated on 0.8.0-alpha (and soon to be released, hopefully) |
This is a feature request. I'll gladly contribute the work when I get the time, but I figured I should go ahead and open the issue in case others want to contribute it. Or maybe there are existing solutions.
Background
This crate seems to be the most mature and most recently maintained RDF related crates. So, I'm hoping to use this in an LDP server I'm creating. However, JSON-LD is a required format in LDP servers.
The Request
The text was updated successfully, but these errors were encountered: