-
Notifications
You must be signed in to change notification settings - Fork 27
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
JSON-LD context (and frame) #386
Comments
@VladimirAlexiev have you seen: Please contact @wiresio for more information. |
@mristin I haven't, thanks! |
@VladimirAlexiev - Within the context of W3C WoT standardisation, we implemented a triplestore based Thing Description (TD) Directory API according to: https://www.w3.org/TR/wot-discovery/ For this we needed a proper JSONLD context to realize the roundtripping TD-JSONLD -> RDF -> TD-JSONLD. From the code - which will be soon put to open source - you will see that we had to correct the W3C WoT JSONLD context a bit, to really retrieve the semantically exact JSONLD back from the roundtrip. So, yes we did it for W3C TDs. We also realized the idea of doing another roundtrip, actually realizing a data format conversion by doing TD-JSONLD -> RDF -> (SPARQL construct query) -> AAS-JSON. For the last step after the SPARQL query, we carried out JSONLD framing with the AAS context mentioned above. So yes, roundtripping should also work for AAS using this context. |
@VladimirAlexiev - Thanks for the extensive list in #384. What do you expect from this issue? JSON-LD context for AAS v3 is there (and can be auto-generated for future versions thanks to the integration in aas-core-codegen). |
Hi @wiresio and @mristin (and @mhrimaz)! Then see https://github.com/VladimirAlexiev/aas-core-codegen/tree/main/test_data/jsonld_context/trials#next-steps, in particular
I'll also make a PR but please give me some feedback about file location and naming:
Cheers! |
@sebbader-sap @BirgitBoss should we move the JSON-LD here? |
@wiresio can you please patch the json-ld context generator? I know too little about RDF and JSON-LD to know what to fix. |
@VladimirAlexiev I think it would be best if you schedule a call to decide in a live discussion how we should go about RDF specification. I am irrelevant for the initial talks and decisions, but please insert me in the loop once you want to make changes to aas-core-codegen. |
@VladimirAlexiev - thanks for pointing this out! @ethieblin - can you please have a look? |
Generally, it does make sense to put the context file also into the RDF schema folder. I can also create a proper redirect to have a nice looking URL for it. E.g. My main problem is that the whole RDF (in particular JSON-LD) needs more "love" (aka. "time"), which is currently the limiting factor. I know that the "WG Ontologies" also has a bunch of improvement proposals in their pipeline, which all together would create a sound picture. If we can combine all these different activities, maybe in late April or so, I can certainly help too. |
Hi @sebbader-sap, thanks for the response! I should be able to give some "love" as part of Manufacturing Data Space project that just started. Where is the "WG Ontologies" and their improvement proposals? Cheers! |
It's an IDTA-internal group, I don't think that there is a public space. Is Ontotext an IDTA member? If so, you can join them. |
Hello, Thanks for your feedback on the JSON-LD Context. I definitely agree that the ontology part of AAS needs more "love" :) And I agree with the " tickets you have created: xs:string, langStrings and the URI formation of the properties. Regarding the JSON-LD Context:
|
@ethieblin I use "globalAssetId": {
"modelType": "xs:string", // should be "@type"
"@value": "something_eea66fa1"
}
Yes (ntriples or nquads), that's why I use extra tools to make turtle so I can compare to the Turtle examples.
That's great! But we need more holistic examples to make sure Please see https://github.com/VladimirAlexiev/aas-core-codegen/tree/main/test_data/jsonld_context/trials#next-steps and comment (here). Can you please answer:
After these |
jsonld-cli (v2.0.0) has just been upgraded to jsonld.js v8.3.2+: digitalbazaar/jsonld-cli#18 |
This issue is related to admin-shell-io/aas-specs#386 It is needed so that the context can be served directly at a given URL and digested in a JSON-LD document
Ah yes you are right on the "modelType" vs "@type". The issue is more general. Having one of either of the following solutions should in theory give the same result. In practice, it may fall into an undefined behaviour of the JSON-LD framing libraries.
or
For your comments
I am not a maintainer of aas-core-codegen repository, so I have little impact here. The file locations and naming are fine with me, or perhaps they could be placed in
In this PR I added the wrapping "@context" tag. Please have a look. To me if modifications are to be made, they should be in the code that generates the context and not in the context itself (that may be overwritten by launching the code again). |
Regarding the next steps you propose:
We can also rely on the different JSON examples and RDF examples on the specs repository
Not sure what you mean by "several JSON messages" you mean validation messages, error messages?
Agreed
Agreed
That would require a change in the ontology and the specs examples as well |
This patch is related to the [issue 386 of aas-specs]. We fix the JSON-LD generation so that the context can be served directly at a given URL and digested in a JSON-LD document. [issue 386 of aas-specs]: admin-shell-io/aas-specs#386
Let me please clarify a confusion. The JSON-LD does not "live" at aas-core-codegen. It's were the generator lives. We simply recorded the output for V3.0 and used it as a golden data for tests. When the V3.1 comes (and future versions), we will probably not keep the outputs as test data. The parties interested in the usage of JSON-LD definitely need to clarify whether you want to stick to aas-core-codegen (and patch the generator accordingly), take a hybrid approach (generate a base JSON-LD with aas-core-codegen, but then additionally write a script to patch it automatically or manually make changes), or go back to the manual specification. It is probably best if you schedule a conference call, and make a decision. I fear that the discussions through GitHub issues are too scattered to come to a viable and thought-through solution. |
Can you point me to examples with langStrings and datatyped values?
When I wrote this, I didn't know that your Context also serves as a Frame.
This goes into future work on realistic use cases, so it may be too early to discuss... I think most people think of AAS as documents: there are different file/message formats, hopefully with round-trip between them, there's AASX zip format, etc.
Please say more. I think mapping a prop to
Yep. Same re Datatyped literals (#284): instead of <https://admin-shell.io/aas/3/0/Property/valueType> <https://admin-shell.io/aas/3/0/DataTypeDefXsd/AnyUri> we want to map to "@type": "xs:anyURI"
This is definitely the best approach, if it is feasible. As we use more tricks in the context, it may become less feasible. You're best qualified to say whether it is feasible! |
I think it has to be a hybrid approach (generaee RDF+SHACL), then patch with a script. Otherwise, the expressivity of RDF would need to be captured by aas-core-codegen, which is a huge effort. |
Please see: |
To ensure that the JSON and RDF representation match perfectly, and to convert between them in the easiest possible way, it is best to use the JSON-LD standard:
JSON->RDF
(parsing) it's enough to define a JSON-LD contextRDF->JSON
(serialization) the same JSON-LD context is reused, and a Frame needs to be added to describe which nodes to insert as JSON sub-objects.I searched in this project and despite my expectation, didn't find anything about JSON-LD.
I have done this in several projects/communities and have enough experience to do this correctly for AAS:
@vocab
to keep the context short and simple. It would blindly convert an unknown keyfoo
into RDF propepcis:foo
@context
schemaorg/schemaorg#3455 (comment) (in YAML form): shows how we can attach different datatypes (date granularities) to the same RDF prop. Attaching datatypes could address XSD data types instead of xs:string for value type #284 but the best way is to use@type
in JSON, as specified by the JSON-LD standardThe text was updated successfully, but these errors were encountered: