Skip to content

Commit 5bb0ace

Browse files
committed
Fix bug with rendering of some unused objects from the shared bamm-e namespace.
1 parent a91ff6d commit 5bb0ace

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

core/sds-aspect-model-document-generators/src/main/resources/diagram/bamm_1_0_0/property-characteristic-edges2boxmodel.sparql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ construct {
2424
#process Properties defined in the Aspect Model being processed
2525
{
2626
?property bamm:refines?/rdf:type bamm:Property .
27+
#exclude properties from our shared name-space
28+
filter ( ! strstarts( str( ?property ), str ( bamm-e: ) ) )
2729

2830
?property bamm:name ?propertyName .
2931
?property bamm:characteristic ?characteristic .

core/sds-aspect-model-document-generators/src/test/java/io/openmanufacturing/sds/aspectmodel/generator/diagram/Enumeration2BoxModelTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ void testOnlyRightSeeAttributeIsSelected( final KnownVersion metaModelVersion )
108108
characteristicIdentifier = "Enum2";
109109
boxSelectorStatement = getBoxSelectorStatement( characteristicIdentifier );
110110
entriesSelectorStatement = getEntriesSelectorStatement( characteristicIdentifier );
111-
112111
context.executeAttributeIsPresentTest( sparqlQueryFileName, boxSelectorStatement, entriesSelectorStatement,
113112
totalNumberOfExpectedEntries, indexOfSeeValueEntry, expectedSeeEntryTitle, "https://test.com" );
114113
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2022 Robert Bosch Manufacturing Solutions GmbH
3+
*
4+
* See the AUTHORS file(s) distributed with this work for additional
5+
* information regarding authorship.
6+
*
7+
* This Source Code Form is subject to the terms of the Mozilla Public
8+
* License, v. 2.0. If a copy of the MPL was not distributed with this
9+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
10+
*
11+
* SPDX-License-Identifier: MPL-2.0
12+
*/
13+
14+
package io.openmanufacturing.sds.aspectmodel.generator.diagram;
15+
16+
import static org.assertj.core.api.Assertions.assertThat;
17+
18+
import org.apache.jena.query.Query;
19+
import org.apache.jena.query.QueryExecution;
20+
import org.apache.jena.query.QueryExecutionFactory;
21+
import org.apache.jena.query.QueryFactory;
22+
import org.apache.jena.rdf.model.Model;
23+
import org.apache.jena.rdf.model.ModelFactory;
24+
import org.junit.jupiter.params.ParameterizedTest;
25+
import org.junit.jupiter.params.provider.MethodSource;
26+
27+
import io.openmanufacturing.sds.aspectmetamodel.KnownVersion;
28+
import io.openmanufacturing.sds.test.MetaModelVersions;
29+
import io.openmanufacturing.sds.test.TestAspect;
30+
31+
public class PropertyCharacteristicEdges2BoxModelTest extends MetaModelVersions {
32+
33+
private final String sparqlQueryFileName = "property-characteristic-edges2boxmodel.sparql";
34+
35+
@ParameterizedTest
36+
@MethodSource( value = "versionsUpToIncluding1_0_0" )
37+
void testPropertyToCharacteristicEdgeFromSharedNamespaceNotPresent( final KnownVersion metaModelVersion ) {
38+
// v1.0 sparql queries were not properly filtering out some properties from shared bamm-e namespace
39+
// https://github.com/OpenManufacturingPlatform/sds-sdk/issues/196
40+
final TestContext context = new TestContext( TestAspect.ASPECT_WITH_ENUM_ONLY_ONE_SEE, metaModelVersion );
41+
final Query query = QueryFactory.create( context.getInputStreamAsString( sparqlQueryFileName ) );
42+
43+
final Model queryResult = ModelFactory.createDefaultModel();
44+
try ( final QueryExecution qexec = QueryExecutionFactory.create( query, context.model() ) ) {
45+
qexec.execConstruct( queryResult );
46+
}
47+
48+
assertThat( queryResult.listStatements( context.selector( ":timestampProperty_To_TimestampCharacteristic a :Edge" ) ).toList() ).isEmpty();
49+
}
50+
}

0 commit comments

Comments
 (0)