query-39f79efe38328364afcd2fa2ea1c4fe7

rq turtle/ttl

Official languages (Popov) SELECT ?countryLabel ?country2 ?country3 ?wikilang ?languageLabel ?language2 ?language3 WHERE { ?country wdt:P31 wd:Q6256. ?country wdt:P37 ?language. OPTIONAL { # ISO 3166-1 alpha-2 code ?country wdt:P297 ?country2. } OPTIONAL { # ISO 3166-1 alpha-3 code ?country wdt:P298 ?country3. } OPTIONAL { # ISO 639-1 code ?language wdt:P218 ?language2. } OPTIONAL { # ISO 639-3 code ?language wdt:P220 ?language3. } OPTIONAL { # Wikimedia language code ?language wdt:P424 ?wikilang. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

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#>
#Official languages (Popov)
SELECT ?countryLabel ?country2 ?country3 ?wikilang ?languageLabel ?language2 ?language3
WHERE 
{
  ?country wdt:P31 wd:Q6256.
  ?country wdt:P37 ?language.
  OPTIONAL {
    # ISO 3166-1 alpha-2 code
    ?country wdt:P297 ?country2.
  }
  OPTIONAL {
    # ISO 3166-1 alpha-3 code
    ?country wdt:P298 ?country3.
  }
  OPTIONAL {
    # ISO 639-1 code
    ?language wdt:P218 ?language2.
  }
  OPTIONAL {
    # ISO 639-3 code
    ?language wdt:P220 ?language3.
  }
  OPTIONAL {
    # Wikimedia language code
    ?language wdt:P424 ?wikilang.
  }
  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; v1("?country") v3("?country2"):::projected v4("?country3"):::projected v2("?language") v5("?language2"):::projected v6("?language3"):::projected v7("?wikilang"):::projected c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q6256"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P37"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P297".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P298".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P218".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P220".-> v6 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P424".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end