query-faed71f0a90a715d8b5630de4a00046e
PS. I forgot to mention that I removed 19:37, 12 February 2020 (UTC)) talk (Dipsacus fullonum, so there is no point in searching separate for Q1630622 because the search for Q483453 will also find them. Then for the box search to work, you shouldn't bind the ?location variable before the service is used. Below is my rewrite: --(Q483453)fountain is a subclass of (Q1630622)drinking fountain First point of optimization is to note that 20:04, 12 February 2020 (UTC)) talk (S2rapoportThis seems to work well.. Thank you for your help .. I should have asked here earlier. .. This is going to be a real help !--
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 geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?place ?placeLabel ?image ?location ?ispotable
WHERE
{
{
?place wdt:P31/wdt:P279* wd:Q483453.
MINUS { ?place wdt:P576 [] }
MINUS { ?place wdt:P582 [] }
}
UNION
{
?place wdt:P31/wdt:P279* wd:Q43483.
MINUS { ?place wdt:P576 [] }
MINUS { ?place wdt:P582 [] }
}
BIND (EXISTS { ?place wdt:P31/wdt:P279* wd:Q1630622 } as ?ispotable) # boolean indicator of potability
OPTIONAL { ?place wdt:P18 ?image. }
SERVICE wikibase:box
{
?place wdt:P625 ?location.
bd:serviceParam wikibase:cornerWest "Point(-10 35)"^^geo:wktLiteral.
bd:serviceParam wikibase:cornerEast "Point(-5 40)"^^geo:wktLiteral.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,es". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?image"):::projected
v2("?ispotable"):::projected
v4("?location"):::projected
v1("?place"):::projected
a2((" "))
a3((" "))
a5((" "))
a6((" "))
a1((" "))
a4((" "))
c6(["wd:Q43483"]):::iri
c17(["en,de,fr,it,es"]):::literal
c10(["bd:serviceParam"]):::iri
c12([sPoint(-10 35)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal
c3(["wd:Q483453"]):::iri
c14([sPoint(-5 40)^^<http://www.opengis.net/ont/geosparql#wktLiteral>"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> a4
a4 --"wdt:P279"--> c6
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"wdt:P576"--> a5
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v1 --"wdt:P582"--> a6
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v1 --"wdt:P576"--> a2
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v1 --"wdt:P582"--> a3
end
end
union0r <== or ==> union0l
end
v1 --"wdt:P31"--> null
null --"wdt:P279"--> null
bind4[/" "/]
subgraph bind4e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0a1
e0a1 --"wdt:P279"--> e0c3
e0v1("?place"):::projected
e0a1((" ")):::projected
e0c3(["wd:Q1630622"]):::iri
end
bind4--EXISTS--> bind4e0
v1 --o bind4
c1 --o bind4
null --o bind4
c2 --o bind4
null --o bind4
bind4 --as--o v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P18".-> v3
end
subgraph s1["http://wikiba.se/ontology#box"]
style s1 stroke-width:4px;
v1 --"wdt:P625"--> v4
c10 --"wikibase:cornerWest"--> c12
c10 --"wikibase:cornerEast"--> c14
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c10 --"wikibase:language"--> c17
end