Skip to content
Merged
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
38 changes: 38 additions & 0 deletions dqgen/resources/query_templates/instance_additions.rq
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ PREFIX sd: <http://www.w3.org/ns/sparql-service-description#>
PREFIX sh: <http://purl.org/skos-history/>
PREFIX xhv: <http://www.w3.org/1999/xhtml/vocab#>
# identify added instances
{% if cls == "owl:ObjectProperty" or cls == "owl:DatatypeProperty" %}
SELECT distinct ?class ?instance ?prefLabel ?prefLabelLang ?domain ?range ?minCardinality ?maxCardinality ("{{type_of_action}}" as ?actionType)
{% else %}
SELECT distinct ?class ?instance ?prefLabel ?prefLabelLang ("{{type_of_action}}" as ?actionType)
{% endif %}
WHERE {
GRAPH ?versionHistoryGraph {
# parameters
Expand Down Expand Up @@ -143,5 +147,39 @@ WHERE {
?instance ?p [] .
}
}
{% if cls == "owl:ObjectProperty" %}
# and we get some domain, range and cardinality information from SHACL shapes if available
OPTIONAL {
GRAPH ?newVersionGraph {
{
?nodeShape shacl:property ?propertyShape ;
shacl:targetClass ?domain .
?propertyShape shacl:path ?instance ;
shacl:class ?range .
}
UNION
{
?nodeShape shacl:property ?propertyShape ;
shacl:targetClass ?domain .
?propertyShape shacl:path ?instance ;
shacl:node/shacl:property/shacl:hasValue ?range .
}
OPTIONAL { ?propertyShape shacl:minCount ?minCardinality }
OPTIONAL { ?propertyShape shacl:maxCount ?maxCardinality }
}
}
{% elif cls == "owl:DatatypeProperty" %}
# and we get some domain, range and cardinality information from SHACL shapes if available
OPTIONAL {
GRAPH ?newVersionGraph {
?nodeShape shacl:property ?propertyShape ;
shacl:targetClass ?domain .
?propertyShape shacl:path ?instance ;
shacl:datatype ?range .
OPTIONAL { ?propertyShape shacl:minCount ?minCardinality }
OPTIONAL { ?propertyShape shacl:maxCount ?maxCardinality }
}
}
{% endif %}
}
ORDER BY ?instance