|
| 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