Skip to content

Commit 65e29a1

Browse files
authored
Update logic for dateType validation (#360)
1 parent 45bf424 commit 65e29a1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,13 @@ samm-c:SingleEntityShape
683683
select $this $value ?code ?highlight
684684
where {
685685
$this samm:dataType ?value .
686-
filter( not exists { ?value rdf:type* samm:Entity } && not exists { ?value rdf:type* samm:AbstractEntity } )
686+
filter( isLiteral( ?value )
687+
|| strstarts( str( ?value ), str( xsd: ) )
688+
|| ( isIRI( ?value )
689+
&& not exists { ?value rdf:type* samm:Entity }
690+
&& not exists { ?value rdf:type* samm:AbstractEntity }
691+
)
692+
)
687693
bind( 'ERR_WRONG_DATATYPE' as ?code )
688694
bind( ?value as ?highlight )
689695
}

esmf-semantic-aspect-meta-model/src/test/java/org/eclipse/esmf/samm/SingleEntityShapeTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
import org.eclipse.esmf.samm.validation.SemanticError;
2020

21-
public class SingleEntityShapeTest extends AbstractShapeTest {
21+
class SingleEntityShapeTest extends AbstractShapeTest {
2222

2323
@ParameterizedTest
2424
@MethodSource( value = "allVersions" )
25-
public void testCharacteristicInstanceWithEntityDataTypeValidationExpectSuccess(
25+
void testCharacteristicInstanceWithEntityDataTypeValidationExpectSuccess(
2626
final KnownVersion metaModelVersion ) {
2727
checkValidity( "single-entity-shape", "TestSingleEntityWithEntityDataType", metaModelVersion );
2828
}
2929

3030
@ParameterizedTest
3131
@MethodSource( value = "allVersions" )
32-
public void testSingleEntityWithXsdDataTypeExpectFailure( final KnownVersion metaModelVersion ) {
32+
void testSingleEntityWithXsdDataTypeExpectFailure( final KnownVersion metaModelVersion ) {
3333
final SammUrns sammUrns = new SammUrns( metaModelVersion );
3434
final String focusNode = testNamespacePrefix + "TestSingleEntityWithXSDDataType";
3535
final String expectedMessage = validator.getMessageText( "samm-c:SingleEntityShape", "samm:dataType", "ERR_WRONG_DATATYPE",
@@ -40,4 +40,5 @@ public void testSingleEntityWithXsdDataTypeExpectFailure( final KnownVersion met
4040
expectSemanticValidationErrors( "single-entity-shape", "TestSingleEntityWithXSDDataType",
4141
metaModelVersion, resultForDataType );
4242
}
43+
4344
}

0 commit comments

Comments
 (0)