A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/author_other-locations.sparql
Author aspect: other locations
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#defaultView:Map
PREFIX target: <http://www.wikidata.org/entity/Q97270>
SELECT DISTINCT ?image ?item ?itemLabel ?geo (?property_item_label AS ?layer)
WHERE {
target: ?property ?item .
?item p:P159/pq:P625 | wdt:P276*/wdt:P625 ?geo .
?property_item wikibase:directClaim ?property .
OPTIONAL { ?item wdt:P18 ?image . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
# No automatic labeling on the property, - for some reason.
?property_item rdfs:label ?property_item_label . FILTER(LANG(?property_item_label) = 'en')
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?geo"):::projected
v6("?image"):::projected
v3("?item"):::projected
v7("?layer")
v2("?property")
v5("?property_item")
v1("?property_item_label"):::projected
a1((" "))
a2((" "))
c2([http://www.wikidata.org/entity/Q97270]):::iri
c12(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal
c10([http://www.bigdata.com/rdf#serviceParam]):::iri
f0[["?property_item_label = 'en'"]]
f0 --> v1
c2 -->v2--> v3
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"p:direct/P276"--> a2
a2 --"p:direct/P625"--> v4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"p:P159"--> a1
a1 --"p:qualifier/P625"--> v4
end
union0r <== or ==> union0l
end
v5 --"wikibase:directClaim"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P18".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
v5 --"rdfs:label"--> v1
bind1[/"?property_item_label"/]
v1 --o bind1
bind1 --as--o v7