Skip to content

Commit 53b9413

Browse files
Merge pull request #296219 from DENKEN02MSFT/ADTFreshnessTop40_Row37
ADT Freshness - row 37
2 parents 04520ae + dabda7b commit 53b9413

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

articles/digital-twins/how-to-manage-graph.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ titleSuffix: Azure Digital Twins
55
description: Learn how to manage a graph of digital twins by connecting them with relationships.
66
author: baanders
77
ms.author: baanders # Microsoft employees only
8-
ms.date: 10/3/2023
8+
ms.date: 03/10/2025
99
ms.topic: how-to
1010
ms.service: azure-digital-twins
1111
ms.custom: engagement-fy23
@@ -20,7 +20,7 @@ ms.custom: engagement-fy23
2020

2121
The heart of Azure Digital Twins is the [twin graph](concepts-twins-graph.md) representing your whole environment. The twin graph is made of individual digital twins connected via **relationships**. This article focuses on managing relationships and the graph as a whole; to work with individual digital twins, see [Manage digital twins](how-to-manage-twin.md).
2222

23-
Once you have a working [Azure Digital Twins instance](how-to-set-up-instance-portal.md) and have set up [authentication](how-to-authenticate-client.md) code in your client app, you can create, modify, and delete digital twins and their relationships in an Azure Digital Twins instance.
23+
Once you have a working [Azure Digital Twins instance](how-to-set-up-instance-portal.md) and set up [authentication](how-to-authenticate-client.md) code in your client app, you can create, modify, and delete digital twins and their relationships in an Azure Digital Twins instance.
2424

2525
## Prerequisites
2626

@@ -40,10 +40,10 @@ Relationships describe how different digital twins are connected to each other,
4040
The types of relationships that can be created from one (source) twin to another (target) twin are defined as part of the source twin's [DTDL model](concepts-models.md#relationships). You can create an instance of a relationship by using the `CreateOrReplaceRelationshipAsync()` SDK call with twins and relationship details that follow the DTDL definition.
4141

4242
To create a relationship, you need to specify:
43-
* The source twin ID (`srcId` in the code sample below): The ID of the twin where the relationship originates.
44-
* The target twin ID (`targetId` in the code sample below): The ID of the twin where the relationship arrives.
45-
* A relationship name (`relName` in the code sample below): The generic type of relationship, something like _contains_.
46-
* A relationship ID (`relId` in the code sample below): The specific name for this relationship, something like _Relationship1_.
43+
* The source twin ID (`srcId` in the following code sample): The ID of the twin where the relationship originates.
44+
* The target twin ID (`targetId` in the following code sample): The ID of the twin where the relationship arrives.
45+
* A relationship name (`relName` in the following code sample): The generic type of relationship, something like _contains_.
46+
* A relationship ID (`relId` in the following code sample): The specific name for this relationship, something like _Relationship1_.
4747

4848
The relationship ID must be unique within the given source twin. It doesn't need to be globally unique.
4949
For example, for the twin Foo, each specific relationship ID must be unique. However, another twin Bar can have an outgoing relationship that matches the same ID of a Foo relationship.
@@ -74,22 +74,22 @@ This fact means that you can express several different types of relationships be
7474
You can even create multiple instances of the same type of relationship between the same two twins, if you want. In this example, Twin A could have two different *stored* relationships with Twin B, as long as the relationships have different relationship IDs.
7575

