Skip to content

Commit 5571750

Browse files
committed
Update value min count
1 parent de07d57 commit 5571750

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

documentation/modules/ROOT/pages/modeling-guidelines.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ that all model elements have], Properties have the following attributes:
165165
| `samm:exampleValue` | An exemplary value that the Property can take, helping to clarify the intended meaning of the Property.
166166
This attribute supports both scalar literal values (e.g., xsd:string, xsd:float), an anonymous described scalar value,
167167
and value references that point to example values (i.e., references to instances of xref:modeling-guidelines.adoc#value-type[samm:Value]).
168-
enriched with semantic metadata). In either case, the data type of the `samm:exampleValue` must be convertible to
169-
the effective data type defined by the Property's Characteristic. For example, if the Characteristic's `samm:dataType`
168+
In either case, the data type of the `samm:exampleValue` must be convertible to the effective data type defined by the Property's Characteristic.
169+
For example, if the Characteristic's `samm:dataType`
170170
is `xsd:int`, a value with the type `xsd:short` is also acceptable. Refer to section xref:datatypes.adoc#implicit-conversions[Implicit Conversions]
171171
for more details. | {nok}
172172
|===

esmf-semantic-aspect-meta-model/src/main/resources/samm/meta-model/2.2.0/aspect-meta-model-shapes.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ samm:ValueShape
10321032
sh:targetClass samm:Value ;
10331033
sh:property [
10341034
sh:path samm:value ;
1035-
sh:minCount 0 ;
1035+
sh:minCount 1 ;
10361036
sh:maxCount 1 ;
10371037
sh:name "value" ;
10381038
sh:description "A single constant value or link to another resource." ;
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
11
package org.eclipse.esmf.samm;
22

3+
import org.eclipse.esmf.samm.validation.SemanticError;
4+
35
import org.junit.jupiter.params.ParameterizedTest;
46
import org.junit.jupiter.params.provider.MethodSource;
57

68
class ValueTest extends AbstractShapeTest {
79

810
@ParameterizedTest
911
@MethodSource( value = "versionsStartingWith2_2_0" )
10-
void defaultValueDefinition ( final KnownVersion metaModelVersion ) {
12+
void defaultValueDefinition( final KnownVersion metaModelVersion ) {
1113
checkValidity( "value-shape", "DefaultValue", metaModelVersion );
1214
}
1315

16+
@ParameterizedTest
17+
@MethodSource( "versionsStartingWith2_2_0" )
18+
void invalidValueDeclarationExpectedFailure( KnownVersion metaModelVersion ) {
19+
final SemanticError expectedError = new SemanticError( "Property needs to have at least 1 values, but found 0",
20+
testNamespacePrefix + "GreenLight", "urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#value", violationUrn, "" );
21+
22+
expectSemanticValidationErrors( "value-shape", "InvalidValueDeclaration", metaModelVersion, expectedError );
23+
}
24+
1425
@ParameterizedTest
1526
@MethodSource( value = "versionsStartingWith2_2_0" )
16-
void valueWithEnumeration ( final KnownVersion metaModelVersion ) {
27+
void valueWithEnumeration( final KnownVersion metaModelVersion ) {
1728
checkValidity( "value-shape", "ValueWithEnumeration", metaModelVersion );
1829
}
1930

2031
@ParameterizedTest
2132
@MethodSource( value = "versionsStartingWith2_2_0" )
22-
void multipleValueWithEnumeration ( final KnownVersion metaModelVersion ) {
33+
void multipleValueWithEnumeration( final KnownVersion metaModelVersion ) {
2334
checkValidity( "value-shape", "MultipleValueWithEnumeration", metaModelVersion );
2435
}
2536

2637
@ParameterizedTest
2738
@MethodSource( value = "versionsStartingWith2_2_0" )
28-
void referenceValueWithProperty ( final KnownVersion metaModelVersion ) {
39+
void referenceValueWithProperty( final KnownVersion metaModelVersion ) {
2940
checkValidity( "value-shape", "ReferenceValueWithProperty", metaModelVersion );
3041
}
3142

3243
@ParameterizedTest
3344
@MethodSource( value = "versionsStartingWith2_2_0" )
34-
void anonymousDescribedValueInExampleValue ( final KnownVersion metaModelVersion ) {
45+
void anonymousDescribedValueInExampleValue( final KnownVersion metaModelVersion ) {
3546
checkValidity( "value-shape", "AnonymousDescribedValueInExampleValue", metaModelVersion );
3647
}
3748
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# Copyright (c) 2025 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+
@prefix : <urn:samm:org.eclipse.esmf.samm.test:1.0.0#> .
14+
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:2.2.0#> .
15+
@prefix samm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:2.2.0#> .
16+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
17+
18+
:GreenLight a samm:Value ;
19+
samm:preferredName "Normal"@en ;
20+
samm:description "Indicates that the speed of position change is within specification."@en ;
21+
samm:see <https://en.wikipedia.org/wiki/Traffic_light> .

0 commit comments

Comments
 (0)