diff --git a/shacl12-core/images/Class-Diagram-Arrows.png b/shacl12-core/images/Class-Diagram-Arrows.png deleted file mode 100644 index 7145e83f..00000000 Binary files a/shacl12-core/images/Class-Diagram-Arrows.png and /dev/null differ diff --git a/shacl12-core/images/Makefile b/shacl12-core/images/Makefile new file mode 100644 index 00000000..0a74db0f --- /dev/null +++ b/shacl12-core/images/Makefile @@ -0,0 +1,4 @@ +all: SHACL-UML.svg + +%.svg: %.puml + plantuml -Tsvg $^ diff --git a/shacl12-core/images/SHACL-UML.puml b/shacl12-core/images/SHACL-UML.puml new file mode 100644 index 00000000..927667a2 --- /dev/null +++ b/shacl12-core/images/SHACL-UML.puml @@ -0,0 +1,66 @@ +@startuml +hide circles +hide empty members +skinparam pathHoverColor red ' on cover, highlight blue links as red +' skinparam topurl https://raw.githack.com/w3c/data-shapes/master/shacl12-core/index.html ' links resolve to anchors in current HTML page, when the SVG is embedded + +class "sh:Shape" as Shape [[#shapes]] { + [[#targetClass sh:targetClass]] : rdfs:Class + [[#targetNode sh:targetNode]] : any + [[#targetSubjectsOf sh:targetSubjectsOf]] : rdf:Property + [[#targetObjectsOf sh:targetObjectsOf]] : rdf:Property + [[#targetWhere sh:targetWhere]] : sh:NodeShape + .... + [[#deactivated sh:deactivated]] : xsd:boolean + [[#message sh:message]] : xsd:string or rdf:langString + [[#severity sh:severity]] : sh:Severity +} + +class "sh:NodeShape" as NodeShape [[#node-shapes]] { + [[#constraints Constraint parameters]], for example: + [[#NodeKindConstraintComponent sh:nodeKind]] a sh:NodeKind + [[#ClosedConstraintComponent sh:closed]] : xsd:boolean or [[#syntax-rule-closed-datatype sh:ByTypes]] + [[#ClosedConstraintComponent sh:ignoredProperties]] : list + [[#OrConstraintComponent sh:or]], [[#AndConstraintComponent sh:and]], [[#XoneConstraintComponent sh:xone]] : list of Shape + [[#NotConstraintComponent sh:not]] : [[#shapes sh:Shape]] + ... +} + +class "sh:PropertyShape" as PropertyShape [[#property-shapes]] { + [[#property-paths sh:path]] : predicate or list or blank node + .... + [[#constraints Constraint parameters]], for example: + [[#MinCountConstraintComponent sh:minCount]], [[#MaxCountConstraintComponent sh:maxCount]] : xsd:integer + [[#MinLengthConstraintComponent sh:minLength]], [[#MaxLengthConstraintComponent sh:maxLength]] : xsd:integer + [[#ClassConstraintComponent sh:class]] or [[#DatatypeConstraintComponent sh:datatype]] : IRI or list of IRIs + [[#NodeConstraintComponent sh:node]] : [[#node-shapes sh:NodeShape]] + ... + .... + [[#core-components-list List constraints]] + [[#MemberShapeConstraintComponent sh:memberShape]] : [[#node-shapes sh:NodeShape]] + [[#MinListLengthConstraintComponent sh:minListLength]], [[#MaxListLengthConstraintComponent sh:maxListLength]]: xsd:integer + [[#UniqueMembersConstraintComponent sh:uniqueMembers]] : xsd:boolean + .... + [[#name sh:name]] : xsd:string or rdf:langString + [[#description sh:description]] : xsd:string or rdf:langString + [[#syntax-rule-path-defaultValue sh:defaultValue]] : any + [[#syntax-rule-path-defaultValue sh:values]] : any + [[#codeIdentifier sh:codeIdentifier]] : xsd:string + [[#order sh:order]] : xsd:integer or xsd:decimal +} + +class "sh:PropertyGroup" as PropertyGroup [[#group sh:group]] { + [[#group sh:order]] : xsd:integer or xsd:decimal + ... eg rdfs:label +} + +Shape <|-- NodeShape +Shape <|-- PropertyShape +NodeShape -> PropertyShape : [[#property-shapes sh:property]] * +PropertyShape --> PropertyGroup : [[#group sh:group]] + +' These links make the diagram too busy, so omit them for now. They are listed as fields +' PropertyShape -> NodeShape : [[#NodeConstraintComponent sh:node]] +' PropertyShape -> NodeShape : [[#MemberShapeConstraintComponent sh:memberShape]] +' Shape -> NodeShape : [[#targetWhere sh:targetWhere]] +@enduml diff --git a/shacl12-core/images/SHACL-UML.svg b/shacl12-core/images/SHACL-UML.svg new file mode 100644 index 00000000..e40b4a38 --- /dev/null +++ b/shacl12-core/images/SHACL-UML.svg @@ -0,0 +1 @@ +sh:Shapesh:targetClass: rdfs:Classsh:targetNode: anysh:targetSubjectsOf: rdf:Propertysh:targetObjectsOf: rdf:Propertysh:targetWhere: sh:NodeShapesh:deactivated: xsd:booleansh:message: xsd:string or rdf:langStringsh:severity: sh:Severitysh:NodeShapeConstraint parameters, for example:sh:nodeKinda sh:NodeKindsh:closed: xsd:boolean orsh:ByTypessh:ignoredProperties: listsh:or,sh:and,sh:xone: list of Shapesh:not:sh:Shape...sh:PropertyShapesh:path: predicate or list or blank nodeConstraint parameters, for example:sh:minCount,sh:maxCount: xsd:integersh:minLength,sh:maxLength: xsd:integersh:classorsh:datatype: IRI or list of IRIssh:node:sh:NodeShape...List constraintssh:memberShape:sh:NodeShapesh:minListLength,sh:maxListLength: xsd:integersh:uniqueMembers: xsd:booleansh:name: xsd:string or rdf:langStringsh:description: xsd:string or rdf:langStringsh:defaultValue: anysh:values: anysh:codeIdentifier: xsd:stringsh:order: xsd:integer or xsd:decimalsh:PropertyGroupsh:order: xsd:integer or xsd:decimal... eg rdfs:labelsh:property*sh:group \ No newline at end of file diff --git a/shacl12-core/index.html b/shacl12-core/index.html index f2e51773..274f5bce 100644 --- a/shacl12-core/index.html +++ b/shacl12-core/index.html @@ -1115,70 +1115,15 @@

