You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this tutorial, you'll build a graph in Azure Digital Twins using models, twins, and relationships. The tool for this tutorial is the sample command-line client application for interacting with an Azure Digital Twins instance. The client app is similar to the one written in [Code a client app](tutorial-code.md).
22
+
In this tutorial, you build a graph in Azure Digital Twins using models, twins, and relationships. The tool for this tutorial is the sample command-line client application for interacting with an Azure Digital Twins instance. The client app is similar to the one written in [Code a client app](tutorial-code.md).
23
23
24
24
You can use this sample to perform essential Azure Digital Twins actions such as uploading models, creating and modifying twins, and creating relationships. You can also look at the [code of the sample](https://github.com/Azure-Samples/digital-twins-samples/tree/main/) to learn about the Azure Digital Twins APIs, and practice implementing your own commands by modifying the sample project however you want.
25
25
@@ -36,13 +36,13 @@ In this tutorial, you will...
36
36
37
37
### Run the sample project
38
38
39
-
Now that the app and authentication are set up, open a local **console window**that you'll use to run the project. Navigate in the console to the *digital-twins-samples-main\AdtSampleApp\SampleClientApp* folder, and run the project with this dotnet command:
39
+
Now that the app and authentication are set up, open a local **console window** to run the project. Navigate in the console window to the *digital-twins-samples-main\AdtSampleApp\SampleClientApp* folder, and run the project with this dotnet command:
40
40
41
41
```cmd/sh
42
42
dotnet run
43
43
```
44
44
45
-
The project will start running, carry out authentication, and wait for a command.
45
+
The project starts running, carries out authentication, and waits for a command.
46
46
47
47
Here's a screenshot of what the project console looks like:
48
48
@@ -51,7 +51,7 @@ Here's a screenshot of what the project console looks like:
51
51
> [!TIP]
52
52
> For a list of all the possible commands you can use with this project, enter `help` in the project console and press return.
53
53
54
-
Once you've confirmed the app is running successfully, you can stop running the project. You'll run it again later in the tutorial.
54
+
Once you confirm that the app is running successfully, you can stop running the project. You run it again later in the tutorial.
55
55
56
56
## Model a physical environment with DTDL
57
57
@@ -62,7 +62,7 @@ The first step in creating an Azure Digital Twins solution is defining twin [mod
62
62
Models are similar to classes in object-oriented programming languages; they're user-defined templates that you can instantiate to create [digital twins](concepts-twins-graph.md). Models for Azure Digital Twins are written in a JSON-like language called *Digital Twins Definition Language (DTDL)*, and they define a type of twin in terms of its properties, relationships, and components.
63
63
64
64
> [!NOTE]
65
-
> DTDL also allows for the definition of commands on digital twins. However, commands are not currently supported in the Azure Digital Twins service.
65
+
> DTDL also allows for the definition of commands on digital twins. However, commands aren't currently supported in the Azure Digital Twins service.
66
66
67
67
In the sample project folder that you downloaded earlier, navigate into the *digital-twins-samples-main\AdtSampleApp\SampleClientApp\Models* folder. This folder contains sample models.
68
68
@@ -72,7 +72,7 @@ Open *Room.json* for editing, and make the following changes to the code:
72
72
73
73
### Upload models to Azure Digital Twins
74
74
75
-
After designing models, you need to upload them to your Azure Digital Twins instance. Doing so configures your Azure Digital Twins service instance with your own custom domain vocabulary. Once you've uploaded the models, you can create twin instances that use them.
75
+
After designing models, you need to upload them to your Azure Digital Twins instance. Doing so configures your Azure Digital Twins service instance with your own custom domain vocabulary. Once you upload the models, you can create twin instances that use them.
76
76
77
77
1. Return to your console window that's open to the *digital-twins-samples-main\AdtSampleApp\SampleClientApp* folder, and run the console app again with `dotnet run`.
78
78
@@ -84,7 +84,7 @@ After designing models, you need to upload them to your Azure Digital Twins inst
84
84
85
85
The output should indicate the models were created successfully.
86
86
87
-
1. Verify the models were created by running the command `GetModels true`. This command will print the full information for all the models that have been uploaded to your Azure Digital Twins instance. Look for the edited Room model in the results:
87
+
1. Verify the models were created by running the command `GetModels true`. This command prints the full information for all the models that are uploaded to your Azure Digital Twins instance. Look for the edited Room model in the results:
88
88
89
89
:::image type="content" source="media/tutorial-command-line/app/output-get-models.png" alt-text="Screenshot of the result from GetModels, showing the updated Room model." lightbox="media/tutorial-command-line/app/output-get-models.png":::
90
90
@@ -94,19 +94,19 @@ Keep the console app running for the next steps.
94
94
95
95
The sample application also handles errors from the service.
96
96
97
-
To test this, rerun the `CreateModels` command to try re-uploading the Room model that you've already uploaded:
97
+
To test this error handling, rerun the `CreateModels` command to try reuploading the Room model that you already uploaded:
98
98
99
99
```cmd/sh
100
100
CreateModels Room
101
101
```
102
102
103
-
As models cannot be overwritten, this command will now return a service error indicating that some of the model IDs you are trying to create already exist.
103
+
As models can't be overwritten, this command now returns a service error indicating that some of the model IDs that you're trying to create already exist.
104
104
105
105
For the details on how to delete existing models, see [Manage DTDL models](how-to-manage-model.md).
106
106
107
107
## Create digital twins
108
108
109
-
Now that some models have been uploaded to your Azure Digital Twins instance, you can create [digital twins](concepts-twins-graph.md) based on the model definitions. Digital twins represent the entities within your business environment—things like sensors on a farm, rooms in a building, or lights in a car.
109
+
Now that some models are uploaded to your Azure Digital Twins instance, you can create [digital twins](concepts-twins-graph.md) based on the model definitions. Digital twins represent the entities within your business environment—things like sensors on a farm, rooms in a building, or lights in a car.
110
110
111
111
To create a digital twin, you use the `CreateDigitalTwin` command. You must reference the model that the twin is based on, and can optionally define initial values for any properties in the model. You don't have to pass any relationship information at this stage.
112
112
@@ -129,7 +129,7 @@ To create a digital twin, you use the `CreateDigitalTwin` command. You must refe
129
129
130
130
### Modify a digital twin
131
131
132
-
You can also modify the properties of a twin you've created.
132
+
You can also modify the properties of a twin you created.
133
133
134
134
> [!NOTE]
135
135
> The underlying REST API uses [JSON Patch](http://jsonpatch.com/) format to define updates to a twin. The command-line app also uses this format, to give a truer experience with what the underlying APIs expect.
@@ -167,8 +167,8 @@ To add a relationship, use the `CreateRelationship` command. Specify the twin th
167
167
```
168
168
169
169
>[!TIP]
170
-
>The `contains` relationship in the [Floor model](https://github.com/azure-Samples/digital-twins-samples/blob/main/AdtSampleApp/SampleClientApp/Models/Floor.json) was also defined with two string properties, `ownershipUser` and `ownershipDepartment`, so you can also provide arguments with the initial values for these when you create the relationships.
171
-
> Here's an alternate version of the command above to create relationship0 that also specifies initial values for these properties:
170
+
>The `contains` relationship in the [Floor model](https://github.com/azure-Samples/digital-twins-samples/blob/main/AdtSampleApp/SampleClientApp/Models/Floor.json) was also defined with two string properties, `ownershipUser` and `ownershipDepartment`, so you can also provide arguments with the initial values for these properties when you create the relationships.
171
+
> Here's an alternate version of the previous command you used to create `relationship0` that also specifies initial values for these properties:
@@ -177,7 +177,7 @@ To add a relationship, use the `CreateRelationship` command. Specify the twin th
177
177
178
178
:::image type="content" source="media/tutorial-command-line/app/output-create-relationship.png" alt-text="Screenshot of an excerpt from the result of the CreateRelationship commands, which includes relationship0 and relationship1." lightbox="media/tutorial-command-line/app/output-create-relationship.png":::
179
179
180
-
1. You can verify the relationships with any of the following commands, which will print the relationships in your Azure Digital Twins instance.
180
+
1. You can verify the relationships with any of the following commands, which print the relationships in your Azure Digital Twins instance.
181
181
* To see all relationships coming off of each floor (viewing the relationships from one side):
182
182
```cmd/sh
183
183
GetRelationships floor0
@@ -194,7 +194,7 @@ To add a relationship, use the `CreateRelationship` command. Specify the twin th
194
194
GetRelationship floor1 relationship1
195
195
```
196
196
197
-
The twins and relationships you have set up in this tutorial form the following conceptual graph:
197
+
The twins and relationships you set up in this tutorial form the following conceptual graph:
198
198
199
199
:::image type="content" source="media/tutorial-command-line/app/sample-graph.png" alt-text="A diagram showing a conceptual graph. floor0 is connected via relationship0 to room0, and floor1 is connected via relationship1 to room1." border="false" lightbox="media/tutorial-command-line/app/sample-graph.png":::
200
200
@@ -217,7 +217,7 @@ Run the following commands in the running project console to answer some questio
217
217
:::image type="content" source="media/tutorial-command-line/app/output-query-all.png" alt-text="Screenshot showing a partial result from the twin query, including room0 and floor1.":::
218
218
219
219
>[!TIP]
220
-
>In the sample project, the command `Query` without any additional arguments is the equivalent of `Query SELECT * FROM DIGITALTWINS`. To query all the twins in your instance using the [Query APIs](/rest/api/digital-twins/dataplane/query) or the [CLI commands](/cli/azure/dt), use the longer (complete) query.
220
+
>In the sample project, the command `Query` without any other arguments is the equivalent of `Query SELECT * FROM DIGITALTWINS`. To query all the twins in your instance using the [Query APIs](/rest/api/digital-twins/dataplane/query) or the [CLI commands](/cli/azure/dt), use the longer (complete) query.
221
221
222
222
1. What are all the rooms in my environment? (query by model)
223
223
@@ -271,7 +271,7 @@ After completing this tutorial, you can choose which resources you want to remov
0 commit comments