SHACL Shapes
https://meta.linked.archi/archimate/viewpoint-shapes#
SHACL shapes for validating that architecture Views conform to their declared Viewpoints. These shapes enforce: 1. Element conformance — elements exposed in a View must be instances of types listed in the viewpoint's arch:includesConcept. 2. View type conformance — a View's rdf:type must match one of the viewpoint's arch:viewType values (Diagram, Catalog, Matrix). 3. Viewpoint declaration — every View must declare which viewpoint it conforms to via arch:viewConformsToViewpoint. These shapes are data-driven: they read the viewpoint definitions from the loaded graph (arch:includesConcept, arch:viewType) rather than hardcoding per-viewpoint rules. This means they work for any viewpoint — ArchiMate example viewpoints, custom viewpoints, or viewpoints from other frameworks — as long as the viewpoint data is loaded. Shapes use sh:severity sh:Warning by default. Organizations may promote specific shapes to sh:Violation based on governance policies. Usage: .scripts/validate.sh --shacl archimate-viewpoints Or load manually: core-shapes.ttl + archimate3.2-viewpoint-shapes.ttl + archimate3.2-viewpoints.ttl + your-model-data.ttl
SELECT $this ?vp ?element ?elemType
WHERE {
$this arch:viewConformsToViewpoint ?vp .
?element arch:exposedInView $this .
?element rdf:type ?elemType .
?elemType rdfs:subClassOf* arch:Element .
FILTER(?elemType != arch:Element)
# The viewpoint must have at least one includesConcept
FILTER EXISTS { ?vp arch:includesConcept ?anyConcept . }
# The element's type (or any of its superclasses) must match
FILTER NOT EXISTS {
?element rdf:type/rdfs:subClassOf* ?allowedType .
?vp arch:includesConcept ?allowedType .
}
}
SELECT $this ?vp ?rel ?endpoint ?endpointType
WHERE {
$this arch:viewConformsToViewpoint ?vp .
?rel arch:exposedInView $this .
?rel a/rdfs:subClassOf* arch:QualifiedRelationship .
# Check both source and target
{ ?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 ?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 | |
viewpointFramesConcern |
minCount | 1 |
Info |