smart-data-models / data-models

Data Models in common use based on real world use-cases. These definitions underpin a digital market of interoperable and replicable smart solutions.
https://smartdatamodels.org/
114 stars 56 forks source link

Converting JSON-LD Smart Data Models to RDF/Turtle File Ontology #61

Closed Max-Bld closed 4 months ago

Max-Bld commented 4 months ago

Hello,

I am trying to experiment with Smart Data Models in order to add a common semantic layer to multiple heterogeneous data sources.

For this purpose, I would like to translate the JSON-LD file to a .ttl (RDF serialization) file ontology in order to explore and manipulate it in Protégé Software with the following steps:

The output from easy-rdf is not satisfactory because the contents field is missing, while I was expecting to have a list of classes:

@prefix dc: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<dtmi:com:ngsi-ld:TouristProfile;0>
  a <http://njh.me/Interface> ;
  dc:description "Description of a tourist profile based on the characteristics of a person, trip, choice of stay and spending while in destination."^^xsd:string .

Next, I tried to tweak it by adding a contents line to the context part of the merged json-ld file:

{
    "@context": {
        "1": "https://smartdatamodels.org/dataModel.TourismDestinations/1",

        [...]

        "wheelChairAccessible": "https://smartdatamodels.org/dataModel.TourismDestinations/wheelChairAccessible",
        "contents": "https://smartdatamodels.org/example"
    },

        [...]

But the result is not satisfactory neither, I have a bunch of blank nodes instead of well defined class:

@prefix dc: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix ns0: <https://smartdatamodels.org/> .

<dtmi:com:ngsi-ld:TouristProfile;0>
  a <http://njh.me/Interface> ;
  dc:description "Description of a tourist profile based on the characteristics of a person, trip, choice of stay and spending while in destination."^^xsd:string ;
  ns0:example [
    a <http://njh.me/Property> ;
    ns0:name "alternateName"^^xsd:string

[...]

[
    a <http://njh.me/Telemetry> ;
    ns0:name "travelPartyComposition"^^xsd:string
  ] .

Does what I want to do have any sense? Is there a way to translate an SDM to a turtle ontology?

albertoabellagarcia commented 4 months ago

We are currently in progress to create such tool, but unfortunately we cannot commit on a date because it depends on variable resources but we will be glad to collaborate about it. use our support or live support

albertoabellagarcia commented 4 months ago

BTW the schemaDTDL.json makes no sense to merge it as long as it is a DTDL(a microsoft digital twins solution).

albertoabellagarcia commented 4 months ago

Additionally the tool easyRDF is meant to translate json-ld butschemas are coded in json schema so the result in RDF does not make much sense. This tool is not meant for the conversion of the schemas.

Max-Bld commented 4 months ago

Thank you for the clarifications!