query-f39db2ef9cf3056b6749504fda191b47

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?item ?itemLabel ?sitelink ?place_servedLabel WHERE {
  {?item wdt:P238 "AAA" .}                    #item has a P238 value of AAA                
  UNION                                       # and/or
  {?item wdt:P239 "NTGA" .}                   #item has a P239 of NTGA          
  optional {?item wdt:P931 ?place_served .}   #item may have a value for P931, which is put into a variable ?place_served               
  ?sitelink schema:about ?item;                             #item has a sitelink
            schema:isPartOf <https://en.wikipedia.org/>.    #the sitelink points to en.wikipedia
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . #this bit gets labels for Qid values
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?place_served") v3("?sitelink"):::projected c2(["AAA"]):::literal c8([https://en.wikipedia.org/]):::iri c10(["bd:serviceParam"]):::iri c4(["NTGA"]):::literal c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P239"--> c4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P238"--> c2 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P931".-> v2 end v3 --"schema:about"--> v1 v3 --"schema:isPartOf"--> c8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end