7676
> [!NOTE]
77-
> The DTDL attributes of `minMultiplicity` and `maxMultiplicity` for relationships aren't currently supported in Azure Digital Twinseven if they're defined as part of a model, they won't be enforced by the service. For more information, see [Service-specific DTDL notes](concepts-models.md#service-specific-dtdl-notes).
77+
> The service doesn't currently support or enforce the DTDL attributes of `minMultiplicity` and `maxMultiplicity` for relationships in Azure Digital Twins, even if they're defined as part of a model. For more information, see [Service-specific DTDL notes](concepts-models.md#service-specific-dtdl-notes).
7878
7979
### Create relationships in bulk with the Import Jobs API
8080

81-
You can use the [Import Jobs API](concepts-apis-sdks.md#bulk-import-with-the-import-jobs-api) to create many relationships at once in a single API call. This method requires the use of [Azure Blob Storage](../storage/blobs/storage-blobs-introduction.md), as well as [write permissions](concepts-apis-sdks.md#check-permissions) in your Azure Digital Twins instance for relationships and bulk jobs.
81+
You can use the [Import Jobs API](concepts-apis-sdks.md#bulk-import-with-the-import-jobs-api) to create many relationships at once in a single API call. This method requires the use of [Azure Blob Storage](../storage/blobs/storage-blobs-introduction.md), and [write permissions](concepts-apis-sdks.md#check-permissions) in your Azure Digital Twins instance for relationships and bulk jobs.
8282

8383
>[!TIP]
8484
>The Import Jobs API also allows models and twins to be imported in the same call, to create all parts of a graph at once. For more about this process, see [Upload models, twins, and relationships in bulk with the Import Jobs API](#upload-models-twins-and-relationships-in-bulk-with-the-import-jobs-api).
8585
86-
To import relationships in bulk, you'll need to structure your relationships (and any other resources included in the bulk import job) as an *NDJSON* file. The `Relationships` section comes after the `Twins` section, making it the last graph data section in the file. Relationships defined in the file can reference twins that are either defined in this file or already present in the instance, and they can optionally include initialization of any properties that the relationships have.
86+
To import relationships in bulk, you need to structure your relationships (and any other resources included in the bulk import job) as an *NDJSON* file. The `Relationships` section comes after the `Twins` section, making it the last graph data section in the file. Relationships defined in the file can reference twins that are either defined in this file or already present in the instance, and they can optionally include initialization of any properties that the relationships have.
8787

8888
You can view an example import file and a sample project for creating these files in the [Import Jobs API introduction](concepts-apis-sdks.md#bulk-import-with-the-import-jobs-api).
8989

9090
[!INCLUDE [digital-twins-bulk-blob.md](../../includes/digital-twins-bulk-blob.md)]
9191

92-
Then, the file can be used in an [Import Jobs API](/rest/api/digital-twins/dataplane/jobs) call. You'll provide the blob storage URL of the input file, as well as a new blob storage URL to indicate where you'd like the output log to be stored when it's created by the service.
92+
Then, the file can be used in an [Import Jobs API](/rest/api/digital-twins/dataplane/jobs) call. You provide the blob storage URL of the input file, and a new blob storage URL to indicate where you'd like the output log to be stored after the service creates it.
9393

9494
## List relationships
9595

@@ -134,7 +134,7 @@ You can now call this custom method to see the incoming relationships of the twi
134134

135135
### List all twin properties and relationships
136136

137-
Using the above methods for listing outgoing and incoming relationships to a twin, you can create a method that prints full twin information, including the twin's properties and both types of its relationships. Here's an example custom method showing how to combine the above custom methods for this purpose.
137+
Using the previous methods for listing outgoing and incoming relationships to a twin, you can create a method that prints full twin information, including the twin's properties and both types of its relationships. Here's an example custom method showing how to combine the previous custom methods for this purpose.
138138

139139
:::code language="csharp" source="~/digital-twins-docs-samples/sdks/csharp/graph_operations_sample.cs" id="FetchAndPrintMethod":::
140140

@@ -147,7 +147,7 @@ You can now call this custom function like this:
147147
Relationships are updated using the `UpdateRelationship` method.
148148

149149
>[!NOTE]
150-
>This method is for updating the **properties** of a relationship. If you need to change the source twin or target twin of the relationship, you'll need to [delete the relationship](#delete-relationships) and [re-create one](#create-relationships) using the new twins.
150+
>This method is for updating the **properties** of a relationship. If you need to change the source twin or target twin of the relationship, you need to [delete the relationship](#delete-relationships) and [re-create one](#create-relationships) using the new twins.
151151
152152
The required parameters for the client call are:
153153
- The ID of the source twin (the twin where the relationship originates).
@@ -182,15 +182,15 @@ This section describes strategies for creating a graph with multiple elements at
182182

183183
### Upload models, twins, and relationships in bulk with the Import Jobs API
184184

185-
You can use the [Import Jobs API](concepts-apis-sdks.md#bulk-import-with-the-import-jobs-api) to upload multiple models, twins, and relationships to your instance in a single API call, effectively creating the graph all at once. This method requires the use of [Azure Blob Storage](../storage/blobs/storage-blobs-introduction.md), as well as [write permissions](concepts-apis-sdks.md#check-permissions) in your Azure Digital Twins instance for graph elements (models, twins, and relationships) and bulk jobs.
185+
You can use the [Import Jobs API](concepts-apis-sdks.md#bulk-import-with-the-import-jobs-api) to upload multiple models, twins, and relationships to your instance in a single API call, effectively creating the graph all at once. This method requires the use of [Azure Blob Storage](../storage/blobs/storage-blobs-introduction.md), and [write permissions](concepts-apis-sdks.md#check-permissions) in your Azure Digital Twins instance for graph elements (models, twins, and relationships) and bulk jobs.
186186

187187
To import resources in bulk, start by creating an *NDJSON* file containing the details of your resources. The file starts with a `Header` section, followed by the optional sections `Models`, `Twins`, and `Relationships`. You don't have to include all three types of graph data in the file, but any sections that are present must follow that order. Twins defined in the file can reference models that are either defined in this file or already present in the instance, and they can optionally include initialization of the twin's properties. Relationships defined in the file can reference twins that are either defined in this file or already present in the instance, and they can optionally include initialization of relationship properties.
188188

189189
You can view an example import file and a sample project for creating these files in the [Import Jobs API introduction](concepts-apis-sdks.md#bulk-import-with-the-import-jobs-api).
190190

191191
[!INCLUDE [digital-twins-bulk-blob.md](../../includes/digital-twins-bulk-blob.md)]
192192

193-
Then, the file can be used in an [Import Jobs API](/rest/api/digital-twins/dataplane/jobs) call. You'll provide the blob storage URL of the input file, as well as a new blob storage URL to indicate where you'd like the output log to be stored when it's created by the service.
193+
Then, the file can be used in an [Import Jobs API](/rest/api/digital-twins/dataplane/jobs) call. You provide the blob storage URL of the input file, and a new blob storage URL to indicate where you'd like the output log to be stored after the service creates it.
194194

195195
### Import graph with Azure Digital Twins Explorer
196196

@@ -213,7 +213,7 @@ Consider the following data table, describing a set of digital twins and relatio
213213

214214
One way to get this data into Azure Digital Twins is to convert the table to a CSV file. Once the table is converted, code can be written to interpret the file into commands to create twins and relationships. The following code sample illustrates reading the data from the CSV file and creating a twin graph in Azure Digital Twins.
215215

216-
In the code below, the CSV file is called *data.csv*, and there's a placeholder representing the **host name** of your Azure Digital Twins instance. The sample also makes use of several packages that you can add to your project to help with this process.
216+
In the following code, the CSV file is called *data.csv*, and there's a placeholder representing the **host name** of your Azure Digital Twins instance. The sample also makes use of several packages that you can add to your project to help with this process.
217217

218218
:::code language="csharp" source="~/digital-twins-docs-samples/sdks/csharp/graphFromCSV.cs":::
219219

@@ -238,19 +238,19 @@ Then, **copy the following code** of the runnable sample into your project:
238238
Next, complete the following steps to configure your project code:
239239
1. Add the **Room.json** and **Floor.json** files you downloaded earlier to your project, and replace the `<path-to>` placeholders in the code to tell your program where to find them.
240240
1. Replace the placeholder `<your-instance-hostname>` with your Azure Digital Twins instance's host name.
241-
1. Add two dependencies to your project that will be needed to work with Azure Digital Twins. The first is the package for the [Azure Digital Twins SDK for .NET](/dotnet/api/overview/azure/digitaltwins.core-readme), and the second provides tools to help with authentication against Azure.
241+
1. Add two dependencies to your project that are needed to work with Azure Digital Twins. The first is the package for the [Azure Digital Twins SDK for .NET](/dotnet/api/overview/azure/digitaltwins.core-readme), and the second provides tools to help with authentication against Azure.
242242

243243
```cmd/sh
244244
dotnet add package Azure.DigitalTwins.Core
245245
dotnet add package Azure.Identity
246246
```
247247
248-
You'll also need to set up local credentials if you want to run the sample directly. The next section walks through this process.
248+
You also need to set up local credentials if you want to run the sample directly. The next section walks through this process.
249249
[!INCLUDE [Azure Digital Twins: local credentials prereq (outer)](../../includes/digital-twins-local-credentials-outer.md)]
250250
251251
### Run the sample
252252
253-
Now that you've completed setup, you can run the sample code project.
253+
Now that you completed setup, you can run the sample code project.
254254
255255
Here's the console output of the program:
256256

0 commit comments

Comments
 (0)