Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify namespace in URN structure #289

Merged
merged 4 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ samm:NamespaceShape
select $this ?value ?code
where {
bind( str( $this ) as ?value )
filter( !regex( ?value, "^urn:samm:[^:]+:[0-9]+.[0-9]+.[0-9]+#$" ))
filter( !regex( ?value, "^urn:samm:[a-zA-Z0-9._-]+:[0-9]+.[0-9]+.[0-9]+#$" ))
Yauhenikapl marked this conversation as resolved.
Show resolved Hide resolved
bind( 'ERR_WRONG_URN' as ?code )
}
""" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,39 @@ void testEmptyPropertiesExpectFailureSamm_2_2_0( final KnownVersion metaModelVer

@ParameterizedTest
@MethodSource( value = "versionsStartingWith2_2_0")
void testNamespaceInvalidUrn( final KnownVersion metaModelVersion) {
void testNamespaceInvalidUrnPattern( final KnownVersion metaModelVersion) {
final String focusNode = "urn:samm:org.eclipse.esmf.samm.test:1.q.0#";

final SemanticError resultForInvalidUrnNamespace = new SemanticError(
"Namespace '<urn:samm:org.eclipse.esmf.samm.test:1.q.0#>' uses an invalid URN pattern",
focusNode, "", violationUrn, focusNode
);
expectSemanticValidationErrors( "namespace", "TestNamespaceInvalidUrn",
expectSemanticValidationErrors( "namespace", "TestNamespaceInvalidUrnVersion",
metaModelVersion, resultForInvalidUrnNamespace );
}

@ParameterizedTest
@MethodSource( value = "versionsStartingWith2_2_0")
void testNamespaceInvalidUrn( final KnownVersion metaModelVersion) {
final String focusNode = "urn:samm:org.eclipse.esmf.samm+test:1.0.0#";

final SemanticError resultForInvalidUrnNamespace = new SemanticError(
"Namespace '<urn:samm:org.eclipse.esmf.samm+test:1.0.0#>' uses an invalid URN pattern",
focusNode, "", violationUrn, focusNode
);
expectSemanticValidationErrors( "namespace", "TestNamespaceInvalidUrn",
metaModelVersion, resultForInvalidUrnNamespace );
}

@ParameterizedTest
@MethodSource( value = "versionsStartingWith2_2_0")
void testNamespaceValidWithDash( final KnownVersion metaModelVersion) {
checkValidity( "namespace", "TestNamespaceValidWithDash", metaModelVersion );
}

@ParameterizedTest
@MethodSource( value = "versionsStartingWith2_2_0")
void testNamespaceValidWithUnderscore( final KnownVersion metaModelVersion) {
checkValidity( "namespace", "TestNamespaceValidWithUnderscore", metaModelVersion );
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
Yauhenikapl marked this conversation as resolved.
Show resolved Hide resolved
#
# See the AUTHORS file(s) distributed with this work for additional
# information regarding authorship.
Expand All @@ -10,7 +10,7 @@
#
# SPDX-License-Identifier: MPL-2.0
#
@prefix : <urn:samm:org.eclipse.esmf.samm.test:1.q.0#> .
@prefix : <urn:samm:org.eclipse.esmf.samm+test:1.0.0#> .
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#> .
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.2.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
#
# See the AUTHORS file(s) distributed with this work for additional
# information regarding authorship.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# SPDX-License-Identifier: MPL-2.0
#
@prefix : <urn:samm:org.eclipse.esmf.samm.test:1.q.0#> .
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#> .
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.2.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

: a samm:Namespace ;
samm:preferredName "Test Preferred Name"@en ;
samm:description "Test description"@en ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
#
# See the AUTHORS file(s) distributed with this work for additional
# information regarding authorship.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# SPDX-License-Identifier: MPL-2.0
#
@prefix : <urn:samm:org.eclipse.esmf.samm-test:1.0.0#> .
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#> .
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.2.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

: a samm:Namespace ;
samm:preferredName "Test Preferred Name"@en ;
samm:description "Test description"@en ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
#
# See the AUTHORS file(s) distributed with this work for additional
# information regarding authorship.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# SPDX-License-Identifier: MPL-2.0
#
@prefix : <urn:samm:org.eclipse.esmf.samm_test:1.0.0#> .
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#> .
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.2.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

: a samm:Namespace ;
samm:preferredName "Test Preferred Name"@en ;
samm:description "Test description"@en ;
Loading