Skip to content

Commit 645ef64

Browse files
author
Jill Grant
authored
Merge pull request #285930 from timlt/main
Curate PnP modeling content
2 parents c6c5a05 + 70ef80a commit 645ef64

File tree

5 files changed

+50
-59
lines changed

5 files changed

+50
-59
lines changed

.openpublishing.redirection.iot-develop.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,11 @@
350350
"redirect_url": "/azure/iot/concepts-model-parser",
351351
"redirect_document_id": false
352352
},
353+
{
354+
"source_path_from_root": "/articles/iot/concepts-model-parser.md",
355+
"redirect_url": "/azure/iot/concepts-modeling-guide",
356+
"redirect_document_id": false
357+
},
353358
{
354359
"source_path_from_root": "/articles/iot-pnp/concepts-model-repository.md",
355360
"redirect_url": "/azure/iot/concepts-model-discovery",

articles/iot/TOC.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ items:
115115
href: concepts-modeling-guide.md
116116
- name: Use models in a solution
117117
href: concepts-model-discovery.md
118-
- name: Model parser
119-
href: concepts-model-parser.md
120118
- name: MQTT support
121119
items:
122120
- name: Use MQTT with IoT Hub

articles/iot/concepts-model-discovery.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use IoT Plug and Play models in a solution | Microsoft Docs
33
description: As a solution builder, learn about how you can use IoT Plug and Play models in your IoT solution.
44
author: dominicbetts
55
ms.author: dobett
6-
ms.date: 03/13/2024
6+
ms.date: 08/30/2024
77
ms.topic: conceptual
88
ms.service: iot
99
---
@@ -105,7 +105,7 @@ content-encoding:utf-8
105105

106106
## Retrieve a model definition
107107

108-
A solution uses model ID identified above to retrieve the corresponding model definition.
108+
A solution uses the model ID identified previously to retrieve the corresponding model definition.
109109

110110
A solution can get the model definition by using one of the following options:
111111

@@ -149,7 +149,7 @@ dtmi:com:example:Thermostat;1
149149
dtmi:azure:DeviceManagement:DeviceInformation;1
150150
```
151151

152-
The `ModelsRepositoryClient` can be configured to query a custom DMR -available through http(s)- and to specify the dependency resolution by using the `ModelDependencyResolution` flag:
152+
The `ModelsRepositoryClient` can be configured to query a custom DMR--available through https--and to specify the dependency resolution by using the `ModelDependencyResolution` flag:
153153

154154
- Disabled. Returns the specified interface only, without any dependency.
155155
- Enabled. Returns all the interfaces in the dependency chain
@@ -188,7 +188,7 @@ After you identify the model ID for a new device connection, follow these steps:
188188

189189
## Next steps
190190

191-
Now that you've learned how to integrate IoT Plug and Play models in an IoT solution, some suggested next steps are:
191+
Now that you learned how to integrate IoT Plug and Play models in an IoT solution, some suggested next steps are:
192192

193193
- [Interact with a device from your solution](tutorial-service.md)
194194
- [IoT Digital Twin REST API](/rest/api/iothub/service/digitaltwin)

articles/iot/concepts-model-parser.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

articles/iot/concepts-modeling-guide.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Understand IoT Plug and Play device models | Microsoft Docs
33
description: Understand the Digital Twins Definition Language (DTDL) modeling language for IoT Plug and Play devices. The article describes primitive and complex datatypes, reuse patterns that use components and inheritance, and semantic types. The article provides guidance on the choice of device twin model identifier and tooling support for model authoring.
44
author: dominicbetts
55
ms.author: dobett
6-
ms.date: 1/23/2024
6+
ms.date: 08/30/2024
77
ms.topic: conceptual
88
ms.service: iot
99

@@ -565,7 +565,7 @@ Because the geospatial types are array-based, they can't currently be used in pr
565565

566566
## Semantic types
567567

568-
The data type of a property or telemetry definition specifies the format of the data that a device exchanges with a service. The semantic type provides information about telemetry and properties that an application can use to determine how to process or display a value. Each semantic type has one or more associated units. For example, celsius and fahrenheit are units for the temperature semantic type. IoT Central dashboards and analytics can use the semantic type information to determine how to plot telemetry or property values and display units. To learn how you can use the model parser to read the semantic types, see [Understand the digital twins model parser](concepts-model-parser.md).
568+
The data type of a property or telemetry definition specifies the format of the data that a device exchanges with a service. The semantic type provides information about telemetry and properties that an application can use to determine how to process or display a value. Each semantic type has one or more associated units. For example, celsius and fahrenheit are units for the temperature semantic type. IoT Central dashboards and analytics can use the semantic type information to determine how to plot telemetry or property values and display units. To learn how you can use the model parser to read the semantic types, see [Understand the Digital Twins model parser](#understand-the-digital-twins-model-parser).
569569

570570
The following snippet shows an example telemetry definition that includes semantic type information. The semantic type `Temperature` is added to the `@type` array, and the `unit` value, `degreeCelsius` is one of the valid units for the semantic type:
571571

@@ -583,7 +583,7 @@ The following snippet shows an example telemetry definition that includes semant
583583

584584
## Localization
585585

586-
Applications, such as IoT Central, use information in the model to dynamically build a UI around the data that's exchanged with an IoT Plug and Play device. For example, tiles on a dashboard can display names and descriptions for telemetry, properties, and commands.
586+
Applications, such as IoT Central, use information in the model to dynamically build a UI around the data exchanged with an IoT Plug and Play device. For example, tiles on a dashboard can display names and descriptions for telemetry, properties, and commands.
587587

588588
The optional `description` and `displayName` fields in the model hold strings intended for use in a UI. These fields can hold localized strings that an application can use to render a localized UI.
589589

@@ -644,7 +644,7 @@ There's a DTDL authoring extension for VS Code that supports both DTDL v2 and DT
644644

645645
To install the DTDL extension for VS Code, go to [DTDL editor for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-dtdl). You can also search for **DTDL** in the **Extensions** view in VS Code.
646646

647-
When you've installed the extension, use it to help you author DTDL model files in VS Code:
647+
After you install the extension, use it to help you author DTDL model files in VS Code:
648648

649649
- The extension provides syntax validation in DTDL model files, highlighting errors as shown on the following screenshot:
650650

@@ -663,7 +663,7 @@ Applications, such as IoT Central, use device models. In IoT Central, a model is
663663
> [!NOTE]
664664
> IoT Central defines some extensions to the DTDL language. To learn more, see [IoT Central extension](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/DTDL.iotcentral.v2.md).
665665

666-
A custom solution can use the [digital twins model parser](concepts-model-parser.md) to understand the capabilities of a device that implements the model. To learn more, see [Use IoT Plug and Play models in an IoT solution](concepts-model-discovery.md).
666+
A custom solution can use the [Digital Twins model parser](#understand-the-digital-twins-model-parser) to understand the capabilities of a device that implements the model. To learn more, see [Use IoT Plug and Play models in an IoT solution](concepts-model-discovery.md).
667667

668668
### Version
669669

@@ -675,7 +675,7 @@ IoT Central implements more versioning rules for device models. If you version a
675675

676676
### Publish
677677

678-
As of February 2024, the Azure Certified Device program has been retired. Therefore, Microsoft is no longer accepting submissions of DTDL models to the[Azure IoT plug and play models](https://github.com/Azure/iot-plugandplay-models) repository.
678+
As of February 2024, the Azure Certified Device program is retired. Therefore, Microsoft is no longer accepting submissions of DTDL models to the[Azure IoT plug and play models](https://github.com/Azure/iot-plugandplay-models) repository.
679679

680680
If you want to set up your own model repository, you can use the [Azure IoT plug and play models tools](https://github.com/Azure/iot-plugandplay-models-tools) repository. This repository includes the code for the `dmr-client` CLI tool that can validate, import, and expand DTDL models. This tool also lets you index model repositories that follow the device model repository conventions.
681681

@@ -689,9 +689,43 @@ The following list summarizes some key constraints and limits on models:
689689
- An interface can extend at most two other interfaces.
690690
- A component can't contain another component.
691691

692+
## Understand the Digital Twins model parser
693+
694+
The Digital Twins Definition Language (DTDL) is described in the [DTDL Specification](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/README.md). Users can use the _Digital Twins Model Parser_ NuGet package to validate and query a DTDL v2 or v3 model. The DTDL model can be defined in multiple files.
695+
696+
### Install the DTDL model parser
697+
698+
The parser is available in NuGet.org with the ID: [DTDLParser](https://www.nuget.org/packages/DTDLParser). To install the parser, use any compatible NuGet package manager such as the one in Visual Studio or in the `dotnet` CLI.
699+
700+
```bash
701+
dotnet add package DTDLParser
702+
```
703+
704+
> [!NOTE]
705+
> At the time of writing, the parser version is `1.0.52`.
706+
707+
### Use the parser to validate and inspect a model
708+
709+
The DTDLParser is a library that you can use to:
710+
711+
- Determine whether one or more models are valid according to the language v2 or v3 specifications.
712+
- Identify specific modeling errors.
713+
- Inspect model contents.
714+
715+
A model can be composed of one or more interfaces described in JSON files. You can use the parser to load all the files that define a model and then validate all the files as a whole, including any references between the files.
716+
717+
The [DTDLParser for .NET](https://github.com/digitaltwinconsortium/DTDLParser) repository includes the following samples that illustrate the use of the parser:
718+
719+
- [DTDLParserResolveSample](https://github.com/digitaltwinconsortium/DTDLParser/blob/main/samples/DTDLParserResolveSample) shows how to parse an interface with external references, resolve the dependencies using the `Azure.IoT.ModelsRepository` client.
720+
- [DTDLParserJSInteropSample](https://github.com/digitaltwinconsortium/DTDLParser/blob/main/samples/DTDLParserJSInteropSample) shows how to use the DTDL Parser from JavaScript running in the browser, using .NET JSInterop.
721+
722+
The DTDLParser for .NET repository also includes a [collection of tutorials](https://github.com/digitaltwinconsortium/DTDLParser/blob/main/tutorials/README.md) that show you how to use the parser to validate and inspect models.
723+
724+
The model parser API enables many scenarios to automate or validate tasks that depend on DTDL models. For example, you could dynamically build a UI from the information in the model.
725+
692726
## Next steps
693727

694-
Now that you've learned about device modeling, here are some more resources:
728+
Now that you learned about device modeling, here are some more resources:
695729

696730
- [Digital Twins Definition Language (DTDL)](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/README.md)
697731
- [Model repositories](./concepts-model-discovery.md)

0 commit comments

Comments
 (0)