Question Set
https://meta.linked.archi/core-questions#
The questions any Linked.Archi model answers, whatever its modelling language: what it contains, what an element is related to, which views show what, and how sound the description is. Each is executable SPARQL bound to the concerns it informs (see arch:ModelQuestion).
16 model questions: questions the model answers, each with the SPARQL that answers it, bound to the concerns it informs. A finding question's rows are problems against those concerns: none means they are met.
core/inventory
?model (optional) — The model to count. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT ?kind ?type (COUNT(DISTINCT ?concept) AS ?count)
WHERE {
?concept arch:inModel ?model ;
rdf:type ?type .
# The most specific type: neither a core class nor an abstract one.
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
# A view by its own kind, not also as arch:View.
FILTER(?type != arch:View || NOT EXISTS { ?concept rdf:type ?viewKind . FILTER(?viewKind IN (arch:Diagram, arch:Catalog, arch:Matrix)) })
BIND(IF(EXISTS { ?concept arch:source ?anySource }, "relationship",
IF(EXISTS { ?concept rdf:type ?anyViewType . FILTER(?anyViewType IN (arch:View, arch:Diagram, arch:Catalog, arch:Matrix)) },
"view", "element")) AS ?kind)
}
GROUP BY ?kind ?type
ORDER BY ?kind DESC(?count) ?type
core/element-detail
?focus — The concept the question is about. A modelling tool binds the selected element.SELECT DISTINCT ?property ?value ?valueLabel
WHERE {
?focus ?property ?value .
# Its own type: not the core or abstract classes it is also an instance of.
FILTER(?property != rdf:type || ?value NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS {
SELECT DISTINCT ?property ?value
WHERE {
BIND(rdf:type AS ?property)
{ ?value arch:isAbstractClass true } UNION { GRAPH ?abstractClassGraph { ?value arch:isAbstractClass true } }
}
}
# A value's name: a concept's from the model, a type's from its metamodel.
OPTIONAL {
{ ?value skos:prefLabel ?valueLabel } UNION { GRAPH ?labelGraph { ?value skos:prefLabel ?valueLabel } }
FILTER(lang(?valueLabel) = "" || langMatches(lang(?valueLabel), "en"))
}
}
ORDER BY ?property
core/elements-by-type
?conceptType (optional) — An element type, such as an application component.?model (optional) — The model to look in. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT DISTINCT ?element ?label ?type ?definition
WHERE {
?element arch:inModel ?model ;
rdf:type ?conceptType ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
# Elements only: not relationships, views or folders.
FILTER NOT EXISTS { ?element arch:source ?anySource }
FILTER NOT EXISTS { ?element rdf:type ?notElement . FILTER(?notElement IN (arch:View, arch:Diagram, arch:Catalog, arch:Matrix, arch:Folder)) }
OPTIONAL { ?element skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
OPTIONAL { ?element skos:definition ?definition . FILTER(lang(?definition) = "" || langMatches(lang(?definition), "en")) }
}
ORDER BY ?type ?label
core/neighbours-qualified
?focus — The element the question is about. A modelling tool binds the selected element.SELECT DISTINCT ?direction ?relationship ?relationshipType ?other ?otherLabel
WHERE {
{
?relationship arch:source ?focus ;
arch:target ?other .
BIND("outgoing" AS ?direction)
}
UNION
{
?relationship arch:target ?focus ;
arch:source ?other .
BIND("incoming" AS ?direction)
}
?relationship rdf:type ?relationshipType .
FILTER(?relationshipType NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?relationshipType WHERE { { ?relationshipType arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?relationshipType arch:isAbstractClass true } } } }
OPTIONAL { ?other skos:prefLabel ?otherLabel . FILTER(lang(?otherLabel) = "" || langMatches(lang(?otherLabel), "en")) }
}
ORDER BY ?direction ?relationshipType ?otherLabel
core/dependents-qualified
?focus — The element the question is about. A modelling tool binds the selected element.SELECT DISTINCT ?hops ?dependent ?dependentLabel ?firstType ?via ?secondType
WHERE {
{
?first arch:source ?dependent ;
arch:target ?focus ;
rdf:type ?firstType .
BIND(1 AS ?hops)
}
UNION
{
?first arch:source ?via ;
arch:target ?focus ;
rdf:type ?firstType .
?second arch:source ?dependent ;
arch:target ?via ;
rdf:type ?secondType .
FILTER(?dependent != ?focus)
FILTER(?secondType NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
BIND(2 AS ?hops)
}
FILTER(?firstType NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?firstType WHERE { { ?firstType arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?firstType arch:isAbstractClass true } } } }
MINUS { SELECT DISTINCT ?secondType WHERE { { ?secondType arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?secondType arch:isAbstractClass true } } } }
OPTIONAL { ?dependent skos:prefLabel ?dependentLabel . FILTER(lang(?dependentLabel) = "" || langMatches(lang(?dependentLabel), "en")) }
}
ORDER BY ?hops ?dependentLabel
core/lifecycle
?model (optional) — The model to look in. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT ?element ?label ?type ?state ?approval
WHERE {
?element arch:inModel ?model ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
OPTIONAL { ?element arch:architectureState ?state }
OPTIONAL { ?element arch:approvalState ?approval }
FILTER(BOUND(?state) || BOUND(?approval))
OPTIONAL { ?element skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
}
ORDER BY ?approval ?state ?type ?label
core/unpresented
?element
?model (optional) — The model to look in. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT ?element ?label ?type
WHERE {
?element arch:inModel ?model ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
FILTER NOT EXISTS { ?element arch:source ?anySource }
FILTER NOT EXISTS { ?element rdf:type ?notElement . FILTER(?notElement IN (arch:View, arch:Diagram, arch:Catalog, arch:Matrix, arch:Folder)) }
FILTER NOT EXISTS { ?element arch:inView ?anyView }
OPTIONAL { ?element skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
}
ORDER BY ?type ?label
core/coverage-gaps
?element
?conceptType (optional) — An element type, such as an application component.?model (optional) — The model to look in. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT DISTINCT ?element ?label ?type
WHERE {
?element arch:inModel ?model ;
rdf:type ?conceptType ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
FILTER NOT EXISTS { ?element arch:source ?anySource }
FILTER NOT EXISTS { ?element rdf:type ?notElement . FILTER(?notElement IN (arch:View, arch:Diagram, arch:Catalog, arch:Matrix, arch:Folder)) }
FILTER NOT EXISTS { ?element skos:definition ?anyDefinition }
OPTIONAL { ?element skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
}
ORDER BY ?type ?label
core/label-collisions
?element
?model (optional) — The model whose elements are reported. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT DISTINCT ?element ?label ?type ?sharedBy
WHERE {
{
SELECT ?type ?key (COUNT(DISTINCT ?candidate) AS ?sharedBy)
WHERE {
?candidate arch:inModel ?anyModel ;
rdf:type ?type ;
skos:prefLabel ?candidateLabel .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
FILTER NOT EXISTS { ?candidate arch:source ?anySource }
FILTER NOT EXISTS { ?candidate rdf:type ?notElement . FILTER(?notElement IN (arch:View, arch:Diagram, arch:Catalog, arch:Matrix, arch:Folder)) }
BIND(LCASE(STR(?candidateLabel)) AS ?key)
}
GROUP BY ?type ?key
HAVING (COUNT(DISTINCT ?candidate) > 1)
}
?element arch:inModel ?model ;
rdf:type ?type ;
skos:prefLabel ?label .
FILTER(LCASE(STR(?label)) = ?key)
}
ORDER BY ?key ?type
core/orphans
?element
?model (optional) — The model to look in. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT ?element ?label ?type
WHERE {
?element arch:inModel ?model ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
FILTER NOT EXISTS { ?element arch:source ?anySource }
FILTER NOT EXISTS { ?element rdf:type ?notElement . FILTER(?notElement IN (arch:View, arch:Diagram, arch:Catalog, arch:Matrix, arch:Folder)) }
FILTER NOT EXISTS { ?incoming arch:target ?element }
FILTER NOT EXISTS { ?outgoing arch:source ?element }
OPTIONAL { ?element skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
}
ORDER BY ?type ?label
core/reifies-audit
?relationship
SELECT DISTINCT ?relationship ?type ?source ?target ?problem
WHERE {
?relationship arch:source ?source ;
arch:target ?target ;
rdf:type ?type .
# Only types with an unqualified form carry the direct triple.
{ ?type arch:unqualifiedForm ?predicate }
UNION
{ GRAPH ?mappingGraph { ?type arch:unqualifiedForm ?predicate } }
FILTER NOT EXISTS {
?relationship rdf:reifies <<( ?source ?predicate ?target )>> .
?source ?predicate ?target .
}
BIND(IF(NOT EXISTS { ?relationship rdf:reifies ?anyTerm }, "no rdf:reifies",
IF(NOT EXISTS { ?source ?predicate ?target }, "direct triple not asserted",
"rdf:reifies names a different triple")) AS ?problem)
}
ORDER BY ?problem ?type
core/view-contents-semantic
?view — A view. A modelling tool binds the open view.SELECT ?concept ?label ?type ?kind
WHERE {
?concept arch:inView ?view ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
BIND(IF(EXISTS { ?concept arch:source ?anySource }, "relationship", "element") AS ?kind)
OPTIONAL { ?concept skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
}
ORDER BY ?kind ?type ?label
core/viewpoint-scope
?viewpoint — A viewpoint. A modelling tool binds the open view's viewpoint; a deliverable, the section's.?model (optional) — The model to look in. A modelling tool binds the open model; a deliverable, the model it is produced from.SELECT ?element (SAMPLE(?anyLabel) AS ?label) ?type (SAMPLE(?anyDefinition) AS ?definition)
(GROUP_CONCAT(DISTINCT ?link; separator = "; ") AS ?outgoing)
WHERE {
# What each viewpoint admits: the types it names and their specialisations.
{
SELECT DISTINCT ?viewpoint ?type
WHERE {
{ ?viewpoint arch:includesConcept ?admitted }
UNION
{ GRAPH ?admittingGraph { ?viewpoint arch:includesConcept ?admitted } }
{ ?type rdfs:subClassOf* ?admitted }
UNION
{ GRAPH ?hierarchyGraph { ?type rdfs:subClassOf* ?admitted } }
}
}
?element rdf:type ?type ;
arch:inModel ?model .
FILTER NOT EXISTS { ?element arch:source ?anySource }
OPTIONAL { ?element skos:prefLabel ?anyLabel . FILTER(lang(?anyLabel) = "" || langMatches(lang(?anyLabel), "en")) }
OPTIONAL { ?element skos:definition ?anyDefinition . FILTER(lang(?anyDefinition) = "" || langMatches(lang(?anyDefinition), "en")) }
OPTIONAL {
?relationship arch:source ?element ;
arch:target ?other ;
rdf:type ?relationshipType .
FILTER(?relationshipType NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?relationshipType WHERE { { ?relationshipType arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?relationshipType arch:isAbstractClass true } } } }
OPTIONAL { ?other skos:prefLabel ?otherLabel . FILTER(lang(?otherLabel) = "" || langMatches(lang(?otherLabel), "en")) }
BIND(CONCAT(REPLACE(STR(?relationshipType), "^.*[#/]", ""), " → ",
COALESCE(STR(?otherLabel), STR(?other))) AS ?link)
}
}
GROUP BY ?element ?type
ORDER BY ?type ?label
core/viewpoint-conformance
?element
?view (optional) — A view to check; every view when none is given. A modelling tool binds the open view.SELECT DISTINCT ?view ?viewpoint ?element ?label ?type
WHERE {
?element arch:inView ?view ;
rdf:type ?type .
FILTER(?type NOT IN (arch:ModelConcept, arch:Element, arch:QualifiedRelationship))
MINUS { SELECT DISTINCT ?type WHERE { { ?type arch:isAbstractClass true }
UNION { GRAPH ?abstractClassGraph { ?type arch:isAbstractClass true } } } }
FILTER NOT EXISTS { ?element arch:source ?anySource }
?view arch:viewConformsToViewpoint ?viewpoint .
# Only viewpoints that state what they admit are judged.
{ SELECT DISTINCT ?viewpoint WHERE { { ?viewpoint arch:includesConcept ?anyConcept }
UNION { GRAPH ?declaringGraph { ?viewpoint arch:includesConcept ?anyConcept } } } }
# What each admits: the types it names and their specialisations.
MINUS {
SELECT DISTINCT ?viewpoint ?type
WHERE {
{ ?viewpoint arch:includesConcept ?admitted }
UNION
{ GRAPH ?admittingGraph { ?viewpoint arch:includesConcept ?admitted } }
{ ?type rdfs:subClassOf* ?admitted }
UNION
{ GRAPH ?hierarchyGraph { ?type rdfs:subClassOf* ?admitted } }
}
}
OPTIONAL { ?element skos:prefLabel ?label . FILTER(lang(?label) = "" || langMatches(lang(?label), "en")) }
}
ORDER BY ?view ?type ?label
core/unknown-viewpoints
?view
SELECT ?view ?viewLabel ?viewpoint
WHERE {
?view arch:viewConformsToViewpoint ?viewpoint .
FILTER NOT EXISTS {
{ ?viewpoint rdf:type ?anyType }
UNION
{ GRAPH ?definingGraph { ?viewpoint rdf:type ?anyType } }
}
OPTIONAL { ?view skos:prefLabel ?viewLabel . FILTER(lang(?viewLabel) = "" || langMatches(lang(?viewLabel), "en")) }
}
ORDER BY ?viewLabel
core/view-usage-semantic
?focus — The element the question is about. A modelling tool binds the selected element.SELECT ?view ?viewLabel ?viewpoint
WHERE {
?focus arch:inView ?view .
OPTIONAL { ?view skos:prefLabel ?viewLabel . FILTER(lang(?viewLabel) = "" || langMatches(lang(?viewLabel), "en")) }
OPTIONAL { ?view arch:viewConformsToViewpoint ?viewpoint }
}
ORDER BY ?viewLabel