Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit 7e663b3

Browse files
committed
Integrating the review comments into the IAIS Shapes.
1 parent ab95679 commit 7e663b3

12 files changed

Lines changed: 263 additions & 102 deletions

File tree

validator/src/main/resources/constraint_shapes.ttl

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
#@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2-
#@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3-
#@prefix xs: <http://www.w3.org/2001/XMLSchema#> .
4-
1+
#
2+
# Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
516
@prefix phys_unit: <https://admin-shell.io/DataSpecificationTemplates/DataSpecificationPhysicalUnit/3/0/RC01/> .
617
@prefix dash: <http://datashapes.org/dash#> .
718
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@@ -92,17 +103,15 @@ sh:sparql [
92103
sh:message "If both, the Property/value and the Property/valueId are present then the value of Property/value needs to be identical to the value of the referenced coded value in Property/valueId." ;
93104
sh:prefixes rdf: ;
94105
sh:select """
95-
SELECT ?property ?value
96-
WHERE {
106+
SELECT ?property ?value WHERE {
97107
?property a <https://admin-shell.io/aas/3/0/RC01/Property> .
98108
?property <https://admin-shell.io/aas/3/0/RC01/Property/value> ?value .
99109
?property <https://admin-shell.io/aas/3/0/RC01/Property/valueId> ?valueId .
100110
?valueId <https://admin-shell.io/aas/3/0/RC01/Reference/key> ?key .
101111
?key <https://admin-shell.io/aas/3/0/RC01/Key/value> ?keyValue .
102112
103113
FILTER (?value != ?keyValue)
104-
}
105-
""" ;
114+
}""" ;
106115
] .
107116

108117
# AASd-008
@@ -192,17 +201,16 @@ aas:AASd-015Shape a sh:NodeShape ;
192201
sh:targetClass aas:AccessControl;
193202
sh:sparql [
194203
a sh:SPARQLConstraint ;
195-
sh:message "The data element SubjectAttributes/subjectAttribute shall be part of the submodel that is referenced within the “selectableSubjectAttributes” attribute of “AccessControl”" ;
204+
sh:message "(AASd-015Shape) - The data element SubjectAttributes/subjectAttribute shall be part of the submodel that is referenced within the “selectableSubjectAttributes” attribute of “AccessControl”" ;
196205
sh:select """
197-
SELECT ?submodelElement
198-
WHERE {
206+
SELECT ?submodelElement WHERE {
199207
?accessControl <https://admin-shell.io/aas/3/0/RC01/AccessControl/selectableSubjectAttributes> ?submodel .
200208
?submodel <https://admin-shell.io/aas/3/0/RC01/Submodel/submodelElement> ?submodelElement .
201209
?submodelElement <https://admin-shell.io/aas/3/0/RC01/AccessPermissionRule/targetSubjectAttributes> ?subjectAttribute .
202210
?subjectAttribute <https://admin-shell.io/aas/3/0/RC01/SubjectAttributes/subjectAttribute> ?dataElement .
203-
}
204-
""" ;
205-
] .
211+
}"""
212+
] ;
213+
.
206214

