diff --git a/dataformat-aml/src/test/resources/test_demo_full_example.aml b/dataformat-aml/src/test/resources/test_demo_full_example.aml index 147423a9..8b95a7be 100644 --- a/dataformat-aml/src/test/resources/test_demo_full_example.aml +++ b/dataformat-aml/src/test/resources/test_demo_full_example.aml @@ -21,16 +21,16 @@ - (Submodel)[IRI]http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial + (Submodel)[Iri]http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial - (Asset)[IRI]https://acplt.org/Test_Asset + (Asset)[Iri]https://acplt.org/Test_Asset - (AssetAdministrationShell)[IRI]https://acplt.org/TestAssetAdministrationShell2 + (AssetAdministrationShell)[Iri]https://acplt.org/TestAssetAdministrationShell2 @@ -98,7 +98,7 @@ - (GlobalReference)[IRI]http://acplt.org/SubmodelTemplates/ExampleSubmodel + (GlobalReference)[Iri]http://acplt.org/SubmodelTemplates/ExampleSubmodel @@ -120,7 +120,7 @@ - (GlobalReference)[IRI]http://acplt.org/RelationshipElements/ExampleRelationshipElement + (GlobalReference)[Iri]http://acplt.org/RelationshipElements/ExampleRelationshipElement @@ -147,7 +147,7 @@ - (GlobalReference)[IRI]http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement + (GlobalReference)[Iri]http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement @@ -197,7 +197,7 @@ - (GlobalReference)[IRI]http://acplt.org/Operations/ExampleOperation + (GlobalReference)[Iri]http://acplt.org/Operations/ExampleOperation @@ -220,11 +220,11 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleValueId + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleValueId @@ -255,11 +255,11 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleValueId + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleValueId @@ -290,11 +290,11 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleValueId + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleValueId @@ -326,7 +326,7 @@ - (GlobalReference)[IRI]http://acplt.org/Capabilities/ExampleCapability + (GlobalReference)[Iri]http://acplt.org/Capabilities/ExampleCapability @@ -350,11 +350,11 @@ - (Submodel)[IRI]https://acplt.org/Test_Submodel,(SubmodelElementCollection)[ID_SHORT]ExampleSubmodelCollectionOrdered,(Property)[ID_SHORT]ExampleProperty + (Submodel)[Iri]https://acplt.org/Test_Submodel,(SubmodelElementCollection)[IdShort]ExampleSubmodelCollectionOrdered,(Property)[IdShort]ExampleProperty - (GlobalReference)[IRI]http://acplt.org/Events/ExampleBasicEvent + (GlobalReference)[Iri]http://acplt.org/Events/ExampleBasicEvent @@ -386,7 +386,7 @@ - (GlobalReference)[IRI]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered + (GlobalReference)[Iri]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered @@ -408,11 +408,11 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleValueId + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleValueId @@ -441,11 +441,11 @@ - (GlobalReference)[IRI]http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty + (GlobalReference)[Iri]http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleMultiLanguageValueId + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleMultiLanguageValueId @@ -478,7 +478,7 @@ - (GlobalReference)[IRI]http://acplt.org/Ranges/ExampleRange + (GlobalReference)[Iri]http://acplt.org/Ranges/ExampleRange @@ -520,7 +520,7 @@ - (GlobalReference)[IRI]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered + (GlobalReference)[Iri]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered @@ -546,7 +546,7 @@ - (GlobalReference)[IRI]http://acplt.org/Blobs/ExampleBlob + (GlobalReference)[Iri]http://acplt.org/Blobs/ExampleBlob @@ -578,7 +578,7 @@ - (GlobalReference)[IRI]http://acplt.org/Files/ExampleFile + (GlobalReference)[Iri]http://acplt.org/Files/ExampleFile @@ -616,7 +616,7 @@ - (GlobalReference)[IRI]http://acplt.org/ReferenceElements/ExampleReferenceElement + (GlobalReference)[Iri]http://acplt.org/ReferenceElements/ExampleReferenceElement @@ -664,7 +664,7 @@ - (Submodel)[IRI]http://acplt.org/SubmodelTemplates/BillOfMaterial + (Submodel)[Iri]http://acplt.org/SubmodelTemplates/BillOfMaterial @@ -686,7 +686,7 @@ - (GlobalReference)[IRI]http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber + (GlobalReference)[Iri]http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber @@ -708,11 +708,11 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleValue2 + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleValue2 @@ -741,11 +741,11 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty - (GlobalReference)[IRI]http://acplt.org/ValueId/ExampleValueId + (GlobalReference)[Iri]http://acplt.org/ValueId/ExampleValueId @@ -771,7 +771,7 @@ - (Asset)[IRI]https://acplt.org/Test_Asset2 + (Asset)[Iri]https://acplt.org/Test_Asset2 @@ -779,7 +779,7 @@ - (GlobalReference)[IRI]http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber + (GlobalReference)[Iri]http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber @@ -827,7 +827,7 @@ - (Submodel)[IRI]http://acplt.org/SubmodelTemplates/AssetIdentification + (Submodel)[Iri]http://acplt.org/SubmodelTemplates/AssetIdentification @@ -867,11 +867,11 @@ - (GlobalReference)[IRI]0173-1#02-AAO677#002 + (GlobalReference)[Iri]0173-1#02-AAO677#002 - (GlobalReference)[IRI]http://acplt.org/ValueId/ACPLT + (GlobalReference)[Iri]http://acplt.org/ValueId/ACPLT @@ -895,11 +895,11 @@ - (GlobalReference)[IRI]http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber + (GlobalReference)[Iri]http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber - (GlobalReference)[IRI]978-8234-234-342 + (GlobalReference)[Iri]978-8234-234-342 @@ -920,7 +920,7 @@ - (Asset)[IRI]https://acplt.org/Test_Asset_Mandatory + (Asset)[Iri]https://acplt.org/Test_Asset_Mandatory @@ -1003,7 +1003,7 @@ - (Submodel)[IRI]https://acplt.org/Test_Submodel_Mandatory,(SubmodelElementCollection)[ID_SHORT]ExampleSubmodelCollectionOrdered,(Property)[ID_SHORT]ExampleProperty + (Submodel)[Iri]https://acplt.org/Test_Submodel_Mandatory,(SubmodelElementCollection)[IdShort]ExampleSubmodelCollectionOrdered,(Property)[IdShort]ExampleProperty @@ -1168,7 +1168,7 @@ - (Asset)[IRI]https://acplt.org/Test_Asset_Missing + (Asset)[Iri]https://acplt.org/Test_Asset_Missing @@ -1252,7 +1252,7 @@ - (GlobalReference)[IRI]http://acplt.org/SubmodelTemplates/ExampleSubmodel + (GlobalReference)[Iri]http://acplt.org/SubmodelTemplates/ExampleSubmodel @@ -1274,7 +1274,7 @@ - (GlobalReference)[IRI]http://acplt.org/RelationshipElements/ExampleRelationshipElement + (GlobalReference)[Iri]http://acplt.org/RelationshipElements/ExampleRelationshipElement @@ -1301,7 +1301,7 @@ - (GlobalReference)[IRI]http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement + (GlobalReference)[Iri]http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement @@ -1351,7 +1351,7 @@ - (GlobalReference)[IRI]http://acplt.org/Operations/ExampleOperation + (GlobalReference)[Iri]http://acplt.org/Operations/ExampleOperation @@ -1384,7 +1384,7 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty @@ -1425,7 +1425,7 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty @@ -1466,7 +1466,7 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty @@ -1498,7 +1498,7 @@ - (GlobalReference)[IRI]http://acplt.org/Capabilities/ExampleCapability + (GlobalReference)[Iri]http://acplt.org/Capabilities/ExampleCapability @@ -1522,11 +1522,11 @@ - (Submodel)[IRI]https://acplt.org/Test_Submodel_Missing,(SubmodelElementCollection)[ID_SHORT]ExampleSubmodelCollectionOrdered,(Property)[ID_SHORT]ExampleProperty + (Submodel)[Iri]https://acplt.org/Test_Submodel_Missing,(SubmodelElementCollection)[IdShort]ExampleSubmodelCollectionOrdered,(Property)[IdShort]ExampleProperty - (GlobalReference)[IRI]http://acplt.org/Events/ExampleBasicEvent + (GlobalReference)[Iri]http://acplt.org/Events/ExampleBasicEvent @@ -1558,7 +1558,7 @@ - (GlobalReference)[IRI]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered + (GlobalReference)[Iri]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered @@ -1590,7 +1590,7 @@ - (GlobalReference)[IRI]http://acplt.org/Properties/ExampleProperty + (GlobalReference)[Iri]http://acplt.org/Properties/ExampleProperty @@ -1619,7 +1619,7 @@ - (GlobalReference)[IRI]http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty + (GlobalReference)[Iri]http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty @@ -1653,7 +1653,7 @@ - (GlobalReference)[IRI]http://acplt.org/Ranges/ExampleRange + (GlobalReference)[Iri]http://acplt.org/Ranges/ExampleRange @@ -1695,7 +1695,7 @@ - (GlobalReference)[IRI]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered + (GlobalReference)[Iri]http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered @@ -1721,7 +1721,7 @@ - (GlobalReference)[IRI]http://acplt.org/Blobs/ExampleBlob + (GlobalReference)[Iri]http://acplt.org/Blobs/ExampleBlob @@ -1753,7 +1753,7 @@ - (GlobalReference)[IRI]http://acplt.org/Files/ExampleFile + (GlobalReference)[Iri]http://acplt.org/Files/ExampleFile @@ -1791,7 +1791,7 @@ - (GlobalReference)[IRI]http://acplt.org/ReferenceElements/ExampleReferenceElement + (GlobalReference)[Iri]http://acplt.org/ReferenceElements/ExampleReferenceElement @@ -1843,7 +1843,7 @@ - (GlobalReference)[IRI]http://acplt.org/DataSpecifications/ConceptDescriptions/TestConceptDescription + (GlobalReference)[Iri]http://acplt.org/DataSpecifications/ConceptDescriptions/TestConceptDescription @@ -1932,7 +1932,7 @@ - (GlobalReference)[IRI]http://acplt.org/ReferenceElements/ConceptDescriptionX + (GlobalReference)[Iri]http://acplt.org/ReferenceElements/ConceptDescriptionX @@ -1980,7 +1980,7 @@ - (GlobalReference)[IRI]http://acplt.org/Units/SpaceUnit + (GlobalReference)[Iri]http://acplt.org/Units/SpaceUnit @@ -3297,7 +3297,7 @@ - (Asset)[IRI]https://acplt.org/Test_Asset_Mandatory + (Asset)[Iri]https://acplt.org/Test_Asset_Mandatory @@ -3380,7 +3380,7 @@ - (Submodel)[IRI]https://acplt.org/Test_Submodel_Mandatory,(SubmodelElementCollection)[ID_SHORT]ExampleSubmodelCollectionOrdered,(Property)[ID_SHORT]ExampleProperty + (Submodel)[Iri]https://acplt.org/Test_Submodel_Mandatory,(SubmodelElementCollection)[IdShort]ExampleSubmodelCollectionOrdered,(Property)[IdShort]ExampleProperty @@ -3590,7 +3590,7 @@ - (Submodel)[IRI]https://acplt.org/Test_Submodel_Mandatory,(SubmodelElementCollection)[ID_SHORT]ExampleSubmodelCollectionOrdered,(Property)[ID_SHORT]ExampleProperty + (Submodel)[Iri]https://acplt.org/Test_Submodel_Mandatory,(SubmodelElementCollection)[IdShort]ExampleSubmodelCollectionOrdered,(Property)[IdShort]ExampleProperty diff --git a/dataformat-aml/src/test/resources/test_demo_simple_example.aml b/dataformat-aml/src/test/resources/test_demo_simple_example.aml index 86155077..388aa9ef 100644 --- a/dataformat-aml/src/test/resources/test_demo_simple_example.aml +++ b/dataformat-aml/src/test/resources/test_demo_simple_example.aml @@ -10,14 +10,14 @@ - (Asset)[IRI]http://customer.com/assets/KHBVZJSQKIY + (Asset)[Iri]http://customer.com/assets/KHBVZJSQKIY - (GlobalReference)[IRI]http://customer.com/Systems/ERP/012 + (GlobalReference)[Iri]http://customer.com/Systems/ERP/012 @@ -31,7 +31,7 @@ - (GlobalReference)[IRI]http://customer.com/Systems/IoT/1 + (GlobalReference)[Iri]http://customer.com/Systems/IoT/1 @@ -81,7 +81,7 @@ - (GlobalReference)[IRDI]0173-1#01-AFZ615#016 + (GlobalReference)[Irdi]0173-1#01-AFZ615#016 @@ -98,7 +98,7 @@ - (ConceptDescription)[IRDI]0173-1#02-BAA120#008 + (ConceptDescription)[Irdi]0173-1#02-BAA120#008 @@ -143,7 +143,7 @@ - (ConceptDescription)[IRI]http://customer.com/cd/1/1/18EBD56F6B43D895 + (ConceptDescription)[Iri]http://customer.com/cd/1/1/18EBD56F6B43D895 @@ -192,7 +192,7 @@ - (ConceptDescription)[IRI]www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document + (ConceptDescription)[Iri]www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document @@ -205,7 +205,7 @@ - (ConceptDescription)[IRI]www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title + (ConceptDescription)[Iri]www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title @@ -228,7 +228,7 @@ - (ConceptDescription)[IRI]www.vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile + (ConceptDescription)[Iri]www.vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile @@ -432,7 +432,7 @@ - (GlobalReference)[IRDI]0173-1#05-AAA650#002 + (GlobalReference)[Irdi]0173-1#05-AAA650#002 @@ -500,7 +500,7 @@ - (GlobalReference)[IRDI]0173-1#05-AAA650#002 + (GlobalReference)[Irdi]0173-1#05-AAA650#002 diff --git a/dataformat-core/src/main/java/io/adminshell/aas/v3/dataformat/core/util/AasUtils.java b/dataformat-core/src/main/java/io/adminshell/aas/v3/dataformat/core/util/AasUtils.java index 700e3b48..aa84850e 100644 --- a/dataformat-core/src/main/java/io/adminshell/aas/v3/dataformat/core/util/AasUtils.java +++ b/dataformat-core/src/main/java/io/adminshell/aas/v3/dataformat/core/util/AasUtils.java @@ -82,7 +82,10 @@ public static String asString(Reference reference) { return null; } return reference.getKeys().stream() - .map(x -> String.format("(%s)[%s]%s", serializeEnumName(x.getType().name()), x.getIdType(), x.getValue())) + .map(x -> String.format("(%s)[%s]%s", + serializeEnumName(x.getType().name()), + serializeEnumName(x.getIdType().name()), + x.getValue())) .collect(Collectors.joining(",")); } @@ -181,7 +184,7 @@ public static Key parseKey(String value) { Matcher matcher = KEY_REGEX.matcher(value); if (matcher.find()) { KeyElements keyElements = KeyElements.valueOf(deserializeEnumName(matcher.group(KEY_REGEX_GROUP_TYPE))); - KeyType keyType = KeyType.valueOf(matcher.group(KEY_REGEX_GROUP_ID_TYPE)); + KeyType keyType = KeyType.valueOf(deserializeEnumName(matcher.group(KEY_REGEX_GROUP_ID_TYPE))); return new DefaultKey.Builder() .type(keyElements) .idType(keyType) diff --git a/dataformat-core/src/test/java/io/adminshell/aas/v3/dataformat/core/AasUtilsTest.java b/dataformat-core/src/test/java/io/adminshell/aas/v3/dataformat/core/AasUtilsTest.java new file mode 100644 index 00000000..a670c3b7 --- /dev/null +++ b/dataformat-core/src/test/java/io/adminshell/aas/v3/dataformat/core/AasUtilsTest.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.adminshell.aas.v3.dataformat.core; + + +import io.adminshell.aas.v3.dataformat.core.util.AasUtils; +import io.adminshell.aas.v3.model.KeyElements; +import io.adminshell.aas.v3.model.KeyType; +import io.adminshell.aas.v3.model.Reference; +import org.junit.Assert; +import org.junit.Test; + +public class AasUtilsTest { + + @Test + public void testParseReference() { + Reference reference = AasUtils.parseReference("(Property)[IdShort]Temperature"); + Assert.assertNotNull(reference); + Assert.assertEquals(1, reference.getKeys().size()); + Assert.assertEquals(KeyElements.PROPERTY, reference.getKeys().get(0).getType()); + Assert.assertEquals(KeyType.ID_SHORT, reference.getKeys().get(0).getIdType()); + Assert.assertEquals("Temperature", reference.getKeys().get(0).getValue()); + } +} diff --git a/pom.xml b/pom.xml index 89d014ae..a0b3026d 100644 --- a/pom.xml +++ b/pom.xml @@ -40,8 +40,12 @@ validator - 1.2.1-SNAPSHOT - 1.1.1 + 1 + 2 + 1 + -SNAPSHOT + ${revision.major}.${revision.minor}.${revision.patch}${revision.suffix} + [${revision.major}.${revision.minor},) UTF-8 UTF-8