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
Copy file name to clipboardExpand all lines: articles/digital-twins/how-to-query-graph.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Get digital twins by **properties** (including ID and metadata):
42
42
As shown in the query above, the ID of a digital twin is queried using the metadata field `$dtId`.
43
43
44
44
>[!TIP]
45
-
> If you are using Cloud Shell to run a query with metadata fields that begin with `$`, you should escape the `$` with a backtick to let Cloud Shell know it's not a variable and should be consumed as a literal in the query text.
45
+
> If you are using Cloud Shell to run a query with metadata fields that begin with `$`, you should escape the `$` with a backslash to let Cloud Shell know it's not a variable and should be consumed as a literal in the query text.
46
46
47
47
You can also get twins based on **whether a certain property is defined**. Here's a query that gets twins that have a defined *Location* property:
Copy file name to clipboardExpand all lines: articles/digital-twins/tutorial-command-line-cli.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -275,7 +275,7 @@ Run the following queries in the Cloud Shell to answer some questions about the
275
275
1. **What are all the rooms on floor0?** (query by relationship)
276
276
277
277
```azurecli-interactive
278
-
az dt twin query --dt-name <Azure-Digital-Twins-instance-name> --query-command "SELECT room FROM DIGITALTWINS floor JOIN room RELATED floor.contains where floor.`$dtId = 'floor0'"
278
+
az dt twin query --dt-name <Azure-Digital-Twins-instance-name> --query-command "SELECT room FROM DIGITALTWINS floor JOIN room RELATED floor.contains where floor.\$dtId = 'floor0'"
279
279
```
280
280
281
281
You can query based on relationships in your graph, to get information about how twins are connected or to restrict your query to a certain area. Only room0 is on floor0, so it's the only room in the result.
@@ -285,7 +285,7 @@ Run the following queries in the Cloud Shell to answer some questions about the
285
285
> [!NOTE]
286
286
> A twin's ID (like floor0 in the query above) is queried using the metadata field `$dtId`.
287
287
>
288
-
>When using Cloud Shell to run a query with metadata fields like this one that begin with `$`, you should escape the `$` with a backtick to let Cloud Shell know it's not a variable and should be consumed as a literal in the query text. This is reflected in the screenshot above.
288
+
>When using Cloud Shell to run a query with metadata fields like this one that begin with `$`, you should escape the `$` with a backslash to let Cloud Shell know it's not a variable and should be consumed as a literal in the query text. This is reflected in the screenshot above.
289
289
290
290
1. **What are all the twins in my environment with a temperature above 75?** (query by property)
291
291
@@ -300,7 +300,7 @@ Run the following queries in the Cloud Shell to answer some questions about the
300
300
1. **What are all the rooms on *floor0* with a temperature above 75?** (compound query)
301
301
302
302
```azurecli-interactive
303
-
az dt twin query --dt-name <Azure-Digital-Twins-instance-name> --query-command "SELECT room FROM DIGITALTWINS floor JOIN room RELATED floor.contains where floor.`$dtId = 'floor0' AND IS_OF_MODEL(room, 'dtmi:example:Room;2') AND room.Temperature > 75"
303
+
az dt twin query --dt-name <Azure-Digital-Twins-instance-name> --query-command "SELECT room FROM DIGITALTWINS floor JOIN room RELATED floor.contains where floor.\$dtId = 'floor0' AND IS_OF_MODEL(room, 'dtmi:example:Room;2') AND room.Temperature > 75"
304
304
```
305
305
306
306
You can also combine the earlier queries like you would in SQL, using combination operators such as `AND`, `OR`, `NOT`. This query uses `AND` to make the previous query about twin temperatures more specific. The result now only includes rooms with temperatures above 75 that are on floor0—which in this case, is none of them. The result set is empty.
0 commit comments