query-a3a22b8b5b90e2bf0e1e3e0dffb9e621
TODO
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?statement ?rank ?snacktype ?value
{
?item wikibase:lexicalCategory wd:Q1084.
?item p:P8376 ?statement .
?statement wikibase:rank ?rank .
?item wdt:P5402 ?homograh.
OPTIONAL { ?statement ps:P8376 ?dbvalue }
BIND(COALESCE(IF(wikibase:isSomeValue(?dbvalue), "unknown", "concrete"), "novalue") AS ?snacktype)
BIND(IF(wikibase:isSomeValue(?dbvalue), "", ?dbvalue) AS ?value)
FILTER REGEX (?value, "\\w+_\\w+_\\w+").
FILTER (?rank = wikibase:NormalRank)
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;
v6("?dbvalue")
v5("?homograh")
v3("?item"):::projected
v1("?rank"):::projected
v7("?snacktype"):::projected
v4("?statement"):::projected
v8("?value"):::projected
c10(["bd:serviceParam"]):::iri
c4(["wd:Q1084"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["?rank = 'wikibase:NormalRank'"]]
f0 --> v1
f1[["regex(?value,'\w+_\w+_\w+')"]]
f1 --> v8
v3 --"wikibase:lexicalCategory"--> c4
v3 --"p:P8376"--> v4
v4 --"wikibase:rank"--> v1
v3 --"p:direct/P5402"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:statement/P8376".-> v6
end
bind2[/"if(http://wikiba.se/ontology#isSomeValue(?dbvalue),'unknown','concrete')'novalue'"/]
v6 --o bind2
bind2 --as--o v7
bind3[/"if(http://wikiba.se/ontology#isSomeValue(?dbvalue),'',?dbvalue)"/]
v6 --o bind3
bind3 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end