-
Notifications
You must be signed in to change notification settings - Fork 16
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 RDF support #427
Comments
@mhrimaz We already generate RDF+SHACL schemas. Could you please clarify? |
I don't mean the ontology and SHACL. I mean handling the RDF serialization so you can also load a RDF file like: @prefix aas: <https://admin-shell.io/aas/3/0/> .
<MySubmodel> a aas:Submodel ;
<https://admin-shell.io/aas/3/0/Identifiable/id> "MySubmodel" . and convert it to JSON or vice versa. {
"id": "MySubmodel",
"modelType": "Submodel"
} |
We recently added generation of JSON-LD context. We it, you can do:
Convert to JSON-LD and then do a JSON-LD framing with:
|
@wiresio that's great! I couldn't find anything related to json-ld in the current python. Are you guys planning to add it? And other than generation of JSON-LD (RDF Turtle), is that possible to read RDF Turtle (JSON-LD) data ? |
Please take a look at:
For everything related to JSON-LD, please see: https://json-ld.org/#developers |
How can I generate the provided triple? are they now part of the generated SDKs? I would appreciate if you can provide an example. The provided file that you sent is the definition of elements and the relations between them. similar to the rdf-ontology. So my question is how to convert a Submodel to json-ld and read it? Here a example Submodel in json-ld: [
{
"@id":"https://admin-shell.io/aas/3/0/Submodel"
},
{
"@id":"urn:sub",
"https://admin-shell.io/aas/3/0/Identifiable/id":[
{
"@value":"MySubmodel"
}
],
"@type":[
"https://admin-shell.io/aas/3/0/Submodel"
]
}
] or in RDF turtle: @prefix aas: <https://admin-shell.io/aas/3/0/> .
<urn:sub> aas:Identifiable\/id "MySubmodel" ;
a aas:Submodel . or in JSON turtle: {
"id": "MySubmodel",
"modelType": "Submodel"
} |
results in:
When you frame it, you get:
You can try it here: https://json-ld.org/playground/ |
@mhrimaz wrote:
There are no RDF modules in all of standard libraries, so this makes it a no-go for the current core SDKs which aim at zero or few dependencies. I would be glad to mentor the pull request if somebody wants to write a generator for an RDF de/serializer and publish the generated code as a separate package. |
@wiresio I think you are one step ahead. What is missing is the step before it. converting objects to rdf. Key simpleKey = new DefaultKey.Builder()
.value("simple")
.type(KeyTypes.GLOBAL_REFERENCE)
.build();
// This part is not in AAS4j, implemented by me. Model is a Apache Jena model.
RDFSerializationResult rdfSerializationResult = new DefaultKeyRDFHandler().toModel(simpleKey);
rdfSerializationResult.getModel().write(System.out, Lang.TTL.getName()); which produce the following RDF Turtle: [ a <https://admin-shell.io/aas/3/0/Key>;
<https://admin-shell.io/aas/3/0/Key/type>
"GLOBAL_REFERENCE";
<https://admin-shell.io/aas/3/0/Key/value>
"simple"
] . Or with aas-core3.0-python: import json
import aas_core3.types as aas_types
import aas_core3.verification as aas_verification
import aas_core3.jsonization as aas_jsonization
import aas_core3.xmlization as aas_xmlization
example = aas_types.Submodel(id="some-unique-global-identifier")
print(aas_jsonization.to_jsonable(example)) # as json
print(aas_xmlization.to_str(example))# as xml
aas_rdfization.to_turtle() # as rdf turtle or json-ld is missing! |
That's right. I thought it was your starting point. |
I'm closing the issue due to inactivity -- I don't think we are going to work on this feature in the near or mid-term. The specification for RDF+SHACL is in progress of substantial improvement (e.g., see: admin-shell-io/aas-specs#421), so once the changes are fleshed out, we can re-consider and re-open this issue. |
RDF is also part of the specification. It would be great to add support to handle RDF representation of AAS.
The text was updated successfully, but these errors were encountered: