query-6c05f303e1564e7f73ceb9d21798775d
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?item ?witch ?ItemLabel ?Residence ?coordinate (?Gender as ?layer) ?rgb
WHERE {
?item wdt:P4478 ?witch;
wdt:P551 ?residence.
?residence wdt:P625 ?coordinate.
OPTIONAL
{
?item wdt:P21 ?gender .
}
BIND(IF(!BOUND(?gender),"00FF00",IF(CONTAINS(STR(?gender),"Q6581097"),"0000FF","FF0000")) as ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?item rdfs:label ?ItemLabel.
?residence rdfs:label ?Residence .
?gender rdfs:label ?Gender.
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?Gender"):::projected
v7("?ItemLabel"):::projected
v8("?Residence"):::projected
v4("?coordinate"):::projected
v5("?gender")
v1("?item"):::projected
v10("?layer")
v3("?residence")
v6("?rgb"):::projected
v2("?witch"):::projected
c6(["bd:serviceParam"]):::iri
c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"wdt:P4478"--> v2
v1 --"wdt:P551"--> v3
v3 --"wdt:P625"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P21".-> v5
end
bind0[/"if(not bound(?gender),'00FF00',if(contains(str(?gender),'Q6581097'),'0000FF','FF0000'))"/]
v5 --o bind0
bind0 --as--o v6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
v1 --"rdfs:label"--> v7
v3 --"rdfs:label"--> v8
v5 --"rdfs:label"--> v9
end
bind1[/"?Gender"/]
v9 --o bind1
bind1 --as--o v10