Shapes and Constraints

The following introduction is non-normative.

- The following informal diagram provides an overview of some of the key classes in the SHACL vocabulary. + The following UML diagram provides an overview of some of the key classes and properties in the SHACL vocabulary. Each box represents a class. The content of the boxes under the class name lists some of the properties that instances of these classes may have, together with their value types. - The arrows indicate rdfs:subClassOf triples. + Empty arrowheads indicate inheritance (rdfs:subClassOf) and normal arrowheads indicate RDF relations. +

+
+

+ The Turtle serialization of the SHACL vocabulary contains the complete SHACL vocabulary.

-
-
- -
-
-
sh:targetClass : rdfs:Class
- -
sh:targetObjectsOf : rdf:Property
-
sh:targetSubjectsOf : rdf:Property
-
-
-
sh:deactivated : xsd:boolean
-
sh:message : xsd:string or rdf:langString
-
sh:severity : sh:Severity
-
-
-
-
- Class Diagram Arrows -
-
-
- -
-
-
Constraint parameters, for example:
-
sh:closed : xsd:boolean or sh:ByTypes
-
sh:or : rdf:List
-
sh:not : sh:Shape
-
sh:property : sh:PropertyShape
-
-
-
-
- -
-
-
Constraint parameters, for example:
-
sh:minCount, sh:maxCount : xsd:integer
-
sh:class or sh:datatype : rdfs:Resource
-
sh:node : sh:NodeShape
-
-
-
sh:name : xsd:string or rdf:langString
-
sh:description : xsd:string or rdf:langString
- -
sh:group : sh:PropertyGroup
-
-
-
sh:path : rdfs:Resource
-
-
-
-
-
-

- The Turtle serialization of the SHACL vocabulary contains the complete SHACL vocabulary. -

-
@@ -7976,12 +7921,20 @@

