I am trying to understand and set the displayName on a relationship.
My mode is a car, that has multiple tires:
{
"@id": "dtmi:kevinsay:vehicle;1",
"@type": "Interface",
"displayName": "Vehicle",
"contents": [
{
"@type": "Relationship",
"name": "tires",
"maxMultiplicity": 5,
"displayName": "string"
},
{
"@type": "Property",
"name": "Model",
"schema": "string"
}
],
"@context": "dtmi:dtdl:context;2"
}
and I have a tire
{
"@id": "dtmi:kevinsay:Tire;1",
"@type": "Interface",
"displayName": "Tire",
"contents": [
{
"@type": "Relationship",
"name": "tpms"
},
{
"@type": "Property",
"name": "Manufacturer",
"schema": "string"
}
],
"@context": "dtmi:dtdl:context;2"
}
I easily create a car and a tire:
az dt twin create --dt-name kevinsay --dtmi "dtmi:kevinsay:vehicle;1" --twin-id "Lincoln" --properties '{"Model":"Continential"}'
az dt twin create --dt-name kevinsay --dtmi "dtmi:kevinsay:Tire;1" --twin-id "lincoln1" --properties '{"Manufacturer": "Goodyear"}'
The challenge is building the relationship of the tire to the car trying to specify the displayName.
This works:
az dt twin relationship create --dt-name kevinsay --relationship-id leftFront --relationship tires --twin-id Lincoln --target lincoln1
but this will not:
az dt twin relationship create --dt-name kevinsay --relationship-id leftFront --relationship tires --twin-id Lincoln --target lincoln1 -p '{"displayName": "leftFront"}'
I get the error message:
And Digital Twin explorer shows the displayName on the tires relationship:
any help would be appreciated
After much research, I found that I was asking the wrong question. Instead of trying to set a displayName -- something that the relationship object did not have, I had to set the relationship-id, which was controlled by the '--relationship-id' flag.