Azure / opendigitaltwins-building

Open Digital Twins Definition Language (DTDL) RealEstateCore Ontology
MIT License
150 stars 42 forks source link

Incorrect 'schema' property name in ElevatorTripEvent.json #67

Closed v-kianlu closed 2 years ago

v-kianlu commented 2 years ago

https://github.com/Azure/opendigitaltwins-building/blob/104d855cdcd546df379d549dd63d538666ddaf62/Ontology/Event/ElevatorTripEvent.json#L45

This line's property name of 'schema' seems to be inconsistent with how other 'schema' properties are defined, which seem to be either [ 'string', 'double', 'date','duration', 'boolean', 'integer', 'dateTime' ], while this 'schema' property is an object with '@type' of enum. I think this property name should be 'dtmi:dtdl:property:schema;2' if trying to be consistent with the rest of the files.

hammar commented 2 years ago

Hi,

Thanks for noticing!

This is however actually a correct and intended usage. "dtmi:dtdl:property:schema;2" and just "schema" are logically equivalent if the DTDLv2 context is loaded (you can search for the longer version of the name in https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/context/DTDL.v2.context.json to verify this). When the context is loaded, a JSON-LD parser will resolve the shorter name to the longer one.

However, since we are generating these models with full URN identifiers to begin with and then compacting them down using the DTDL context file as a set of shortcuts, and since the JSON-LD spec is finicky with regard to such compaction and which URNs it captures and compacts, we occasionally end up with the longer representations anyway. If these models were manually curated in DTDL we could of course simply fix this by editing the file; but since they are generated through a pipeline, such curation would anyway get lost the next time we run the generator.

So for now, we'll simply have to live with this ugliness. In future versions we may try to resolve this, either by way of improving the pipeline or by moving to a more manually curated process on DTDL model level.

I hope this answers your questions; if not, feel free to re-open this issue to continue the discussion.

Best regards,

Karl