SHACL Shapes
https://meta.linked.archi/archimate4/viewpoint-shapes#
SHACL shapes for validating that architecture Views conform to their declared Viewpoints. These shapes enforce: 1. Viewpoint declaration — every View declares exactly one viewpoint, as an arch:Viewpoint individual rather than a literal. 2. View type conformance — a View's rdf:type must match one of the viewpoint's arch:viewType values (Diagram, Catalog, Matrix). 3. Element conformance — elements presented in a View, linked by arch:inView, must be instances of types the viewpoint's arch:includesConcept allows. 4. Relationship endpoint conformance — the endpoints of a relationship drawn on a View should themselves be in the viewpoint's palette. 5. Viewpoint completeness — a viewpoint should declare what it admits and which kinds of view realise it. Data-driven: viewpoint definitions are read from the loaded graph (arch:includesConcept, arch:viewType) rather than hardcoded per viewpoint, so these work for the published 4.0 catalogue and for custom viewpoints alike. Shapes 1-3 are sh:Warning, 4-5 sh:Info. Organizations may promote any of them. Usage: .scripts/validate.sh --shacl archimate4-viewpoints Loading manually, core-onto.ttl must be among the SHAPES documents as well as the data: the shapes target arch:View and arch:Viewpoint, and RDF4J resolves the rdfs:subClassOf closure for sh:targetClass and sh:class from the shapes graph. Without it nothing fires on an arch:Diagram instance.
SELECT $this ?vp ?rel ?endpoint ?endpointType
WHERE {
$this arch:viewConformsToViewpoint ?vp .
?rel arch:inView $this .
?rel a/rdfs:subClassOf* arch:QualifiedRelationship .
{ ?rel arch:source ?endpoint . }
UNION
{ ?rel arch:target ?endpoint . }
?endpoint rdf:type ?endpointType .
?endpointType rdfs:subClassOf* arch:Element .
FILTER(?endpointType != arch:Element)
FILTER EXISTS { ?vp arch:includesConcept ?anyConcept . }
FILTER NOT EXISTS {
?endpoint rdf:type/rdfs:subClassOf* ?allowedType .
?vp arch:includesConcept ?allowedType .
}
}
| Property | Constraint | Value | Severity | Message |
|---|---|---|---|---|
viewConformsToViewpoint |
class | Viewpoint | Warning | |
viewConformsToViewpoint |
maxCount | 1 |
Warning | |
viewConformsToViewpoint |
minCount | 1 |
Warning |
SELECT $this ?vp ?element ?elementType WHERE {
$this arch:viewConformsToViewpoint ?vp .
?element arch:inView $this .
?element rdf:type ?elementType .
?elementType rdfs:subClassOf* arch:Element .
FILTER(?elementType != arch:Element)
FILTER EXISTS { ?vp arch:includesConcept ?anyConcept . }
FILTER NOT EXISTS {
?element rdf:type/rdfs:subClassOf* ?allowedType .
?vp arch:includesConcept ?allowedType .
}
}
SELECT $this ?vp ?viewType
WHERE {
$this arch:viewConformsToViewpoint ?vp .
$this rdf:type ?viewType .
?viewType rdfs:subClassOf* arch:View .
FILTER(?viewType != arch:View)
FILTER NOT EXISTS {
?vp arch:viewType ?allowedType .
?viewType rdfs:subClassOf* ?allowedType .
}
FILTER EXISTS {
?vp arch:viewType ?anyType .
}
}
| Property | Constraint | Value | Severity | Message |
|---|---|---|---|---|
includesConcept |
minCount | 1 |
Info | |
viewType |
minCount | 1 |
Info |