Getting relationships
It is very handy to get relationships as we can get a related digital twin based on a relationship. An example of this is getting all the floors for a certain building. Relationships can be retrieved in two ways:
- Getting a single relationship: Get a relationship based on the source digital twin and the target digital twin.
- Getting a list of relationships: Get a list of relationships from a source digital twin.
Let's explain these in more detail. We will start by getting a single relationship.
Getting a single relationship
Let's start by creating a method that retrieves a relationship based on the source digital twin and the target digital twin. This allows us, for example, to access the properties specified for that relationship.
Create a new method for getting a relationship. Add the following code to the DigitalTwinsManager
class:
public BasicRelationship GetRelationship(string twinSourceId, string twinDestinationId)...