query-4b04c7dc1a973d8cf4d7e296b4b03582
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?link ?linkLabel ?rgb ?toggle
WHERE {
{
SELECT DISTINCT ?item ?itemLabel ?link ?toggle
WHERE {
VALUES ?toggle {
"true"^^xsd:boolean
"false"^^xsd:boolean
}
?item1 wdt:P31/wdt:P279* wd:Q55341040;
wdt:P10568 ?item2.
BIND(IF(?toggle, ?item1, ?item2) AS ?item)
BIND(IF(?toggle, "", ?item1) AS ?link)
}
} OPTIONAL {
?item wdt:P1687 ?property.
}
# The idea is to highlight DBs linked from Wikidata, but that does not seem to work
BIND(IF(BOUND(?property),"FFA500","") AS ?rgb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item"):::projected
v2("?item1")
v3("?item2")
v5("?link"):::projected
v6("?property")
v7("?rgb"):::projected
v1("?toggle"):::projected
a1((" "))
c7(["bd:serviceParam"]):::iri
c3(["wd:Q55341040"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?toggle/]
bind0-->v1
bind00(["true^^xsd:boolean"])
bind00 --> bind0
bind01(["false^^xsd:boolean"])
bind01 --> bind0
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P10568"--> v3
bind1[/"if(?toggle,?item1,?item2)"/]
v1 --o bind1
v2 --o bind1
v3 --o bind1
bind1 --as--o v4
bind2[/"if(?toggle,'',?item1)"/]
v1 --o bind2
v2 --o bind2
bind2 --as--o v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P1687".-> v6
end
bind3[/"if(bound(?property),'FFA500','')"/]
v6 --o bind3
bind3 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end