Skip to content
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

relationships should support multiple targets and/or multiple versions #133

Open
uriel-kluk opened this issue Sep 22, 2022 · 4 comments
Open

Comments

@uriel-kluk
Copy link

uriel-kluk commented Sep 22, 2022

Example

{
 "@id": "dtmi:MeshSystems:core:space;1",
 "@context": [
  "dtmi:dtdl:context;2"
 ],
 "@type": "Interface",
 "displayName": "Space",
 "contents": [
  {
   "@type": "Relationship",
   "name": "hosts",
   "target": "dtmi:MeshSystems:core:device;2"
  }
 ]
}

As an ontology designer, I would like space to host different devices
"target": "dtmi:MeshSystems:core:device;*"

Instead of the wildcard * the version could be omitted, this is just an idea.

or
"target": ["dtmi:MeshSystems:core:device;1", "dtmi:MeshSystems:core:device;2"]

@rido-min
Copy link
Member

Hi @uriel-kluk

Can you use two relationships? one for each version

/c @cschormann

@uriel-kluk
Copy link
Author

uriel-kluk commented Jan 27, 2023 via email

@nikoraes
Copy link

+1 on this
I would certainly propose to have something like this: "target": ["dtmi:MeshSystems:core:device;1", "dtmi:MeshSystems:core:device;2"] instead of wildcards.

We have multiple OWL ontologies where the same relationship name is used with multiple targets to enforce specific hierarchies. We convert them to DTDL, but we currently have to ignore these targets because of this limitation.

Here's an example of how we represent this in OWL (TTL)

###  https://data.arcadis.com/otl/bridge#ArchBridge
:ArchBridge rdf:type owl:Class ;
            rdfs:subClassOf :Bridge ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty core:hasPart ;
                              owl:someValuesFrom :Arch
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty core:hasPart ;
                              owl:someValuesFrom :Crown
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty core:hasPart ;
                              owl:someValuesFrom :Extrados
                            ] ;
            skos:definition "A bridge whose main support structure is an arch. Additionally, the bridge may be termed a through arch, which is simply one where the roadway appears to go through the arch."@en ;
            skos:prefLabel "Arch Bridge"@en ;

the hasPart relationship should ideally be defined like this, which isn't possible

...
 "contents": [
 ...
  {
   "@type": "Relationship",
   "name": "hasPart",
   "target": ["dtmi:com:arcadis:bridge:Arch;1","dtmi:com:arcadis:bridge:Crown;1","dtmi:com:arcadis:bridge:Extrados;1"]
  }
 ]

We've considered the proposed workaround as well (multiple relationship names, creating an abstract class like ArchBridgePart), but as these ontologies are also used by other applications (RDF based), we don't want to adapt the ontologies to the limitations of DTDL. In addition, we're generating about 10000 DTDL models and it would blow up the size significantly (and it would add even more complexity to our internal OWL2DTDL implementation).

Our current workaround would be to store the targets in the comment and read those in the client (so not enforcing them in ADT). But this isn't really a sustainable workaround.

@jrdouceur
Copy link
Collaborator

Something we would like to suggest is for ADT to support a Target with multiple versions:

As it happens, ADT ignores the version suffix of Relationship targets. So, if your model specifies:

"target": "dtmi:MeshSystems:core:device;2"

Then the target of any Relationship instances can have type dtmi:MeshSystems:core:device;1, dtmi:MeshSystems:core:device;2, dtmi:MeshSystems:core:device;3, or dtmi:MeshSystems:core:device;10000.

If you are using DTDL v3, you can omit the version suffix from the target property value, which will make the matching semantics a bit clearer:

"target": "dtmi:MeshSystems:core:device"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants