Azure / opendigitaltwins-dtdl

Digital Twins Definition Language
Creative Commons Attribution 4.0 International
462 stars 160 forks source link

Best approach for updating 'extends'-references when updating model version #164

Open mwdhont-auge opened 1 year ago

mwdhont-auge commented 1 year ago

Hi,

What's the best approach to update the version number of the 'extends'-references when the mother class updated?

For example, a the following building-class extends from the following 2 classes:

{
    "@id": "dtmi:org:auge:Building;1",
    "@type": "Interface",
    "description": {
      "en": "Aug.e version of building."
    },
    "displayName": "Building",
    "@context": "dtmi:dtdl:context;2",
    "extends" : [
      "dtmi:org:w3id:rec:Building;1",
      "dtmi:org:auge:Space;**1**"
  ]
  }

When you decide to update the "dtmi:org:auge:Space;1"-class to version number 2, it can become cumbersome to update all references of version 1 to version 2, i.e.,

{ "@id": "dtmi:org:auge:Building;1", "@type": "Interface", "description": { "en": "Aug.e version of building." }, "displayName": "Building", "@context": "dtmi:dtdl:context;2", "extends" : [ "dtmi:org:w3id:rec:Building;1", "dtmi:org:auge:Space;2" ] }



Questions:
1. Are there any best practices, tools, guideline available for this operation?
2. Should the version number of the extending class, in this case "dtmi:org:auge:Building;1", also be increased to "dtmi:org:auge:Building;2"?

Michiel
jrdouceur commented 1 year ago

Hi Michiel,

I don't have an especially good answer to your first question. We have done some preliminary thinking about tools and systems for managing model ontologies, part of which would be facilitating revisions to an entire ontology in a consistent way. Unfortunately, this has not been a high enough relative priority to drive the design and development work that would be needed to produce a usable tool or system.

We do have a (not yet released) tool for supporting the upgrade of models from DTDL v2 to DTDL v3, and this tool also consistently increases the version numbers of all identifiers in the set of models being upgraded. We are considering releasing this tool as part of the GA of DTDL v3 and the next model parser, but it does not support generalized re-versioning of models, only the particular case of DTDL language-version upgrade.

Your second question is easier. The short answer is yes. The somewhat longer answer is: Each identifier must have no more than one definition, and since the definition of dtmi:org:auge:Building;1 includes an explicit reference to dtmi:org:auge:Space;1, it cannot also have a definition in which this is replaced by an explicit reference to dtmi:org:auge:Space;2. So, it is necessary to provide a new identifier for this revised definition, and an intuitive choice for the new identifier is one that matches the old identifier except for an increased version number suffix.