query-ebd4893e2b656c842d1df9caa830c24e
Scottish food query
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 bd: <http://www.bigdata.com/rdf#>
#defaultView:Graph
SELECT DISTINCT ?food ?foodLabel ?foodgenreLabel ?foodURI ?protfoodLabel WHERE { {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?foodTypes {
wd:Q2095
wd:Q114392939
wd:Q182940
wd:Q41415
wd:Q3125526
wd:Q10514020
wd:Q5159627
wd:Q131419
}
{{?food wdt:P31 ?foodTypes.} UNION {?food wdt:P279 ?foodTypes.}.
?food wdt:P495 wd:Q22.}.
OPTIONAL {?food wdt:P279 ?foodgenre.}
OPTIONAL {?food wdt:P1389 ?protfood.}
optional { ?food wdt:P18 ?foodURI } .
}}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?food"):::projected
v1("?foodTypes")
v5("?foodURI"):::projected
v3("?foodgenre")
v4("?protfood")
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c8(["wd:Q22"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
bind0[/VALUES ?foodTypes/]
bind0-->v1
bind00(["wd:Q2095"])
bind00 --> bind0
bind01(["wd:Q114392939"])
bind01 --> bind0
bind02(["wd:Q182940"])
bind02 --> bind0
bind03(["wd:Q41415"])
bind03 --> bind0
bind04(["wd:Q3125526"])
bind04 --> bind0
bind05(["wd:Q10514020"])
bind05 --> bind0
bind06(["wd:Q5159627"])
bind06 --> bind0
bind07(["wd:Q131419"])
bind07 --> bind0
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P279"--> v1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P31"--> v1
end
union0r <== or ==> union0l
end
v2 --"wdt:P495"--> c8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P279".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1389".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P18".-> v5
end