Skip to content

Commit 0e53c6f

Browse files
authored
Merge pull request #396 from bci-oss/394-support-samm-2-1-0
Add support for SAMM 2.1.0
2 parents ac5a872 + 1bd5a80 commit 0e53c6f

File tree

335 files changed

+13003
-1123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

335 files changed

+13003
-1123
lines changed

core/esmf-aspect-meta-model-interface/src/test/java/org/eclipse/esmf/aspectmodel/VersionNumberTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,10 @@ public TestVersionNumber( final VersionNumber versionNumber, final String versio
118118
this.versionNumber = versionNumber;
119119
this.version = version;
120120
}
121+
122+
@Override
123+
public String toString() {
124+
return version;
125+
}
121126
}
122127
}

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/metamodel/loader/AspectModelLoader.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@
6060
public class AspectModelLoader {
6161
private static final Logger LOG = LoggerFactory.getLogger( AspectModelLoader.class );
6262

63-
private static final Set<KnownVersion> supportedVersions = ImmutableSet.of(
63+
private static final Set<KnownVersion> SUPPORTED_VERSIONS = ImmutableSet.of(
6464
KnownVersion.SAMM_1_0_0,
65-
KnownVersion.SAMM_2_0_0
65+
KnownVersion.SAMM_2_0_0,
66+
KnownVersion.SAMM_2_1_0
6667
);
6768

6869
private static final MigratorService migratorService = new MigratorService();
@@ -115,7 +116,7 @@ public static Try<List<ModelNamespace>> getNamespaces( final VersionedModel vers
115116
*/
116117
public static Try<List<ModelElement>> getElements( final VersionedModel versionedModel ) {
117118
final Optional<KnownVersion> metaModelVersion = KnownVersion.fromVersionString( versionedModel.getMetaModelVersion().toString() );
118-
if ( metaModelVersion.isEmpty() || !supportedVersions.contains( metaModelVersion.get() ) ) {
119+
if ( metaModelVersion.isEmpty() || !SUPPORTED_VERSIONS.contains( metaModelVersion.get() ) ) {
119120
return Try.failure( new UnsupportedVersionException( versionedModel.getMetaModelVersion() ) );
120121
}
121122

core/esmf-aspect-meta-model-java/src/main/java/org/eclipse/esmf/metamodel/loader/CurieRdfType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public int getHashCode( final LiteralLabel lit ) {
8383

8484
@Override
8585
public Class<Curie> getJavaClass() {
86-
return (Class<Curie>) Curie.class;
86+
return Curie.class;
8787
}
8888

8989
@Override

core/esmf-aspect-meta-model-resolver/pom.xml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<properties>
3232
<samm-revision>
33-
https://raw.githubusercontent.com/eclipse-esmf/esmf-semantic-aspect-meta-model/bf9196547384bf072095cc8300d45ca7117a3211/esmf-semantic-aspect-meta-model
33+
https://raw.githubusercontent.com/eclipse-esmf/esmf-semantic-aspect-meta-model/179f97e7f12e3f05d5daa1211ff414d07d3b2f9e/esmf-semantic-aspect-meta-model
3434
</samm-revision>
3535
</properties>
3636

@@ -185,6 +185,23 @@
185185
<skipCache>true</skipCache>
186186
</configuration>
187187
</execution>
188+
<execution>
189+
<id>download-meta-model-shapes-2-1-0</id>
190+
<phase>process-resources</phase>
191+
<goals>
192+
<goal>wget</goal>
193+
</goals>
194+
<configuration>
195+
<url>
196+
${samm-revision}/src/main/resources/samm/meta-model/2.1.0/aspect-meta-model-shapes.ttl
197+
</url>
198+
<outputFileName>aspect-meta-model-shapes.ttl</outputFileName>
199+
<outputDirectory>${project.build.directory}/classes/samm/meta-model/2.1.0</outputDirectory>
200+
<overwrite>true</overwrite>
201+
<followRedirects>true</followRedirects>
202+
<skipCache>true</skipCache>
203+
</configuration>
204+
</execution>
188205
<execution>
189206
<id>download-characteristics-shapes-1-0-0</id>
190207
<phase>process-resources</phase>
@@ -219,6 +236,23 @@
219236
<skipCache>true</skipCache>
220237
</configuration>
221238
</execution>
239+
<execution>
240+
<id>download-characteristics-shapes-2-1-0</id>
241+
<phase>process-resources</phase>
242+
<goals>
243+
<goal>wget</goal>
244+
</goals>
245+
<configuration>
246+
<url>
247+
${samm-revision}/src/main/resources/samm/characteristic/2.1.0/characteristic-shapes.ttl
248+
</url>
249+
<outputFileName>characteristic-shapes.ttl</outputFileName>
250+
<outputDirectory>${project.build.directory}/classes/samm/characteristic/2.1.0</outputDirectory>
251+
<overwrite>true</overwrite>
252+
<followRedirects>true</followRedirects>
253+
<skipCache>true</skipCache>
254+
</configuration>
255+
</execution>
222256
</executions>
223257
</plugin>
224258

core/esmf-aspect-meta-model-resolver/src/test/java/org/eclipse/esmf/aspectmodel/resolver/services/DataTypeTest.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.junit.jupiter.params.provider.MethodSource;
3232

3333
import org.eclipse.esmf.metamodel.datatypes.Curie;
34+
3435
import lombok.Value;
3536

3637
public class DataTypeTest {
@@ -84,6 +85,11 @@ public <T> void testConfigurableParserChecks( final TestConfiguration<T> testCon
8485
private static class TestConfiguration<T> {
8586
TypedRdfDatatype<T> type;
8687
Map<String, Predicate<T>> predicates;
88+
89+
@Override
90+
public String toString() {
91+
return type.toString();
92+
}
8793
}
8894

8995
static Stream<TestConfiguration<?>> getTestConfigurationsWithLexicalErrors() {
@@ -312,13 +318,13 @@ static Stream<TestConfiguration<?>> getValidTestConfigurations() {
312318

313319
final Stream<TestConfiguration<Curie>> curieTypes =
314320
DataType.getAllSupportedTypes().stream()
315-
.filter( dataType -> dataType.getJavaClass() != null
316-
&& dataType.getJavaClass().equals( Curie.class ) )
317-
.map( dataType -> (TypedRdfDatatype<Curie>) dataType )
318-
.map( curieType -> new TestConfiguration<>( curieType, Map.of(
319-
"xsd:string", v -> ((Curie) v).getValue().equals( "xsd:string" ),
320-
"unit:hectopascal", v -> ((Curie) v).getValue().equals( "unit:hectopascal" )
321-
) ) );
321+
.filter( dataType -> dataType.getJavaClass() != null
322+
&& dataType.getJavaClass().equals( Curie.class ) )
323+
.map( dataType -> (TypedRdfDatatype<Curie>) dataType )
324+
.map( curieType -> new TestConfiguration<>( curieType, Map.of(
325+
"xsd:string", v -> ((Curie) v).getValue().equals( "xsd:string" ),
326+
"unit:hectopascal", v -> ((Curie) v).getValue().equals( "unit:hectopascal" )
327+
) ) );
322328

323329
return Stream.concat( extendedXsdTypes, curieTypes );
324330
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 samm: <urn:org.eclipse.esmf.samm:foo:1.0.0#> .
13+
14+
<urn:samm:org.eclipse.esmf.samm:aspect-model:TestAspect:1.0.0> a samm:Aspect ;
15+
samm:preferredName "Test Aspect"@en ;
16+
samm:properties ( ) ;
17+
samm:operations ( ) .
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 samm: <urn:samm:foo:something:else#> .
13+
14+
<urn:samm:org.eclipse.esmf.samm:TestAspect:1.1.0> a samm:Aspect;
15+
samm:preferredName "Test Aspect"@en;
16+
samm:properties () ;
17+
samm:operations () .
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 samm: <urn:foo:org.eclipse.esmf.samm:meta-model:2.0.0#> .
13+
14+
<urn:samm:org.eclipse.esmf.samm:aspect-model:TestAspect:1.1.0> a samm:Aspect ;
15+
samm:preferredName "Test Aspect"@en ;
16+
samm:properties ( ) ;
17+
samm:operations ( ) .
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> .
13+
14+
<urn:samm:org.eclipse.esmf.samm:aspect-model:TestAspect:1.1.0> a samm:Aspect ;
15+
samm:preferredName "Test Aspect"@en ;
16+
samm:properties ( ) ;
17+
samm:operations ( ) .
18+
19+
<urn:samm:org.eclipse.esmf.samm:aspect-model:AnotherTestAspect:1.1.0> a samm:Aspect ;
20+
samm:preferredName "Another Test Aspect"@en ;
21+
samm:properties ( ) ;
22+
samm:operations ( ) .
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 : <urn:samm:org.eclipse.esmf.test:1.0.0#> .
13+
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.1.0#> .
14+
15+
:TestAspect a samm:Aspect ;
16+
samm:preferredName "Test Aspect"@en ;
17+
samm:properties ( ) ;
18+
samm:operations ( ) .

0 commit comments

Comments
 (0)