Skip to content

Add Plantuml variant (re #166) #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed shacl12-core/images/Class-Diagram-Arrows.png
Binary file not shown.
4 changes: 4 additions & 0 deletions shacl12-core/images/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all: SHACL-UML.svg

%.svg: %.puml
plantuml -Tsvg $^
53 changes: 53 additions & 0 deletions shacl12-core/images/SHACL-UML.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@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 "<color:blue><u>sh:Shape" as Shape [[#shapes]] {
[[#targetClass sh:targetClass]] : rdfs:Class
[[#targetNode sh:targetNode]] : any
[[#targetSubjectsOf sh:targetSubjectsOf]] : rdf:Property
[[#targetObjectsOf sh:targetObjectsOf]] : rdf:Property
....
[[#deactivated sh:deactivated]] : xsd:boolean
[[#message sh:message]] : xsd:string or rdf:langString
[[#severity sh:severity]] : sh:Severity
}

class "<color:blue><u>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 "<color:blue><u>sh:PropertyShape" as PropertyShape [[#property-shapes]] {
[[#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]]
...
....
[[#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
[[#order sh:order]] : xsd:integer or xsd:decimal
[[#property-paths sh:path]] : predicate or list or blank node
}

class "<color:blue><u>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]]
@enduml
1 change: 1 addition & 0 deletions shacl12-core/images/SHACL-UML.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 19 additions & 66 deletions shacl12-core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1115,70 +1115,15 @@ <h2>Shapes and Constraints</h2>

<p><em>The following introduction is non-normative.</em></p>
<p>
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 <code>rdfs:subClassOf</code> triples.
Empty arrowheads indicate inheritance (<code>rdfs:subClassOf</code>) and normal arrowheads indicate RDF relations.
</p>
<div id="SHACL-UML.svg"></div>
<p>
The <a href="http://www.w3.org/ns/shacl.ttl">Turtle serialization of the SHACL vocabulary</a> contains the complete SHACL vocabulary.
</p>
<div>
<div class="diagram-class" style="margin-left: 200px">
<div class="diagram-class-name"><a href="#shapes">sh:Shape</a></div>
<div class="diagram-class-properties">
<div class="diagram-class-properties-start">
<div><a href="#targetClass">sh:targetClass</a> : rdfs:Class</div>
<div><a href="#targetNode">sh:targetNode</a> : any</div>
<div><a href="#targetObjectsOf">sh:targetObjectsOf</a> : rdf:Property</div>
<div><a href="#targetSubjectsOf">sh:targetSubjectsOf</a> : rdf:Property</div>
</div>
<div class="diagram-class-properties-section">
<div><a href="#deactivated">sh:deactivated</a> : xsd:boolean</div>
<div><a href="#message">sh:message</a> : xsd:string or rdf:langString</div>
<div><a href="#severity">sh:severity</a> : sh:Severity</div>
</div>
</div>
</div>
<div style="height: 60px; margin-left: 260px">
<img alt="Class Diagram Arrows" src="images/Class-Diagram-Arrows.png">
</div>
<div style="white-space: nowrap; min-width: 1000px">
<div class="diagram-class" style="float: left; margin-right: 60px;">
<div class="diagram-class-name"><a href="#node-shapes">sh:NodeShape</a></div>
<div class="diagram-class-properties">
<div class="diagram-class-properties-start">
<div><b><a href="#constraints">Constraint parameters</a></b>, for example:</div>
<div><a href="#ClosedConstraintComponent">sh:closed</a> : xsd:boolean or sh:ByTypes</div>
<div><a href="#OrConstraintComponent">sh:or</a> : rdf:List</div>
<div><a href="#NotConstraintComponent">sh:not</a> : sh:Shape</div>
<div><a href="#PropertyConstraintComponent">sh:property</a> : sh:PropertyShape</div>
</div>
</div>
</div>
<div class="diagram-class" style="float: left;">
<div class="diagram-class-name"><a href="#property-shapes">sh:PropertyShape</a></div>
<div class="diagram-class-properties">
<div class="diagram-class-properties-start">
<div><b><a href="#constraints">Constraint parameters</a></b>, for example:</div>
<div><a href="#MinCountConstraintComponent">sh:minCount</a>, <a href="#MaxCountConstraintComponent">sh:maxCount</a> : xsd:integer</div>
<div><a href="#ClassConstraintComponent">sh:class</a> or <a href="#DatatypeConstraintComponent">sh:datatype</a> : rdfs:Resource</div>
<div><a href="#NodeConstraintComponent">sh:node</a> : sh:NodeShape</div>
</div>
<div class="diagram-class-properties-section">
<div><a href="#name">sh:name</a> : xsd:string or rdf:langString</div>
<div><a href="#description">sh:description</a> : xsd:string or rdf:langString</div>
<div><a href="#syntax-rule-path-defaultValue">sh:defaultValue</a> : any</div>
<div><a href="#group">sh:group</a> : sh:PropertyGroup</div>
</div>
<div class="diagram-class-properties-section">
<div><a href="#property-shapes">sh:path</a> : rdfs:Resource</div>
</div>
</div>
</div>
<div style="clear: both"></div>
</div>
<p>
The <a href="http://www.w3.org/ns/shacl.ttl">Turtle serialization of the SHACL vocabulary</a> contains the complete SHACL vocabulary.
</p>
</div>

<section id="shapes">

Expand Down Expand Up @@ -7976,12 +7921,20 @@ <h2>Changes between SHACL 1.0 Core and SHACL 1.2 Core</h2>

<script type="text/javascript">

tooltip = "Targets are not the only way to initiate validation, SHACL also allows specific nodes to be validated against specific shapes.";
var t = document.getElementsByClassName("target-can-be-skipped");
for (var i = 0; i < t.length; i++) {
t[i].title = tooltip;
}
// tooltip = "Targets are not the only way to initiate validation, SHACL also allows specific nodes to be validated against specific shapes.";
// var t = document.getElementsByClassName("target-can-be-skipped");
// for (var i = 0; i < t.length; i++) {
// t[i].title = tooltip;
// };

// Load and inline SVG diagram
// TODO: add desc="UML class diagram for SHACL showing Shape, NodeShape, PropertyShape, PropertyGroup" for accessibility
fetch('images/SHACL-UML.svg')
.then(response => response.text())
.then(svgText => {
const container = document.getElementById('SHACL-UML.svg');
container.innerHTML = svgText;
});
</script>


Expand Down
4 changes: 2 additions & 2 deletions shacl12-vocabularies/shacl-shacl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.w3.org/TR/shacl/#syntax-rule-SHACL-list> ;
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 ;
] .
Expand Down