query-51f2cc5701db1465e215ed12168c0ce4
barragem (Q12323) ; Brasil (Q155) SELECT DISTINCT ?item ?itemLabel ?itemDescription ?located_in_admLabel ?coordinate_location WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". } { SELECT DISTINCT ?item WHERE { { ?item p:P31 ?statement0. ?statement0 (ps:P31/(wdt:P279)) wd:Q12323. FILTER(EXISTS { ?statement0 prov:wasDerivedFrom ?reference. }) } { ?item p:P17 ?statement1. ?statement1 (ps:P17/(wdt:P279)) wd:Q155. FILTER(EXISTS { ?statement1 prov:wasDerivedFrom ?reference. }) } } # LIMIT 10000 } OPTIONAL { ?item wdt:P131 ?located_in_adm. } OPTIONAL { ?item wdt:P625 ?coordinate_location. } }
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# barragem (Q12323) ; Brasil (Q155)
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?located_in_admLabel ?coordinate_location WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
{
SELECT DISTINCT ?item WHERE {
{
?item p:P31 ?statement0.
?statement0 (ps:P31/(wdt:P279*)) wd:Q12323.
FILTER(EXISTS { ?statement0 prov:wasDerivedFrom ?reference. })
}
{
?item p:P17 ?statement1.
?statement1 (ps:P17/(wdt:P279*)) wd:Q155.
FILTER(EXISTS { ?statement1 prov:wasDerivedFrom ?reference. })
}
}
# LIMIT 10000
}
OPTIONAL { ?item wdt:P131 ?located_in_adm. }
OPTIONAL { ?item wdt:P625 ?coordinate_location. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?coordinate_location"):::projected
v3("?item"):::projected
v5("?located_in_adm")
v2("?reference")
v1("?statement0")
v4("?statement1")
a1((" "))
a2((" "))
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;"]):::literal
c12(["wd:Q155"]):::iri
c9(["wd:Q12323"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0v1 --"prov:wasDerivedFrom"--> e0v2
e0v2("?reference"):::projected
e0v1("?statement0"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c5
f0 --> v2
v1 --"prov:wasDerivedFrom"--> v2
v3 --"p:P31"--> v1
v1 --"p:statement/P31"--> a1
a1 --"p:direct/P279"--> c9
f1[[" "]]
subgraph f1e1["Exists Clause"]
e1v1 --"prov:wasDerivedFrom"--> e1v2
e1v2("?reference"):::projected
e1v1("?statement1"):::projected
end
f1--EXISTS--> f1e1
f1 --> v4
f1 --> c5
f1 --> v2
v4 --"prov:wasDerivedFrom"--> v2
v3 --"p:P17"--> v4
v4 --"p:statement/P17"--> a2
a2 --"p:direct/P279"--> c12
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P131".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P625".-> v6
end