Skip to content

Commit 78de46f

Browse files
authored
Merge pull request #374 from bci-oss/bugfix/esmf-363-resolution-old-models-fails
Fix problem with the resolution of the old BAMM 1.0.0 models.
2 parents 1213c30 + 4d3433e commit 78de46f

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

core/esmf-aspect-meta-model-version-migrator/src/main/java/org/eclipse/esmf/aspectmodel/versionupdate/migrator/BammUriRewriter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,18 @@ protected Map<String, String> buildPrefixMap( final Model sourceModel, final Map
4949

5050
@Override
5151
protected Map<String, String> buildReplacementPrefixMap( final Model sourceModel, final Map<String, String> targetPrefixes ) {
52+
final Map<String, String> oldSamm = Namespace.createPrefixMap( KnownVersion.SAMM_1_0_0 );
5253
// The mapping of the URNs of the legacy BAMM Aspect Meta model to their corresponding SAMM counterparts
5354
return Map.of(
5455
"urn:bamm:io.openmanufacturing:meta-model:2.0.0#", targetPrefixes.get( "samm" ),
5556
"urn:bamm:io.openmanufacturing:characteristic:2.0.0#", targetPrefixes.get( "samm-c" ),
56-
"urn:bamm:io.openmanufacturing:entity:2.0.0#", targetPrefixes.get( "samm-c" ),
57-
"urn:bamm:io.openmanufacturing:unit:2.0.0#", targetPrefixes.get( "unit" )
57+
"urn:bamm:io.openmanufacturing:entity:2.0.0#", targetPrefixes.get( "samm-e" ),
58+
"urn:bamm:io.openmanufacturing:unit:2.0.0#", targetPrefixes.get( "unit" ),
59+
60+
"urn:bamm:io.openmanufacturing:meta-model:1.0.0#", oldSamm.get( "samm" ),
61+
"urn:bamm:io.openmanufacturing:characteristic:1.0.0#", oldSamm.get( "samm-c" ),
62+
"urn:bamm:io.openmanufacturing:entity:1.0.0#", oldSamm.get( "samm-e" ),
63+
"urn:bamm:io.openmanufacturing:unit:1.0.0#", oldSamm.get( "unit" )
5864
);
5965
}
6066

core/esmf-aspect-model-resolver/src/test/java/org/eclipse/esmf/aspectmodel/resolver/AspectModelResolverTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.eclipse.esmf.aspectmodel.vocabulary.SAMM;
3333
import org.eclipse.esmf.samm.KnownVersion;
3434
import org.eclipse.esmf.test.MetaModelVersions;
35-
import org.junit.jupiter.api.Test;
3635
import org.junit.jupiter.params.ParameterizedTest;
3736
import org.junit.jupiter.params.provider.MethodSource;
3837

@@ -66,9 +65,9 @@ public void testLoadDataModelExpectSuccess( final KnownVersion metaModelVersion
6665
.isNotEmpty();
6766
}
6867

69-
@Test
70-
public void testLoadLegacyBammModelExpectSuccess() throws URISyntaxException {
71-
final KnownVersion metaModelVersion = KnownVersion.getLatest();
68+
@ParameterizedTest
69+
@MethodSource( value = "allVersions" )
70+
public void testLoadLegacyBammModelExpectSuccess( final KnownVersion metaModelVersion ) throws URISyntaxException {
7271
final File aspectModelsRootDirectory = new File(
7372
AspectModelResolverTest.class.getClassLoader()
7473
.getResource( metaModelVersion.toString().toLowerCase() )
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH
2+
#
3+
# See the AUTHORS file(s) distributed with this work for additional
4+
# information regarding authorship.
5+
#
6+
# This Source Code Form is subject to the terms of the Mozilla Public
7+
# License, v. 2.0. If a copy of the MPL was not distributed with this
8+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
9+
#
10+
# SPDX-License-Identifier: MPL-2.0
11+
12+
@prefix bamm: <urn:bamm:io.openmanufacturing:meta-model:1.0.0#> .
13+
@prefix bamm-c: <urn:bamm:io.openmanufacturing:characteristic:1.0.0#> .
14+
@prefix bamm-e: <urn:bamm:io.openmanufacturing:entity:1.0.0#> .
15+
@prefix : <urn:bamm:org.eclipse.esmf.test:2.0.0#> .
16+
@prefix unit: <urn:bamm:io.openmanufacturing:unit:1.0.0#> .
17+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
18+
19+
:BammTest a bamm:Aspect ;
20+
bamm:name "BammTest" ;
21+
bamm:preferredName "BAMM Test"@en ;
22+
bamm:properties ( :property ) ;
23+
bamm:operations ( ) .
24+
25+
:property a bamm:Property ;
26+
bamm:name "property" ;
27+
bamm:characteristic bamm-c:Text .

0 commit comments

Comments
 (0)