207215
# AASd-020
208216
aas:AASd-020Shape a sh:NodeShape ;
@@ -213,19 +221,8 @@ aas:AASd-020Shape a sh:NodeShape ;
213221
sh:sparql [
214222
a sh:SPARQLConstraint ;
215223
sh:message "The value of Qualifier/value shall be consistent to the data type as defined in Qualifier/valueType." ;
216-
sh:prefixes [
217-
sh:declare [
218-
sh:prefix "aas";
219-
sh:namespace "https://admin-shell.io/aas/3/0/RC01/"^^xsd:anyURI ;
220-
];
221-
sh:declare [
222-
sh:prefix "xsd";
223-
sh:namespace "http://www.w3.org/2001/XMLSchema#"^^xsd:anyURI ;
224-
]
225-
] ;
226224
sh:select """
227-
SELECT ?this ?value
228-
WHERE {
225+
SELECT ?this ?value WHERE {
229226
?this <https://admin-shell.io/aas/3/0/RC01/Qualifier/value> ?value .
230227
?this <https://admin-shell.io/aas/3/0/RC01/Qualifier/valueType> ?valueType .
231228
FILTER (DATATYPE(?value) != URI(?valueType) )

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_002.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_003.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;
@@ -37,7 +45,7 @@ public void idShortMatchCaseInsensitive() throws ValidationException {
3745
Referable smB = (DefaultSubmodel) ConstraintTestHelper.createSubmodel(new ArrayList<>());
3846
smB.setIdShort("IDSHORT");
3947

40-
// assertTrue(smA.equals(smB)); // TODO: should be true
48+
// assertTrue(smA.equals(smB)); // TODO: should be true but requires adjustments in the Java Model
4149

4250
}
4351

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_005.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_006.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_007.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_008.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_015.java

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;
@@ -15,6 +23,7 @@
1523
import io.adminshell.aas.v3.model.impl.DefaultOperation;
1624
import io.adminshell.aas.v3.model.impl.DefaultProperty;
1725
import io.adminshell.aas.v3.model.impl.DefaultSubjectAttributes;
26+
import org.junit.Ignore;
1827
import org.junit.Test;
1928

2029
import java.util.ArrayList;
@@ -33,7 +42,10 @@
3342
*
3443
*/
3544
public class TestAASd_015 {
45+
46+
3647
@Test
48+
@Ignore
3749
public void noRelation() throws ValidationException {
3850

3951
DataElement dataElement = new DefaultProperty.Builder()
@@ -56,14 +68,38 @@ public void noRelation() throws ValidationException {
5668

5769
try {
5870
ShaclValidator.getInstance().validate(wrongAccessControl);
59-
// fail(); // TODO: I really have no clue what this constraint shall check...
71+
fail(); // TODO: I really have no clue what this constraint shall check...
6072
} catch (ValidationException e) {
6173
assertTrue(e.getMessage().endsWith(
6274
"The data element SubjectAttributes/subjectAttribute shall be part of the submodel that is " +
6375
"referenced within the “selectableSubjectAttributes” attribute of “AccessControl”"));
6476
}
6577

78+
}
79+
80+
@Test
81+
@Ignore
82+
public void correctRelation() throws ValidationException {
83+
84+
DataElement dataElement = new DefaultProperty.Builder()
85+
.idShort("property")
86+
.build();
87+
88+
SubjectAttributes subjectAttributes = new DefaultSubjectAttributes.Builder()
89+
.subjectAttributes(new ArrayList<DataElement>() {{ add(dataElement); }} )
90+
.build();
91+
92+
Reference reference = ConstraintTestHelper.createDummyReference();
93+
reference.getKeys().get(0).setValue(dataElement.getIdShort());
94+
reference.getKeys().get(0).setType(KeyElements.PROPERTY);
95+
96+
AccessControl accessControl = new DefaultAccessControl.Builder()
97+
.selectableSubjectAttributes( reference )
98+
.defaultSubjectAttributes( ConstraintTestHelper.createDummyReference() )
99+
.defaultPermissions( ConstraintTestHelper.createDummyReference() )
100+
.build();
66101

102+
ShaclValidator.getInstance().validate(accessControl);
67103
}
68104

69105
}

validator/src/test/java/io/adminshell/aas/v3/model/validator/TestAASd_020.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/*******************************************************************************
2-
* Copyright (C) 2021 the Eclipse BaSyx Authors
3-
*
4-
* This program and the accompanying materials are made
5-
* available under the terms of the Eclipse Public License 2.0
6-
* which is available at https://www.eclipse.org/legal/epl-2.0/
7-
*
8-
* SPDX-License-Identifier: EPL-2.0
2+
*
3+
* Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
917
******************************************************************************/
1018

1119
package io.adminshell.aas.v3.model.validator;
@@ -15,6 +23,7 @@
1523
import io.adminshell.aas.v3.model.Qualifier;
1624
import io.adminshell.aas.v3.model.impl.DefaultOperation;
1725
import io.adminshell.aas.v3.model.impl.DefaultQualifier;
26+
import org.junit.Ignore;
1827
import org.junit.Test;
1928

2029
import static org.junit.Assert.assertTrue;
@@ -49,8 +58,8 @@ public void wrongIntegerValue() throws ValidationException {
4958
}
5059

5160
// TODO: non-strings can not be passed as Qualifier.value --> Strings will always pass, others are not recognized.
52-
/*
5361
@Test
62+
@Ignore
5463
public void wrongStringValue() throws ValidationException {
5564

5665
Qualifier wrongQualifier = new DefaultQualifier.Builder()
@@ -67,7 +76,6 @@ public void wrongStringValue() throws ValidationException {
6776
"The value of Qualifier/value shall be consistent to the data type as defined in Qualifier/valueType."));
6877
}
6978
}
70-
*/
7179

7280

7381
@Test

0 commit comments

Comments
 (0)