diff --git a/shacl12-core/index.html b/shacl12-core/index.html index 666223db..f9a6a2c0 100644 --- a/shacl12-core/index.html +++ b/shacl12-core/index.html @@ -3125,7 +3125,7 @@

Value Type Constraint Components

sh:class

- The condition specified by sh:class is that each value node is a SHACL instance of a given type. + The condition specified by sh:class is that each value node is a SHACL instance of the given type(s).

Constraint Component IRI: sh:ClassConstraintComponent @@ -3141,7 +3141,8 @@

sh:class

sh:class The type of all value nodes. - The values of sh:class in a shape are IRIs. + The values of sh:class in a shape are either IRIs + or blank nodes that are well-formed SHACL lists where all members are IRIs. @@ -3149,15 +3150,20 @@

sh:class

TEXTUAL DEFINITION
Let $class be a parameter value for sh:class. + Let classes be a set of IRIs so that + when $class is an IRI then the set only consists of exactly that IRI, + and when $class is a blank node SHACL list then the set consists of + exactly the members of the list.

For each value node - that is either a literal, or a non-literal that is not a SHACL instance of $class in the data graph, + that is either a literal, or a non-literal that is not a SHACL instance of any of the classes in the data graph, there is a validation result with the value node as sh:value.

The remainder of this section is informative.

Note that multiple values for sh:class are interpreted as a conjunction, - i.e. the values need to be SHACL instances of all of them. + i.e., the values need to be SHACL instances of all of them. + Use lists for union semantics.

+

+ The following example illustrates the list-based syntax for sh:class, + meaning that the values of the property ex:pet must be either cats or dogs. +

+
@@ -3251,9 +3288,10 @@

sh:datatype

sh:datatype - The datatype of all value nodes (e.g., xsd:integer). - The values of sh:datatype in a shape are IRIs. + The allowed datatype(s) of all value nodes (e.g., xsd:integer). A shape has at most one value for sh:datatype. + The value of sh:datatype in a shape is either an IRI + or a blank node that is a well-formed SHACL list where all members are IRIs. @@ -3261,9 +3299,13 @@

sh:datatype

TEXTUAL DEFINITION
Let $datatype be a parameter value for sh:datatype. + Let datatypes be a set of IRIs so that + when $datatype is an IRI then the set only consists of exactly that IRI, + and when $datatype is a blank node SHACL list then the set consists of + exactly the members of the list.

For each value node - that is not a literal, or is a literal with a datatype that does not match $datatype, - there is a validation result with the value node as sh:value. + that is not a literal, or is a literal with a datatype that matches none of the datatypes, + there is a validation result with the value node as sh:value.

The datatype of a literal is determined following the datatype function of SPARQL 1.2. A literal matches a datatype if the literal's datatype has the same IRI and, for the datatypes supported by SPARQL 1.2, is not an ill-typed literal. @@ -3272,9 +3314,8 @@

sh:datatype

The remainder of this section is informative.

The values of sh:datatype are typically datatypes, such as xsd:string. - Note that using rdf:langString as value of sh:datatype can be used to test if value nodes have a language tag.

-
@@ -6866,10 +6935,10 @@

Changes between SHACL 1.0 Core and SHACL 1.2 Core

