Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Core.Tests/AasGenerator/AasGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,34 @@ public async Task AddDataToAasAsync_InputFilter_Success()
await RunDataIngestTest("InputFilter");
}

// An optional (ZeroToOne) SubmodelElementList wraps a mandatory (OneToMany) collection that carries a
// CollectionMappingInfo, and the list carries a FilterMappingInfo ("$count(marking) > 0"). With no
// markings in the payload the pre-duplication filter pass must drop the whole list BEFORE
// DuplicateCollections would otherwise throw on the mandatory-but-empty inner collection.
[Test]
public async Task AddDataToAasAsync_InputFilterOmitsOptionalCollection_Success()
{
await RunDataIngestTest("InputFilterOmitsOptionalCollection");
}

// Same blueprint, but the payload now carries markings: the filter keeps the list and the mandatory
// inner collection is duplicated once per item. Proves the pre-duplication filter pass does not break
// the normal collection-mapping path.
[Test]
public async Task AddDataToAasAsync_InputFilterKeepsOptionalCollection_Success()
{
await RunDataIngestTest("InputFilterKeepsOptionalCollection");
}

// A filter expression containing "[*]" is a per-item filter that cannot be evaluated before the
// collection is duplicated/indexed, so the filter step skips it instead of mis-evaluating the whole
// array. The element therefore survives even though the expression would otherwise be falsy.
[Test]
public async Task AddDataToAasAsync_InputFilterWildcardExpressionSkipped_Success()
{
await RunDataIngestTest("InputFilterWildcardExpressionSkipped");
}

[Test]
public async Task AddDataToAasAsync_InputFilterInsideDuplicatedCollection_Success()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"product": {
"name": "MX2 Inverter"
},
"marking": [
{ "name": "CE" },
{ "name": "UL" }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"modelType": "Submodel",
"kind": "Instance",
"idShort": "MarkingsDemo",
"id": "TheNewSubmodelId",
"description": [
{
"language": "en",
"text": "Optional list wrapping a mandatory (OneToMany) collection, gated by a filter"
}
],
"submodelElements": [
{
"modelType": "Property",
"idShort": "ProductName",
"valueType": "xs:string",
"value": "MX2 Inverter",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
}
]
},
{
"modelType": "SubmodelElementList",
"idShort": "Markings",
"typeValueListElement": "SubmodelElementCollection",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "ZeroToOne",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "SubmodelElementCollection",
"idShort": "Marking_0",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "OneToMany",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "Property",
"idShort": "MarkingName",
"valueType": "xs:string",
"value": "CE",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
}
]
}
]
},
{
"modelType": "SubmodelElementCollection",
"idShort": "Marking_1",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "OneToMany",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "Property",
"idShort": "MarkingName",
"valueType": "xs:string",
"value": "UL",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
}
]
}
]
}
]
}
],
"qualifiers": [
{
"kind": "ConceptQualifier",
"type": "MnestixAASGenerator/OriginalBlueprintID",
"value": "urn:smtemplate:MarkingsDemo",
"valueType": "xs:string"
},
{
"kind": "ConceptQualifier",
"type": "MnestixAASGenerator/GenerationTimestamp",
"value": "2026-01-02T03:04:05.0000000Z",
"valueType": "xs:dateTime"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"modelType": "Submodel",
"kind": "Template",
"idShort": "MarkingsDemo",
"id": "urn:smtemplate:MarkingsDemo",
"description": [
{
"language": "en",
"text": "Optional list wrapping a mandatory (OneToMany) collection, gated by a filter"
}
],
"submodelElements": [
{
"modelType": "Property",
"idShort": "ProductName",
"valueType": "xs:string",
"value": "",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/MappingInfo",
"value": "product.name",
"valueType": "xs:string"
}
]
},
{
"modelType": "SubmodelElementList",
"idShort": "Markings",
"typeValueListElement": "SubmodelElementCollection",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "ZeroToOne",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/FilterMappingInfo",
"value": "$count(marking) > 0",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "SubmodelElementCollection",
"idShort": "Marking",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "OneToMany",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/CollectionMappingInfo",
"value": "marking[*]",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "Property",
"idShort": "MarkingName",
"valueType": "xs:string",
"value": "",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/MappingInfo",
"value": "marking[*].name",
"valueType": "xs:string"
}
]
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"product": {
"name": "MX2 Inverter"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"modelType": "Submodel",
"kind": "Instance",
"idShort": "MarkingsDemo",
"id": "TheNewSubmodelId",
"description": [
{
"language": "en",
"text": "Optional list wrapping a mandatory (OneToMany) collection, gated by a filter"
}
],
"submodelElements": [
{
"modelType": "Property",
"idShort": "ProductName",
"valueType": "xs:string",
"value": "MX2 Inverter",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
}
]
}
],
"qualifiers": [
{
"kind": "ConceptQualifier",
"type": "MnestixAASGenerator/OriginalBlueprintID",
"value": "urn:smtemplate:MarkingsDemo",
"valueType": "xs:string"
},
{
"kind": "ConceptQualifier",
"type": "MnestixAASGenerator/GenerationTimestamp",
"value": "2026-01-02T03:04:05.0000000Z",
"valueType": "xs:dateTime"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"modelType": "Submodel",
"kind": "Template",
"idShort": "MarkingsDemo",
"id": "urn:smtemplate:MarkingsDemo",
"description": [
{
"language": "en",
"text": "Optional list wrapping a mandatory (OneToMany) collection, gated by a filter"
}
],
"submodelElements": [
{
"modelType": "Property",
"idShort": "ProductName",
"valueType": "xs:string",
"value": "",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/MappingInfo",
"value": "product.name",
"valueType": "xs:string"
}
]
},
{
"modelType": "SubmodelElementList",
"idShort": "Markings",
"typeValueListElement": "SubmodelElementCollection",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "ZeroToOne",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/FilterMappingInfo",
"value": "$count(marking) > 0",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "SubmodelElementCollection",
"idShort": "Marking",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "OneToMany",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/CollectionMappingInfo",
"value": "marking[*]",
"valueType": "xs:string"
}
],
"value": [
{
"modelType": "Property",
"idShort": "MarkingName",
"valueType": "xs:string",
"value": "",
"qualifiers": [
{
"kind": "TemplateQualifier",
"type": "SMT/Cardinality",
"value": "One",
"valueType": "xs:string"
},
{
"kind": "TemplateQualifier",
"type": "MnestixAASGenerator/MappingInfo",
"value": "marking[*].name",
"valueType": "xs:string"
}
]
}
]
}
]
}
]
}
Loading
Loading