@@ -3125,7 +3125,7 @@ <h3>Value Type Constraint Components</h3>
3125
3125
< section id ="ClassConstraintComponent ">
3126
3126
< h4 > sh:class</ h4 >
3127
3127
< p >
3128
- The condition specified by < code > sh:class</ code > is that each < a > value node</ a > is a < a > SHACL instance</ a > of a given type.
3128
+ The condition specified by < code > sh:class</ code > is that each < a > value node</ a > is a < a > SHACL instance</ a > of the given type(s) .
3129
3129
</ p >
3130
3130
< p >
3131
3131
< span class ="component-class "> Constraint Component IRI</ span > : < code > sh:ClassConstraintComponent</ code >
@@ -3141,23 +3141,29 @@ <h4>sh:class</h4>
3141
3141
< td > < code > sh:class</ code > </ td >
3142
3142
< td >
3143
3143
The type of all value nodes.
3144
- < span data-syntax-rule ="class-nodeKind "> The values of < code > sh:class</ code > in a shape are IRIs.</ span >
3144
+ < span data-syntax-rule ="class-nodeKind "> The values of < code > sh:class</ code > in a shape are either < a > IRIs</ a >
3145
+ or < a > blank nodes</ a > that are < a > well-formed</ a > < a > SHACL lists</ a > where all < a > members</ a > are < a > IRIs</ a > .</ span >
3145
3146
</ td >
3146
3147
</ tr >
3147
3148
</ table >
3148
3149
< div class ="def def-text ">
3149
3150
< div class ="def-header "> TEXTUAL DEFINITION</ div >
3150
3151
< div class ="def-text-body " data-validator ="Class ">
3151
3152
Let < code > $class</ code > be a < a > parameter value</ a > for < code > sh:class</ code > .
3153
+ Let < code > classes</ code > be a set of < a > IRIs</ a > so that
3154
+ when < code > $class</ code > is an < a > IRI</ a > then the set only consists of exactly that IRI,
3155
+ and when < code > $class</ code > is a < a > blank node</ a > < a > SHACL list</ a > then the set consists of
3156
+ exactly the members of the list.< br /> < br />
3152
3157
For each < a > value node</ a >
3153
- that is either a < a > literal</ a > , or a non-literal that is not a < a > SHACL instance</ a > of < code > $class </ code > in the < a > data graph</ a > ,
3158
+ that is either a < a > literal</ a > , or a non-literal that is not a < a > SHACL instance</ a > of any of the < code > classes </ code > in the < a > data graph</ a > ,
3154
3159
there is a < a > validation result</ a > with the < a > value node</ a > as < code > sh:value</ code > .
3155
3160
</ div >
3156
3161
</ div >
3157
3162
< p > < em > The remainder of this section is informative.</ em > </ p >
3158
3163
< p >
3159
3164
Note that multiple values for < code > sh:class</ code > are interpreted as a conjunction,
3160
- i.e. the values need to be SHACL instances of all of them.
3165
+ i.e., the values need to be SHACL instances of all of them.
3166
+ Use lists for union semantics.
3161
3167
</ p >
3162
3168
< aside class ="example ">
3163
3169
< div class ="shapes-graph ">
@@ -3231,6 +3237,37 @@ <h4>sh:class</h4>
3231
3237
</ div >
3232
3238
</ div >
3233
3239
</ aside >
3240
+ < p >
3241
+ The following example illustrates the list-based syntax for < code > sh:class</ code > ,
3242
+ meaning that the values of the property < code > ex:pet</ code > must be either cats or dogs.
3243
+ </ p >
3244
+ < aside class ="example ">
3245
+ < div class ="shapes-graph ">
3246
+ < div class ="turtle ">
3247
+ ex:ClassListExampleShape
3248
+ a sh:NodeShape ;
3249
+ < span class ="target-can-be-skipped "> sh:targetClass ex:Person ;</ span >
3250
+ sh:property [
3251
+ sh:path ex:pet ;
3252
+ sh:class ( ex:Cat ex:Dog ) ;
3253
+ ] .
3254
+ </ div >
3255
+ < div class ="jsonld ">
3256
+ </ div >
3257
+ </ div >
3258
+ < div class ="data-graph ">
3259
+ < div class ="turtle ">
3260
+ ex:Tessie a ex:Cat .
3261
+ ex:Rusty a ex:Dog .
3262
+ ex:Fluffy a ex:Unicorn .
3263
+
3264
+ ex:Alice a ex:Person ; ex:pet ex:Tessie, ex:Rusty .
3265
+ < span class ="focus-node-error "> ex:Bob</ span > a ex:Person ; ex:pet ex:Fluffy .
3266
+ </ div >
3267
+ < div class ="jsonld ">
3268
+ </ div >
3269
+ </ div >
3270
+ </ aside >
3234
3271
</ section >
3235
3272
3236
3273
< section id ="DatatypeConstraintComponent ">
@@ -3251,19 +3288,24 @@ <h4>sh:datatype</h4>
3251
3288
< tr >
3252
3289
< td > < code > sh:datatype</ code > </ td >
3253
3290
< td >
3254
- The datatype of all value nodes (e.g., < code > xsd:integer</ code > ).
3255
- < span data-syntax-rule ="datatype-nodeKind "> The values of < code > sh:datatype</ code > in a shape are < a > IRIs</ a > .</ span >
3291
+ The allowed datatype(s) of all value nodes (e.g., < code > xsd:integer</ code > ).
3256
3292
< span data-syntax-rule ="datatype-maxCount "> A shape has at most one value for < code > sh:datatype</ code > .</ span >
3293
+ < span data-syntax-rule ="datatype-nodeKind "> The value of < code > sh:datatype</ code > in a shape is either an < a > IRI</ a >
3294
+ or a < a > blank node</ a > that is a < a > well-formed</ a > < a > SHACL list</ a > where all < a > members</ a > are < a > IRIs</ a > .</ span >
3257
3295
</ td >
3258
3296
</ tr >
3259
3297
</ table >
3260
3298
< div class ="def def-text ">
3261
3299
< div class ="def-header "> TEXTUAL DEFINITION</ div >
3262
3300
< div class ="def-text-body " data-validator ="Datatype ">
3263
3301
Let < code > $datatype</ code > be a < a > parameter value</ a > for < code > sh:datatype</ code > .
3302
+ Let < code > datatypes</ code > be a set of < a > IRIs</ a > so that
3303
+ when < code > $datatype</ code > is an < a > IRI</ a > then the set only consists of exactly that IRI,
3304
+ and when < code > $datatype</ code > is a < a > blank node</ a > < a > SHACL list</ a > then the set consists of
3305
+ exactly the members of the list.< br /> < br />
3264
3306
For each < a > value node</ a >
3265
- that is not a < a > literal</ a > , or is a < a > literal</ a > with a datatype that does not match < code > $datatype </ code > ,
3266
- there is a < a > validation result</ a > with the < a > value node</ a > as < code > sh:value</ code > .
3307
+ that is not a < a > literal</ a > , or is a < a > literal</ a > with a datatype that matches none of the < code > datatypes </ code > ,
3308
+ there is a < a > validation result</ a > with the < a > value node</ a > as < code > sh:value</ code > .< br /> < br />
3267
3309
The datatype of a literal is determined following the < a data-cite ="sparql12-query/#func-datatype "> datatype</ a > function of SPARQL 1.2.
3268
3310
A < a > literal</ a > matches a datatype if the < a > literal</ a > 's datatype has the same < a > IRI</ a >
3269
3311
and, for the datatypes supported by SPARQL 1.2, is not an < a data-cite ="rdf12-concepts#section-Graph-Literal "> ill-typed</ a > literal.
@@ -3272,9 +3314,8 @@ <h4>sh:datatype</h4>
3272
3314
< p > < em > The remainder of this section is informative.</ em > </ p >
3273
3315
< p >
3274
3316
The values of < code > sh:datatype</ code > are typically < a > datatypes</ a > , such as < code > xsd:string</ code > .
3275
- Note that using < code > rdf:langString</ code > as value of < code > sh:datatype</ code > can be used to test if value nodes have a language tag.
3276
3317
</ p >
3277
- < aside class ="example " title ="Shape with sh:datatype property constraint ">
3318
+ < aside class ="example " title ="Shape with an IRI as sh:datatype property constraint ">
3278
3319
< div class ="shapes-graph ">
3279
3320
< div class ="turtle ">
3280
3321
ex:DatatypeExampleShape
@@ -3343,6 +3384,34 @@ <h4>sh:datatype</h4>
3343
3384
</ div >
3344
3385
</ div >
3345
3386
</ aside >
3387
+ < p >
3388
+ The following example illustrates the list-based syntax, meaning that all values of
3389
+ < code > rdfs:label</ code > must be either < code > xsd:string</ code > or < code > rdf:langString</ code > .
3390
+ Note that using < code > rdf:langString</ code > as value of < code > sh:datatype</ code > can be used to test if value nodes have a language tag.
3391
+ </ p >
3392
+ < aside class ="example " title ="Shape with a list of IRIs as sh:datatype property constraint ">
3393
+ < div class ="shapes-graph ">
3394
+ < div class ="turtle ">
3395
+ ex:TextExampleShape
3396
+ a sh:NodeShape ;
3397
+ < span class ="target-can-be-skipped "> sh:targetNode ex:Estonia, ex:GreatBritain ;</ span >
3398
+ sh:property [
3399
+ sh:path rdfs:label ;
3400
+ sh:datatype ( xsd:string rdf:langString ) ;
3401
+ ] .
3402
+ </ div >
3403
+ < div class ="jsonld ">
3404
+ </ div >
3405
+ </ div >
3406
+ < div class ="data-graph ">
3407
+ < div class ="turtle ">
3408
+ ex:Estonia rdfs:label "Estonia", "Estland"@de .
3409
+ < span class ="focus-node-error "> ex:GreatBritain</ span > rdfs:label "Great Britain", "<b>Great</b> Britain"^^rdf:HTML .
3410
+ </ div >
3411
+ < div class ="jsonld ">
3412
+ </ div >
3413
+ </ div >
3414
+ </ aside >
3346
3415
</ section >
3347
3416
3348
3417
< section id ="NodeKindConstraintComponent ">
@@ -6866,10 +6935,10 @@ <h2>Changes between SHACL 1.0 Core and SHACL 1.2 Core</h2>
6866
6935
< ul >
6867
6936
< li > Introduced < a > node expressions</ a > as an extension point to dynamically compute lists of nodes. Generalized < code > sh:targetNode</ code > , < code > sh:deactivated</ code > and < code > sh:defaultValue</ code > , and introduced < code > sh:values</ code > to support node expressions.</ li >
6868
6937
< li > Added the new constraint component < a href ="#SingleLineConstraintComponent "> < code > sh:singleLine</ code > </ a > , see < a href ="https://github.com/w3c/data-shapes/issues/177 "> Issue 177</ a > </ li >
6869
- < li > Added the new class < a href ="#ShapeClass "> < code > sh:ShapeClass</ code > </ a > for implicit class targets, see < a href ="https://github.com/w3c/data-shapes/issues/212 "> Issue 212</ a > </ li >
6870
- < li > Moved SPARQL-based validators from Core to an Appendix of SHACL-SPARQL, see < a href ="https://github.com/w3c/data-shapes/issues/271 "> Issue 271</ a > </ li >
6871
- < li > Added the new constraint component < a href ="#ExpressionConstraintComponent "> < code > sh:expression</ code > </ a > , see < a href ="https://github.com/w3c/data-shapes/issues/357 "> Issue 357</ a > </ li >
6872
- < li > Values for < a href =" #deactivated " > < code > sh:deactivated </ code > </ a > , < a href ="#message "> < code > sh:message </ code > </ a > and < a href ="#severity "> < code > sh:severity </ code > </ a > can now be specified using RDF 1.2 reification, see < a href ="https://github.com/w3c/data-shapes/issues/173 "> Issue 173 </ a > </ li >
6938
+ < li > Added the new class < a href ="#ShapeClass "> < code > sh:ShapeClass</ code > </ a > for implicit class targets; see < a href ="https://github.com/w3c/data-shapes/issues/212 "> Issue 212</ a > </ li >
6939
+ < li > Moved SPARQL-based validators from Core to an Appendix of SHACL-SPARQL; see < a href ="https://github.com/w3c/data-shapes/issues/271 "> Issue 271</ a > </ li >
6940
+ < li > Added the new constraint component < a href ="#ExpressionConstraintComponent "> < code > sh:expression</ code > </ a > ; see < a href ="https://github.com/w3c/data-shapes/issues/357 "> Issue 357</ a > </ li >
6941
+ < li > The values of < a href ="#ClassConstraintComponent "> < code > sh:class </ code > </ a > and < a href ="#DatatypeConstraintComponent "> < code > sh:datatype </ code > </ a > can now also be lists, indicating a union of choices; see < a href ="https://github.com/w3c/data-shapes/issues/160 "> Issue 160 </ a > </ li >
6873
6942
</ ul >
6874
6943
</ section >
6875
6944
</ body >
0 commit comments