query-bbde7c45853679b901d074cc7031a01d
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
#articles anglais, français et anglais-français géolocalisés au Nouveau-Brunswick
#defaultView:Map{"hide":["?rgb","?layer"]}
SELECT ?item ?coord ?en ?fr ?layer ?rgb WHERE {
?item wdt:P17 wd:Q16;
(wdt:P131*) wd:Q1965;
wdt:P625 ?coord.
OPTIONAL {
?en schema:about ?item;
schema:isPartOf <https://en.wikipedia.org/>.
}
OPTIONAL
{
?fr schema:about ?item;
schema:isPartOf <https://fr.wikipedia.org/>.
}
FILTER(BOUND(?en)|| BOUND(?fr))
BIND (if(BOUND(?en) && BOUND(?fr),"ff0000",if(BOUND(?en),"00ff00",if(BOUND(?fr),"0000FF","000000" ))) as ?rgb)
BIND (if(BOUND(?en) && BOUND(?fr),"EN & FR",if(BOUND(?en),"EN",if(BOUND(?fr),"FR","NIL" ))) as ?layer)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?coord"):::projected
v1("?en"):::projected
v2("?fr"):::projected
v3("?item"):::projected
v6("?layer"):::projected
v5("?rgb"):::projected
c2(["wd:Q16"]):::iri
c8([https://en.wikipedia.org/]):::iri
c4(["wd:Q1965"]):::iri
c9([https://fr.wikipedia.org/]):::iri
f0[["(bound(?en) || bound(?fr))"]]
f0 --> v1
f0 --> v2
v3 --"wdt:P17"--> c2
v3 --"wdt:P131"--> c4
v3 --"wdt:P625"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."schema:about".-> v3
v1 --"schema:isPartOf"--> c8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."schema:about".-> v3
v2 --"schema:isPartOf"--> c9
end
bind1[/"if(bound(?en)bound(?fr),'ff0000',if(bound(?en),'00ff00',if(bound(?fr),'0000FF','000000')))"/]
v1 --o bind1
v2 --o bind1
bind1 --as--o v5
bind2[/"if(bound(?en)bound(?fr),'EN & FR',if(bound(?en),'EN',if(bound(?fr),'FR','NIL')))"/]
v1 --o bind2
v2 --o bind2
bind2 --as--o v6