query-6aaffde27d8bd94f1a751d0cc11f46b2

rq turtle/ttl

Shanxi food query

Use at

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 ?ownName ?foodgenreLabel ?foodareaLabel ?foodURI ?protfoodLabel WHERE { { 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  VALUES ?foodTypes {
    wd:Q2095
    wd:Q182940
    wd:Q41415
    wd:Q3125526
    wd:Q10514020
    wd:Q5159627
    wd:Q131419
    wd:Q98826752
    wd:Q746549
    }
  VALUES ?ZhPlaces {
    wd:Q29520
    wd:Q148
    wd:Q865
    }
  {{?food wdt:P31 ?foodTypes.} UNION {?food wdt:P279 ?foodTypes.}.
   ?food wdt:P361 wd:Q7489130.}. #?food wdt:P495 ?ZhPlaces.} is too crowded
  OPTIONAL {?food wdt:P1705 ?ownName.}
  OPTIONAL {?food wdt:P279 ?foodgenre.}
  OPTIONAL {?food wdt:P361 ?foodarea.}
  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("?ZhPlaces") v3("?food"):::projected v1("?foodTypes") v8("?foodURI"):::projected v6("?foodarea") v5("?foodgenre") v4("?ownName"):::projected v7("?protfood") c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal c8(["wd:Q7489130"]):::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:Q182940"]) bind01 --> bind0 bind02(["wd:Q41415"]) bind02 --> bind0 bind03(["wd:Q3125526"]) bind03 --> bind0 bind04(["wd:Q10514020"]) bind04 --> bind0 bind05(["wd:Q5159627"]) bind05 --> bind0 bind06(["wd:Q131419"]) bind06 --> bind0 bind07(["wd:Q98826752"]) bind07 --> bind0 bind08(["wd:Q746549"]) bind08 --> bind0 bind1[/VALUES ?ZhPlaces/] bind1-->v2 bind10(["wd:Q29520"]) bind10 --> bind1 bind11(["wd:Q148"]) bind11 --> bind1 bind12(["wd:Q865"]) bind12 --> bind1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P279"--> v1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"wdt:P31"--> v1 end union0r <== or ==> union0l end v3 --"wdt:P361"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P1705".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P279".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P361".-> v6 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P1389".-> v7 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P18".-> v8 end