You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tracking issue for the RDF loader generated in Rust. This loader should be able to load RDF documents in various formats (JSON-LD in particular) into a data structure generated from the TreeLDR layouts definitions.
Import from RDF dataset
Define static JSON-LD contexts
Import from JSON-LD
Type traits
Import from RDF dataset
Any data structure generated from TreeLDR should define a method to instantiate the data structure from an RDF dataset (using the grdf library). This would be the common representation for various input formats like JSON-LD.
Define static JSON-LD contexts
This is outside the direct scope of TreeLDR, but necessary to have the best experience with it. The goal here would be to statically define the set of known JSON-LD context as a type, that can then be used hen loading a JSON-LD document.
#[derive(JsonLdContext)]pubenumContext{#[context("https://json-ld.org/contexts/person.jsonld")]Person,#[context("https://www.w3.org/2018/credentials/v1")]Credentials}pubstructStaticContextLoader;pubstructUnknownContext(IriRefBuf);impl json_ld::context::LoaderforStaticContextLoader{typeError = UnknownContext;typeOutput = Context;fnload_context(&mutself,iri:Iri) -> Result<Context,UnknownContext>{if iri == iri!("https://json-ld.org/contexts/person.jsonld"){Ok(Context::Person)}elseif iri == iri!("https://www.w3.org/2018/credentials/v1"){Ok(Context::Credentials)}else{Err(UnknownContext)}}}
Import from JSON-LD
Once static contexts defined, one should be able to load a JSON-LD document like so:
One open question is how to get the identifier (an IRI or blank node identifier) node_id of the node we want to import from the dataset. It correspond to the top level objects in a JSON-LD document. For now it can be manually fetched once the JSON-LD document is expanded. One just need to be sure to manually assign a blank node id to anonymous nodes or else a random one will be assigned in the dataset, and will be harder to find. We may need to write a helper function to do all that.
Type traits
In addition to type definition, it is possible for TreeLDR to define a trait for each TreeLDR type, implemented by each of its Rust layout-type. This can add a level of abstraction. This would also be the way of translating the RDF type hierarchy in Rust.
The text was updated successfully, but these errors were encountered:
This is a tracking issue for the RDF loader generated in Rust. This loader should be able to load RDF documents in various formats (JSON-LD in particular) into a data structure generated from the TreeLDR layouts definitions.
Import from RDF dataset
Any data structure generated from TreeLDR should define a method to instantiate the data structure from an RDF dataset (using the
grdf
library). This would be the common representation for various input formats like JSON-LD.Define static JSON-LD contexts
This is outside the direct scope of TreeLDR, but necessary to have the best experience with it. The goal here would be to statically define the set of known JSON-LD context as a type, that can then be used hen loading a JSON-LD document.
Import from JSON-LD
Once static contexts defined, one should be able to load a JSON-LD document like so:
One open question is how to get the identifier (an IRI or blank node identifier)
node_id
of the node we want to import from the dataset. It correspond to the top level objects in a JSON-LD document. For now it can be manually fetched once the JSON-LD document is expanded. One just need to be sure to manually assign a blank node id to anonymous nodes or else a random one will be assigned in the dataset, and will be harder to find. We may need to write a helper function to do all that.Type traits
In addition to type definition, it is possible for TreeLDR to define a trait for each TreeLDR type, implemented by each of its Rust layout-type. This can add a level of abstraction. This would also be the way of translating the RDF type hierarchy in Rust.
The text was updated successfully, but these errors were encountered: