query-c41f9b6dbb0bdc4a2731b6ef101ce022

rq turtle/ttl

fortifications that have tripadvisor ids with English and foreign labels

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?item ?itemLabel ?en_label ?label WHERE {
  SELECT DISTINCT ?item ?en_label (SAMPLE(COALESCE(?en_label, ?item_label)) as ?label) WHERE {
    ?item p:P31 ?statement0.
    #?statement0 (ps:P31/(wdt:P279*)) wd:Q1785071.
    #?statement0 (ps:P31/(wdt:P279*)) wd:Q91122.
    ?statement0 (ps:P31/(wdt:P279*)) wd:Q16748868.
    OPTIONAL {?item rdfs:label ?en_label . FILTER(LANG(?en_label) = "en")}
    OPTIONAL {?item rdfs:label ?item_label}
    #?item wdt:P17 wd:Q794.
      ?item p:P3134 ?statement2.
      ?statement2 (ps:P3134) _:anyValueP3134.
  }
  GROUP BY ?item ?en_label
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?en_label"):::projected v2("?item"):::projected v4("?item_label") v6("?label"):::projected v3("?statement0") v5("?statement2") a2((" ")) a1((" ")) c5(["wd:Q16748868"]):::iri v2 --"p:P31"--> v3 v3 --"p:statement/P31"--> a1 a1 --"p:direct/P279"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."rdfs:label".-> v1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."rdfs:label".-> v4 end v2 --"p:P3134"--> v5 v5 --"p:statement/P3134"--> a2 bind1[/"sample(?en_label?item_label)"/] v1 --o bind1 v4 --o bind1 bind1 --as--o v6