@@ -36,7 +36,11 @@ PREFIX sd: <http://www.w3.org/ns/sparql-service-description#>
3636PREFIX sh: <http://purl.org/skos-history/>
3737PREFIX xhv: <http://www.w3.org/1999/xhtml/vocab#>
3838# identify added instances
39+ {% if cls == " owl:ObjectProperty" or cls == " owl:DatatypeProperty" %}
40+ SELECT distinct ?class ?instance ?prefLabel ?prefLabelLang ?domain ?range ?minCardinality ?maxCardinality ("{{type_of_action}}" as ?actionType )
41+ {% else %}
3942SELECT distinct ?class ?instance ?prefLabel ?prefLabelLang ("{{type_of_action}}" as ?actionType )
43+ {% endif %}
4044WHERE {
4145 GRAPH ?versionHistoryGraph {
4246 # parameters
@@ -143,5 +147,39 @@ WHERE {
143147 ?instance ?p [] .
144148 }
145149 }
150+ {% if cls == " owl:ObjectProperty" %}
151+ # and we get some domain, range and cardinality information from SHACL shapes if available
152+ OPTIONAL {
153+ GRAPH ?newVersionGraph {
154+ {
155+ ?nodeShape shacl:property ?propertyShape ;
156+ shacl:targetClass ?domain .
157+ ?propertyShape shacl:path ?instance ;
158+ shacl:class ?range .
159+ }
160+ UNION
161+ {
162+ ?nodeShape shacl:property ?propertyShape ;
163+ shacl:targetClass ?domain .
164+ ?propertyShape shacl:path ?instance ;
165+ shacl:node/shacl:property/shacl:hasValue ?range .
166+ }
167+ OPTIONAL { ?propertyShape shacl:minCount ?minCardinality }
168+ OPTIONAL { ?propertyShape shacl:maxCount ?maxCardinality }
169+ }
170+ }
171+ {% elif cls == " owl:DatatypeProperty" %}
172+ # and we get some domain, range and cardinality information from SHACL shapes if available
173+ OPTIONAL {
174+ GRAPH ?newVersionGraph {
175+ ?nodeShape shacl:property ?propertyShape ;
176+ shacl:targetClass ?domain .
177+ ?propertyShape shacl:path ?instance ;
178+ shacl:datatype ?range .
179+ OPTIONAL { ?propertyShape shacl:minCount ?minCardinality }
180+ OPTIONAL { ?propertyShape shacl:maxCount ?maxCardinality }
181+ }
182+ }
183+ {% endif %}
146184}
147185ORDER BY ?instance
0 commit comments