Skip to content

Commit

Permalink
Adds additional tests for mapping-object and mirror concept
Browse files Browse the repository at this point in the history
  • Loading branch information
aljoshakoecher committed Jun 20, 2024
1 parent c19825d commit 9e6ba52
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 1 deletion.
28 changes: 27 additions & 1 deletion lib/src/test/java/aml2owl/test/MappingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class MappingTest {

@Test
void testMappingWithoutPlc() throws Exception {
void testSucComposition() throws Exception {
Path mappingPath = Paths.get("src", "test", "resources", "system-unit-classes", "suc-composition.aml").toAbsolutePath();
AmlOwlMapper mapper = new AmlOwlMapper();

Expand All @@ -24,5 +24,31 @@ void testMappingWithoutPlc() throws Exception {
assertThat(actualResult).isEqualToIgnoringWhitespace(expectedResult);
}


@Test
void testMappingObject() throws Exception {
Path mappingPath = Paths.get("src", "test", "resources", "mapping-object", "mapping-object.aml").toAbsolutePath();
AmlOwlMapper mapper = new AmlOwlMapper();

String actualResult = mapper.executeMappingAndReturnString(mappingPath, null);
byte[] fileFromBytes = Files.readAllBytes(Paths.get("src", "test", "resources", "mapping-object", "mapping-object.ttl"));
String expectedResult = new String(fileFromBytes, StandardCharsets.UTF_8);

assertThat(actualResult).isEqualToIgnoringWhitespace(expectedResult);
}


@Test
void testMirror() throws Exception {
Path mappingPath = Paths.get("src", "test", "resources", "mirror", "mirror.aml").toAbsolutePath();
AmlOwlMapper mapper = new AmlOwlMapper();

String actualResult = mapper.executeMappingAndReturnString(mappingPath, null);
byte[] fileFromBytes = Files.readAllBytes(Paths.get("src", "test", "resources", "mirror", "mirror.ttl"));
String expectedResult = new String(fileFromBytes, StandardCharsets.UTF_8);

assertThat(actualResult).isEqualToIgnoringWhitespace(expectedResult);
}

}

25 changes: 25 additions & 0 deletions lib/src/test/resources/mapping-object/mapping-object.aml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<CAEXFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dke.de/CAEX" SchemaVersion="3.0" FileName="PPR_right_with_mirror.aml" xsi:schemaLocation="http://www.dke.de/CAEX CAEX_ClassModel_V.3.0.xsd">
<InstanceHierarchy Name="PPRExampleInstanceHierarchy">
<InternalElement Name="Screw" ID="ad5db25c-0f73-4e9f-8782-0ca28e319c43">
<Attribute Name="Vendor" AttributeDataType="xs:string">
<Value>ScrewVendor</Value>
</Attribute>
<ExternalInterface Name="RelatedProcess" ID="92cb2e82-03c0-4b8a-9da7-e1c1bc5c488a">
</ExternalInterface>
<RoleRequirements RefBaseRoleClassPath="PPRExampleRoleClassLib/PPRProduct">
<MappingObject>
<AttributeNameMapping SystemUnitAttributeName="Vendor" RoleAttributeName="Vendor" />
<InterfaceIDMapping SystemUnitInterfaceID="92cb2e82-03c0-4b8a-9da7-e1c1bc5c488a" RoleInterfaceID="f7ca2468-bc8a-4f26-8b63-e21fd9f01cb7" />
</MappingObject>
</RoleRequirements>
</InternalElement>
</InstanceHierarchy>
<RoleClassLib Name="PPRExampleRoleClassLib">
<RoleClass Name="PPRProduct">
<Attribute Name="Vendor" AttributeDataType="xs:string">
</Attribute>
<ExternalInterface Name="RelatedProcess" ID="f7ca2468-bc8a-4f26-8b63-e21fd9f01cb7" RefBaseClassPath="PPRExampleInterfaceClassLib/ProductProcessRelation">
</ExternalInterface>
</RoleClass>
</RoleClassLib>
</CAEXFile>
54 changes: 54 additions & 0 deletions lib/src/test/resources/mapping-object/mapping-object.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

<https://w3id.org/i40/aml#92cb2e82-03c0-4b8a-9da7-e1c1bc5c488a> a <https://w3id.org/i40/aml#ExternalInterface>;
<http://www.w3.org/2000/01/rdf-schema#label> "RelatedProcess";
<https://w3id.org/i40/aml#hasName> "RelatedProcess" .

<https://w3id.org/i40/aml#PPRExampleInstanceHierarchy> a <https://w3id.org/i40/aml#InstanceHierarchy>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPRExampleInstanceHierarchy";
<https://w3id.org/i40/aml#hasInternalElement> <https://w3id.org/i40/aml#ad5db25c-0f73-4e9f-8782-0ca28e319c43>;
<https://w3id.org/i40/aml#hasName> "PPRExampleInstanceHierarchy" .

<https://w3id.org/i40/aml#PPRExampleInstanceHierarchy%2FScrew%2FVendor> a <https://w3id.org/i40/aml#Attribute>;
<http://www.w3.org/2000/01/rdf-schema#label> "Vendor";
<https://w3id.org/i40/aml#hasAttributeDataType> "xs:string";
<https://w3id.org/i40/aml#hasAttributeValue> "ScrewVendor";
<https://w3id.org/i40/aml#hasDataType> "xs:string";
<https://w3id.org/i40/aml#hasName> "Vendor" .

<https://w3id.org/i40/aml#PPRExampleRoleClassLib> a <https://w3id.org/i40/aml#RoleClassLib>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPRExampleRoleClassLib";
<https://w3id.org/i40/aml#hasName> "PPRExampleRoleClassLib";
<https://w3id.org/i40/aml#hasRoleClass> <https://w3id.org/i40/aml#PPRExampleRoleClassLib%2FPPRProduct> .

<https://w3id.org/i40/aml#PPRExampleRoleClassLib%2FPPRProduct> <http://www.w3.org/2000/01/rdf-schema#label>
"PPRProduct";
<http://www.w3.org/2000/01/rdf-schema#subClassOf> <https://w3id.org/i40/aml#RoleClass>;
<https://w3id.org/i40/aml#hasAttribute> <https://w3id.org/i40/aml#PPRExampleRoleClassLib%2FPPRProduct%2FVendor>;
<https://w3id.org/i40/aml#hasInterface> <https://w3id.org/i40/aml#f7ca2468-bc8a-4f26-8b63-e21fd9f01cb7>;
<https://w3id.org/i40/aml#hasName> "PPRProduct" .

<https://w3id.org/i40/aml#PPRExampleRoleClassLib%2FPPRProduct%2FVendor> a <https://w3id.org/i40/aml#Attribute>;
<http://www.w3.org/2000/01/rdf-schema#label> "Vendor";
<https://w3id.org/i40/aml#hasAttributeDataType> "xs:string";
<https://w3id.org/i40/aml#hasDataType> "xs:string";
<https://w3id.org/i40/aml#hasName> "Vendor" .

<https://w3id.org/i40/aml#PPR_right_with_mirror.aml> a <https://w3id.org/i40/aml#CAEXFile>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPR_right_with_mirror.aml";
<https://w3id.org/i40/aml#hasInstanceHierarchy> <https://w3id.org/i40/aml#PPRExampleInstanceHierarchy>;
<https://w3id.org/i40/aml#hasRoleClassLib> <https://w3id.org/i40/aml#PPRExampleRoleClassLib>;
<https://w3id.org/i40/aml#hasSchemaVersion> "3.0" .

<https://w3id.org/i40/aml#ad5db25c-0f73-4e9f-8782-0ca28e319c43> a <https://w3id.org/i40/aml#InternalElement>,
<https://w3id.org/i40/aml#PPRExampleRoleClassLib%2FPPRProduct>;
<http://www.w3.org/2000/01/rdf-schema#label> "Screw";
<https://w3id.org/i40/aml#hasAttribute> <https://w3id.org/i40/aml#PPRExampleInstanceHierarchy%2FScrew%2FVendor>;
<https://w3id.org/i40/aml#hasAttributeIE> <https://w3id.org/i40/aml#PPRExampleInstanceHierarchy%2FScrew%2FVendor>;
<https://w3id.org/i40/aml#hasInterface> <https://w3id.org/i40/aml#92cb2e82-03c0-4b8a-9da7-e1c1bc5c488a>;
<https://w3id.org/i40/aml#hasName> "Screw" .

<https://w3id.org/i40/aml#f7ca2468-bc8a-4f26-8b63-e21fd9f01cb7> a <https://w3id.org/i40/aml#ExternalInterface>,
<https://w3id.org/i40/aml#PPRExampleInterfaceClassLib%2FProductProcessRelation>;
<http://www.w3.org/2000/01/rdf-schema#label> "RelatedProcess";
<https://w3id.org/i40/aml#hasBaseInterfaceClass> <https://w3id.org/i40/aml#PPRExampleInterfaceClassLib%2FProductProcessRelation>;
<https://w3id.org/i40/aml#hasName> "RelatedProcess" .
14 changes: 14 additions & 0 deletions lib/src/test/resources/mirror/mirror.aml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<CAEXFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.dke.de/CAEX" SchemaVersion="3.0" FileName="PPR_right_with_mirror.aml" xsi:schemaLocation="http://www.dke.de/CAEX CAEX_ClassModel_V.3.0.xsd">
<InstanceHierarchy Name="PPRExampleInstanceHierarchy">
<InternalElement Name="Screw" ID="ad5db25c-0f73-4e9f-8782-0ca28e319c43" RefBaseSystemUnitPath="PPRExampleSystemUnitClassLib/PPRProductSUC">
</InternalElement>
</InstanceHierarchy>
<InstanceHierarchy Name="ProductHierarchy">
<InternalElement Name="Screw" ID="01fe88c7-9be1-4b48-afa3-c69d326561b6" RefBaseSystemUnitPath="ad5db25c-0f73-4e9f-8782-0ca28e319c43" />
</InstanceHierarchy>
<SystemUnitClassLib Name="PPRExampleSystemUnitClassLib">
<Version>0</Version>
<SystemUnitClass Name="PPRProductSUC" ID="5717a780-5d5e-4970-8513-e45202f8114b">
</SystemUnitClass>
</SystemUnitClassLib>
</CAEXFile>
37 changes: 37 additions & 0 deletions lib/src/test/resources/mirror/mirror.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

<https://w3id.org/i40/aml#01fe88c7-9be1-4b48-afa3-c69d326561b6> a <https://w3id.org/i40/aml#InternalElement>;
<http://www.w3.org/2000/01/rdf-schema#label> "Screw";
<https://w3id.org/i40/aml#hasBaseSystemUnitClass> <https://w3id.org/i40/aml#ad5db25c-0f73-4e9f-8782-0ca28e319c43>;
<https://w3id.org/i40/aml#hasName> "Screw" .

<https://w3id.org/i40/aml#PPRExampleInstanceHierarchy> a <https://w3id.org/i40/aml#InstanceHierarchy>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPRExampleInstanceHierarchy";
<https://w3id.org/i40/aml#hasInternalElement> <https://w3id.org/i40/aml#ad5db25c-0f73-4e9f-8782-0ca28e319c43>;
<https://w3id.org/i40/aml#hasName> "PPRExampleInstanceHierarchy" .

<https://w3id.org/i40/aml#PPRExampleSystemUnitClassLib> a <https://w3id.org/i40/aml#SystemUnitClassLib>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPRExampleSystemUnitClassLib";
<https://w3id.org/i40/aml#hasName> "PPRExampleSystemUnitClassLib";
<https://w3id.org/i40/aml#hasSystemUnitClass> <https://w3id.org/i40/aml#PPRExampleSystemUnitClassLib%2FPPRProductSUC> .

<https://w3id.org/i40/aml#PPRExampleSystemUnitClassLib%2FPPRProductSUC> a <https://w3id.org/i40/aml#SystemUnitClass>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPRProductSUC";
<https://w3id.org/i40/aml#hasID> "5717a780-5d5e-4970-8513-e45202f8114b";
<https://w3id.org/i40/aml#hasName> "PPRProductSUC" .

<https://w3id.org/i40/aml#PPR_right_with_mirror.aml> a <https://w3id.org/i40/aml#CAEXFile>;
<http://www.w3.org/2000/01/rdf-schema#label> "PPR_right_with_mirror.aml";
<https://w3id.org/i40/aml#hasInstanceHierarchy> <https://w3id.org/i40/aml#PPRExampleInstanceHierarchy>,
<https://w3id.org/i40/aml#ProductHierarchy>;
<https://w3id.org/i40/aml#hasSchemaVersion> "3.0";
<https://w3id.org/i40/aml#hasSystemUnitClassLib> <https://w3id.org/i40/aml#PPRExampleSystemUnitClassLib> .

<https://w3id.org/i40/aml#ProductHierarchy> a <https://w3id.org/i40/aml#InstanceHierarchy>;
<http://www.w3.org/2000/01/rdf-schema#label> "ProductHierarchy";
<https://w3id.org/i40/aml#hasInternalElement> <https://w3id.org/i40/aml#01fe88c7-9be1-4b48-afa3-c69d326561b6>;
<https://w3id.org/i40/aml#hasName> "ProductHierarchy" .

<https://w3id.org/i40/aml#ad5db25c-0f73-4e9f-8782-0ca28e319c43> a <https://w3id.org/i40/aml#InternalElement>;
<http://www.w3.org/2000/01/rdf-schema#label> "Screw";
<https://w3id.org/i40/aml#hasBaseSystemUnitClass> <https://w3id.org/i40/aml#PPRExampleSystemUnitClassLib%2FPPRProductSUC>;
<https://w3id.org/i40/aml#hasName> "Screw" .

0 comments on commit 9e6ba52

Please sign in to comment.