diff --git a/shacl12-test-suite/tests/core/node/datatype-003.ttl b/shacl12-test-suite/tests/core/node/datatype-003.ttl new file mode 100644 index 00000000..25865f34 --- /dev/null +++ b/shacl12-test-suite/tests/core/node/datatype-003.ttl @@ -0,0 +1,45 @@ +@prefix dash: . +@prefix ex: . +@prefix mf: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix sht: . +@prefix xsd: . + +ex:TestShape + rdf:type sh:NodeShape ; + sh:datatype ( xsd:string rdf:langString ) ; + sh:targetNode "Hello"^^rdf:HTML ; + sh:targetNode "G'day"@en-AU ; + sh:targetNode "Hallo"@de ; + sh:targetNode "Hello" ; +. +<> + rdf:type mf:Manifest ; + mf:entries ( + + ) ; +. + + rdf:type sht:Validate ; + rdfs:label "Test of sh:datatype at node shape 003" ; + mf:action [ + sht:dataGraph <> ; + sht:shapesGraph <> ; + ] ; + mf:result [ + rdf:type sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode "Hello"^^rdf:HTML ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape ex:TestShape ; + sh:value "Hello"^^rdf:HTML ; + ] ; + ] ; + mf:status sht:approved ; +. diff --git a/shacl12-test-suite/tests/core/node/manifest.ttl b/shacl12-test-suite/tests/core/node/manifest.ttl index 7cf8dc3d..8fc34296 100644 --- a/shacl12-test-suite/tests/core/node/manifest.ttl +++ b/shacl12-test-suite/tests/core/node/manifest.ttl @@ -14,6 +14,7 @@ mf:include ; mf:include ; mf:include ; + mf:include ; mf:include ; mf:include ; mf:include ; diff --git a/shacl12-test-suite/tests/core/property/class-002.ttl b/shacl12-test-suite/tests/core/property/class-002.ttl new file mode 100644 index 00000000..50ae0562 --- /dev/null +++ b/shacl12-test-suite/tests/core/property/class-002.ttl @@ -0,0 +1,98 @@ +@prefix dash: . +@prefix ex: . +@prefix mf: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix sht: . +@prefix xsd: . + +ex:InvalidResource1 + rdf:type rdfs:Resource ; + ex:testProperty ex:InvalidResource1 ; + ex:testProperty "A string" ; +. +ex:OtherClass + rdf:type rdfs:Class ; +. +ex:OtherClassInstance + rdf:type ex:OtherClass ; +. +ex:SubClass + rdf:type rdfs:Class ; + rdfs:subClassOf ex:SuperClass ; +. +ex:SubClassInstance + rdf:type ex:SubClass ; +. +ex:SuperClass + rdf:type rdfs:Class ; +. +ex:SuperClassInstance + rdf:type ex:SuperClass ; +. +ex:TestShape + rdf:type sh:NodeShape ; + sh:property ex:TestShape-testProperty ; + sh:targetNode ex:InvalidResource1 ; + sh:targetNode ex:ValidResource1 ; + sh:targetNode ex:ValidResource2 ; +. +ex:TestShape-testProperty + sh:path ex:testProperty ; + rdfs:label "test property" ; + sh:class ( ex:SuperClass ex:OtherClass ) ; +. +ex:ValidResource1 + rdf:type rdfs:Resource ; + ex:testProperty ex:OtherClassInstance ; + ex:testProperty ex:SubClassInstance ; + ex:testProperty ex:SuperClassInstance ; +. +ex:ValidResource2 + rdf:type rdfs:Resource ; + ex:testProperty [ + rdf:type ex:SubClass ; + ] ; + ex:testProperty [ + rdf:type ex:SuperClass ; + ] ; +. +<> + rdf:type mf:Manifest ; + mf:entries ( + + ) ; +. + + rdf:type sht:Validate ; + rdfs:label "Test of sh:class at property shape 002" ; + mf:action [ + sht:dataGraph <> ; + sht:shapesGraph <> ; + ] ; + mf:result [ + rdf:type sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidResource1 ; + sh:resultPath ex:testProperty ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape ex:TestShape-testProperty ; + sh:value ex:InvalidResource1 ; + ] ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidResource1 ; + sh:resultPath ex:testProperty ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:ClassConstraintComponent ; + sh:sourceShape ex:TestShape-testProperty ; + sh:value "A string" ; + ] ; + ] ; + mf:status sht:approved ; +. diff --git a/shacl12-test-suite/tests/core/property/datatype-004.ttl b/shacl12-test-suite/tests/core/property/datatype-004.ttl new file mode 100644 index 00000000..7d39af51 --- /dev/null +++ b/shacl12-test-suite/tests/core/property/datatype-004.ttl @@ -0,0 +1,62 @@ +@prefix dash: . +@prefix ex: . +@prefix mf: . +@prefix owl: . +@prefix rdf: . +@prefix rdfs: . +@prefix sh: . +@prefix sht: . +@prefix xsd: . + +ex:InvalidInstance1 + ex:value 42 ; +. +ex:TestShape + rdf:type sh:NodeShape ; + sh:property ex:TestShape-value ; + sh:targetNode ex:InvalidInstance1 ; + sh:targetNode ex:ValidInstance1 ; + sh:targetNode ex:ValidInstance2 ; + sh:targetNode ex:ValidInstance3 ; +. +ex:TestShape-value + sh:path ex:value ; + sh:datatype ( xsd:string rdf:langString ) ; +. +ex:ValidInstance1 + ex:value "A" ; +. +ex:ValidInstance2 + ex:value "A" ; +. +ex:ValidInstance3 + ex:value "A"@en ; +. +<> + rdf:type mf:Manifest ; + mf:entries ( + + ) ; +. + + rdf:type sht:Validate ; + rdfs:label "Test of sh:datatype at property shape 004" ; + mf:action [ + sht:dataGraph <> ; + sht:shapesGraph <> ; + ] ; + mf:result [ + rdf:type sh:ValidationReport ; + sh:conforms "false"^^xsd:boolean ; + sh:result [ + rdf:type sh:ValidationResult ; + sh:focusNode ex:InvalidInstance1 ; + sh:resultPath ex:value ; + sh:resultSeverity sh:Violation ; + sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; + sh:sourceShape ex:TestShape-value ; + sh:value 42 ; + ] ; + ] ; + mf:status sht:approved ; +. diff --git a/shacl12-test-suite/tests/core/property/manifest.ttl b/shacl12-test-suite/tests/core/property/manifest.ttl index 5648df92..2ab26040 100644 --- a/shacl12-test-suite/tests/core/property/manifest.ttl +++ b/shacl12-test-suite/tests/core/property/manifest.ttl @@ -7,9 +7,11 @@ rdfs:label "Tests converted from http://datashapes.org/sh/tests/tests/core/property" ; mf:include ; mf:include ; + mf:include ; mf:include ; mf:include ; mf:include ; + mf:include ; mf:include ; mf:include ; mf:include ;