query-58d5b1e65389877ee6d0277ac1b063ca

rq turtle/ttl

TODO

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#>
SELECT distinct ?film ?label_de ?nativeTitle ?itemLabel ?label ?langLabel WHERE {
  ?film wdt:P31 wd:Q11424.
  ?film wdt:P161 wd:Q180338.
  ?film wdt:P577 ?publ.
  ?film wdt:P495 ?country .            # get film's country of origin
  ?country wdt:P37 ?official_lang .    # get country's official language
  ?official_lang  wdt:P424 ?langcode . # get language code for the language
  OPTIONAL { ?official_lang rdfs:label ?langLabel . filter (lang(?langLabel) = ?langcode) }
                                       # for this example, get the label of the language

  OPTIONAL { ?film wdt:P1705 ?nativeTitle . filter(lang(?nativeTitle)=?langcode) }
                                       # get the native title  filtered by the language code

  OPTIONAL { ?film rdfs:label ?itemLabel . filter (lang(?itemLabel) = ?langcode) }
                                       # get the item Label filtered by the language code

                                       # coalesce will choose the first valid value as ?label
  bind(coalesce(?nativeTitle, ?itemLabel) as ?label)
  OPTIONAL { ?film rdfs:label ?label_de filter (lang(?label_de) = "de")}.
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?country") v6("?film"):::projected v2("?itemLabel"):::projected v10("?label"):::projected v1("?label_de"):::projected v5("?langLabel"):::projected v3("?langcode") v4("?nativeTitle"):::projected v9("?official_lang") v7("?publ") c5(["wd:Q180338"]):::iri c3(["wd:Q11424"]):::iri v6 --"wdt:P31"--> c3 v6 --"wdt:P161"--> c5 v6 --"wdt:P577"--> v7 v6 --"wdt:P495"--> v8 v8 --"wdt:P37"--> v9 v9 --"wdt:P424"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v9 -."rdfs:label".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P1705".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."rdfs:label".-> v2 end bind0[/"?nativeTitle?itemLabel"/] v4 --o bind0 v2 --o bind0 bind0 --as--o v10 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v6 -."rdfs:label".-> v1 end