query-1286917b118b1433846924ddc3d38798

rq turtle/ttl

: This sort of thing?Mateusz Konieczny@

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#>
SELECT ?item ?itemLabel ?ISO639_1 ?ISO639_2 ?ISO639_3 ?country ?countryLabel
WHERE 
{
  { SELECT ?item (SAMPLE(?ISO639_1_) as ?ISO639_1) (SAMPLE(?ISO639_2_) as ?ISO639_2) (SAMPLE(?ISO639_3_) as ?ISO639_3) WHERE
    {
      {?item wdt:P218 ?ISO639_1_ .}
      UNION 
      {?item wdt:P219 ?ISO639_2_ .}
      UNION
      {?item wdt:P220 ?ISO639_3_ .}
      } group by ?item }
  ?country wdt:P463 wd:Q1065. 
  ?country wdt:P37 ?item.
  #not a former country
  FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240}
  #and no an ancient civilisation (needed to exclude ancient Egypt)
  FILTER NOT EXISTS {?country wdt:P31 wd:Q28171280}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?ISO639_1"):::projected v3("?ISO639_1_") v7("?ISO639_2"):::projected v4("?ISO639_2_") v8("?ISO639_3"):::projected v5("?ISO639_3_") v1("?country"):::projected v2("?item"):::projected c2(["wd:Q28171280"]):::iri c13(["en"]):::literal c3(["wd:Q3024240"]):::iri c11(["bd:serviceParam"]):::iri c8(["wd:Q1065"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0c2 e0v1("?country"):::projected e0c2(["wd:Q28171280"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> c2 v1 --"wdt:P31"--> c2 f1[["not "]] subgraph f1e1["Exists Clause"] e1v1 --"wdt:P31"--> e1c2 e1v1("?country"):::projected e1c2(["wd:Q3024240"]):::iri end f1--EXISTS--> f1e1 f1 --> v1 f1 --> c1 f1 --> c3 v1 --"wdt:P31"--> c3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P220"--> v5 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P219"--> v4 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P218"--> v3 end union0r <== or ==> union0l end bind5[/"sample(?ISO639_1_)"/] v3 --o bind5 bind5 --as--o v6 bind6[/"sample(?ISO639_2_)"/] v4 --o bind6 bind6 --as--o v7 bind7[/"sample(?ISO639_3_)"/] v5 --o bind7 bind7 --as--o v8 v1 --"wdt:P463"--> c8 v1 --"wdt:P37"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end