Changes between SHACL 1.0 Core and SHACL 1.2 Core

diff --git a/shacl12-sparql/index.html b/shacl12-sparql/index.html index 5ecb3331..f6dc805b 100644 --- a/shacl12-sparql/index.html +++ b/shacl12-sparql/index.html @@ -930,7 +930,7 @@

Syntax of SPARQL-based Constraints

and this value is either true or false.

- SELECT queries used in the context of property shapes use a special variable named PATH as a placeholder for the path used by the shape. + SELECT queries used in the context of property shapes use a special variable named PATH (spelled in UPPERCASE) as a placeholder for the path used by the shape.

The only legal use of the variable PATH in the SPARQL queries of SPARQL-based constraints @@ -1042,19 +1042,27 @@

Validation with SPARQL-based Constraints

TEXTUAL DEFINITION
- Let $sparql be a value of sh:sparql. - There are no validation results if the SPARQL-based constraint has true - as a value for the property sh:deactivated. - Otherwise, execute the SPARQL query specified by the SPARQL-based constraint $sparql - pre-binding the variable this as described in . - If the shape is a property shape, then prior to execution - substitute the variable PATH where it appears in the predicate - position of a triple pattern - with a valid SPARQL surface syntax string of the SHACL property path - specified via sh:path at the property shape. - There is one validation result for each solution that does not have true as the binding for the variable failure. - These validation results MUST have the property values explained in . - A failure MUST be produced if and only if one of the solutions has true as the binding for failure. +

+ Let $sparql be a value of sh:sparql. + There are no validation results if the SPARQL-based constraint has true + as a value for the property sh:deactivated. + Otherwise, execute the SPARQL query specified by the SPARQL-based constraint $sparql + pre-binding the variable this as described in . +

+

+ If the shape is a property shape, then prior to execution + substitute the variable PATH where it appears in the predicate + position of a triple pattern + with a valid SPARQL surface syntax string of the SHACL property path + specified via sh:path at the property shape. + If sh:path is not a well-formed SHACL property path then return an error, + and as a precaution may also substitute the signal value "BAD-PATH", which will make the SPARQL query invalid. +

+

+ There is one validation result for each solution that does not have true as the binding for the variable failure. + These validation results MUST have the property values explained in . + A failure MUST be produced if and only if one of the solutions has true as the binding for failure. +

@@ -1546,10 +1554,8 @@

Validation with SPARQL-based Constraint Components

  • For SELECT-based validators: If the shape is a property shape, then prior to execution - substitute the variable PATH where it appears in the predicate - position of a triple pattern - with a valid SPARQL surface syntax string of the SHACL property path - specified via sh:path at the property shape. + substitute the variable PATH with a valid SPARQL surface syntax string of the SHACL property path + (see the reference "substitute" for details). Let QS be the solutions produced by executing the SPARQL query.
  • @@ -2261,6 +2267,7 @@

    Security and Privacy Considerations

    SHACL-SPARQL includes all the security issues of SPARQL. + In particular, the substitution of variable PATH constitutes SPARQL string injection, which may pose additional risks.

    diff --git a/shacl12-vocabularies/shacl-shacl.ttl b/shacl12-vocabularies/shacl-shacl.ttl index 31f7e7a5..fc0536f3 100644 --- a/shacl12-vocabularies/shacl-shacl.ttl +++ b/shacl12-vocabularies/shacl-shacl.ttl @@ -23,11 +23,11 @@ shsh: shsh:ListShape a sh:NodeShape ; rdfs:label "List shape"@en ; - rdfs:comment "A shape describing well-formed RDF lists. Currently does not check for non-recursion. This could be expressed using SHACL-SPARQL."@en ; + rdfs:comment "A shape describing well-formed RDF lists. Currently does not check for non-recursion (this could be expressed using SHACL-SPARQL)."@en ; rdfs:seeAlso ; sh:property [ sh:path [ sh:zeroOrMorePath rdf:rest ] ; - rdfs:comment "Each list member (including this node) must be have the shape shsh:ListNodeShape."@en ; + rdfs:comment "Each list member (including this node) must have the shape shsh:ListNodeShape."@en ; sh:hasValue rdf:nil ; sh:node shsh:ListNodeShape ; ] .