Mapped.Ontologies.Mappings
0.2.10.62
See the version list below for details.
dotnet add package Mapped.Ontologies.Mappings --version 0.2.10.62
NuGet\Install-Package Mapped.Ontologies.Mappings -Version 0.2.10.62
<PackageReference Include="Mapped.Ontologies.Mappings" Version="0.2.10.62" />
paket add Mapped.Ontologies.Mappings --version 0.2.10.62
#r "nuget: Mapped.Ontologies.Mappings, 0.2.10.62"
// Install Mapped.Ontologies.Mappings as a Cake Addin #addin nuget:?package=Mapped.Ontologies.Mappings&version=0.2.10.62 // Install Mapped.Ontologies.Mappings as a Cake Tool #tool nuget:?package=Mapped.Ontologies.Mappings&version=0.2.10.62
Ontology Mapper
Motivation and purpose
The OntologyMapper allows developers to define conversion processes from one DTDL-based Ontology to a different DTDL-based Ontology.
This may be needed in cases where cloning a topology which uses a propriety ontology, and converting to an open standard ontology such as RealEstateCore.
These conversion rules are defined in a series of Mappings files here in the repo which are embedded in the assembly to make versioning easier.
The key is that these files describe exceptions only. If the source DTMI and Target DTMI are identical, nothing needs to appear for the mapping between the two. Thus, if an source and target use the same ontology and version, the mapping file will have very little content.
This library provides helpers useful for mapping one Digital Twins Definition Language (DTDL) model to a different DTDL model. It defines a set of classes which allow the following types to be mapped:
- Interfaces
- Relationships
- Property Projections
- Backfilling of Properties
- Object Transformations
A json file can be created with collections of these types of mappings, and then that can be used in a process which uses one DTDL ontology as an input and outputs a different DTDL ontology.
File Sections
Header
The header section is for informational purposes designating the source and destination DTDLs. This is to provide an at-a-glance summary of what DTDLs this file maps.
Input Ontologies
A collection of what ontologies make up the input source for the conversion
Field | Description |
---|---|
Name | The name of the ontology |
Version | The version of the ontology |
DtdlVersion | Which version of the DTDL language is currently in use for this provider |
Output Ontologies
A collection of what ontologies make up the output source for the conversion
Field | Description |
---|---|
Name | The name of the ontology |
Version | The version of the ontology |
DtdlVersion | Which version of the DTDL language is currently in use for this provider |
NamespaceRemaps
A collection of mappings from one namespace name to another namespace name. This is used after the explicit InterfaceRemaps to execute a simple search and replace of a string in an input model to convert it to an output model. That is, in those cases where the input model interface name is exactly the same as the output model interface name, but the namespace is different, then the input model''s namespace will be replaced by the NamespaceRemap's output namespace.
Field | Description |
---|---|
InputNamespace | The string to search for in the input dtmi |
OutputNamespace | The replacement string |
InterfaceRemaps
A collection of mappings from one interface name to another interface name. It is suggested that you only need to list mappings where the input DTMI is not the same as the output DTMI. Systems should assume that if a DTMI is not listed in the mappings, that the output DTMI will be the same as the input DTMI.
Field | Description |
---|---|
InputDtmi | The name of the input DTMI |
OutputDtmi | The name of the output DTMI |
RelationshipRemaps
A collection of mappings from one relationship name to another relationship name. It is suggested that you only need to list mappings where the input relationship is not the same as the output relationship. Systems should assume that if a relationship is not listed in the mappings, that the output relationship will be the same as the input relationship.
Field | Description |
---|---|
InputDtmi | The name of the input relationship |
OutputDtmi | The name of the output relationship |
ReverseRelationshipDirection | The relationship direction can be reversed so that if the original relationship is from source to target, the new relationship will be from target to source |
PropertyProjections
A collection of mappings from one property name to another property name. It is suggested that you only need to list mappings where the input property is not the same as the output property. Systems should assume that if a property is not listed in the mappings, that the output property will be the same as the input property.
Field | Description |
---|---|
OutputDtmiFilter | A regex filter which allows filtering so that the mapping is only applied to output property names which match the filter. ".*" to apply to all output properties |
OutputPropertyName | The name of the output property to assign the input property to |
InputPropertyNames | A collection of names of the input property to assign to the output property. Can only specify multiple input properties if the output property is a collection |
IsOutputPropertyCollection | A flag which indicates whether or not the output property is a collection or not. This allows an input property which is not a collection to be assigned as an element in the output collection. |
Priority | If there are multiple projections for a single output property based on different DtmiFilters, priority is taken into account in ascending order |
FillProperties
A collection of mappings from one or more property names to another property name so that if the output property is a required value and the input fields might be empty, that alternative fields can be used to populate the output field. It is suggested that you only need to list mappings where the input property is not the same as the output property. Systems should assume that if a property is not listed in the mappings, that the output property will be the same as the input property. Implementations should respect the order in which the input properties are specified so that the first non-empty valued input property is assigned to the output property
Field | Description |
---|---|
OutputDtmiFilter | A regex filter which allows filtering so that the mapping is only applied to output property names which match the filter. ".*" to apply to all output properties |
OutputPropertyName | The name of the output property to assign the input property to |
InputPropertyNames | A collection of names of the input property to assign to the output property. Can only specify multiple input properties if the output property is a collection |
Priority | If there are multiple fillproperties for a single output property based on different DtmiFilters, priority is taken into account in ascending order |
ObjectTransformations
In some cases, a property of the input model contains an object where one of the properties of that object needs to be put into a different field in the target model. A declaration can be made to map the input field to the appropriate output field.
Field | Description |
---|---|
OutputDtmiFilter | A regex filter which allows filtering so that the mapping is only applied to output property names which match the filter. ".*" to apply to all output properties |
OutputPropertyName | The name of the output property to assign the input property to |
InputProperty | The input property to use as the parent of the InputPropertyName |
InputPropertyName | The names of the input property to assign to the output property |
Priority | If there are multiple object transformations for a single output property based on different DtmiFilters, priority is taken into account in ascending order |
Sample File
"Header": {
"InputOntologies": [
{
"Name": "input-ontology-name",
"Version": "1.0",
"DtdlVersion": "v2"
}
],
"OutputOntologies": [
{
"Name": "output-ontology-name",
"Version": "2.0",
"DtdlVersion": "v3"
}
]
},
"NamespaceRemaps": [
{
"InputDtmi": "dtmi:source-namespace:",
"OutputDtmi": "dtmi:target-namespace:"
},
],
"InterfaceRemaps": [
{
"InputDtmi": "dtmi:source-namespace:source-interface-name;1",
"OutputDtmi": "dtmi:target-namespace:target-interface;1"
},
],
"RelationshipRemaps": [
{
"InputRelationship": "source-relationship-name",
"OutputRelationship": "target-relationship-name"
"ReverseRelationshipDirection": true | false
}
],
"PropertyProjections": [
{
"OutputDtmiFilter": ".*",
"OutputPropertyName": "output-property-name",
"InputPropertyNames": [ "input-property-name1", "input-property-name2" ],
"IsOutputPropertyCollection": true
},
{
"OutputDtmiFilter": "\w*Space\w*",
"OutputPropertyName": "output-property-name",
"InputPropertyNames": [ "input-property-name2" ],
"IsOutputPropertyCollection": true
}
],
"FillProperties": [
{
"OutputDtmiFilter": ".*",
"OutputPropertyName": "output-property-name",
"InputPropertyNames": [ "input-property-name1, input-property-name2" ]
},
{
"OutputDtmiFilter": "\w*Space\w*",
"OutputPropertyName": "output-property-name",
"InputPropertyNames": [ "input-property-name2, input-property-name1" ]
}
],
"ObjectTransformations" : [
{
"inputProperty": "unit",
"inputPropertyName": "id",
"outputDtmiFilter": "*.",
"outputProperty": "flatunit",
"priority": 1
}
]
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- DTDLParser (>= 1.0.52)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.14.100 | 2,560 | 6/10/2024 |
0.3.13.99 | 97 | 6/10/2024 |
0.3.12.98 | 107 | 6/7/2024 |
0.3.11.97 | 101 | 6/7/2024 |
0.3.10.96 | 97 | 6/7/2024 |
0.3.9.95 | 97 | 6/7/2024 |
0.3.8.94 | 149 | 6/5/2024 |
0.3.7.93 | 242 | 5/30/2024 |
0.3.6.92 | 507 | 5/1/2024 |
0.3.4.90 | 201 | 4/19/2024 |
0.3.3.89 | 89 | 4/19/2024 |
0.3.2.88 | 89 | 4/19/2024 |
0.3.1.87 | 128 | 4/10/2024 |
0.2.31.85 | 211 | 4/4/2024 |
0.2.30.84 | 270 | 3/28/2024 |
0.2.29.83 | 108 | 3/28/2024 |
0.2.28.82 | 123 | 3/27/2024 |
0.2.27.81 | 184 | 3/26/2024 |
0.2.26.80 | 161 | 3/22/2024 |
0.2.25.79 | 222 | 3/22/2024 |
0.2.24.78 | 119 | 3/22/2024 |
0.2.23.77 | 114 | 3/21/2024 |
0.2.21.75 | 112 | 3/21/2024 |
0.2.20.74 | 112 | 3/21/2024 |
0.2.19.73 | 107 | 3/21/2024 |
0.2.18.72 | 247 | 3/18/2024 |
0.2.17.71 | 123 | 3/15/2024 |
0.2.16.70 | 139 | 3/15/2024 |
0.2.15.69 | 475 | 2/23/2024 |
0.2.14.68 | 213 | 2/13/2024 |
0.2.11.63 | 312 | 1/5/2024 |
0.2.10.62 | 181 | 12/12/2023 |
0.2.9.61 | 146 | 12/11/2023 |
0.2.8.60 | 162 | 12/7/2023 |
0.2.7.59 | 146 | 12/5/2023 |
0.2.6.58 | 263 | 11/29/2023 |
0.2.5.57 | 177 | 11/15/2023 |
0.2.4.56 | 139 | 11/7/2023 |
0.2.3.55 | 163 | 11/3/2023 |
0.2.2.54 | 235 | 10/16/2023 |
0.2.1.53 | 184 | 10/12/2023 |
0.2.0.52 | 155 | 10/4/2023 |
0.1.31.51 | 134 | 9/21/2023 |
0.1.30.50 | 151 | 9/20/2023 |
0.1.29.49 | 158 | 9/19/2023 |
0.1.28.48 | 164 | 9/15/2023 |
0.1.27.47 | 161 | 9/15/2023 |
0.1.26.46 | 168 | 9/13/2023 |
0.1.25.45 | 183 | 9/7/2023 |
0.1.24.44 | 160 | 9/6/2023 |
0.1.23.43 | 173 | 8/25/2023 |
0.1.22.42 | 148 | 8/23/2023 |
0.1.21.41 | 156 | 8/23/2023 |
0.1.20.40 | 236 | 8/22/2023 |
0.1.17.37 | 216 | 8/18/2023 |
0.1.13.33 | 183 | 8/15/2023 |
0.1.12.32 | 171 | 8/13/2023 |
0.1.10.30 | 253 | 8/11/2023 |
0.1.3.23 | 294 | 7/28/2023 |
0.1.2.22 | 290 | 7/25/2023 |
0.1.1.21 | 214 | 7/21/2023 |