query-8bf3bc9b616632fbbe2c1e4ab28eba08

rq turtle/ttl

TODO

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 ?pays #country
?paysLabel #countryname
(sample(?naturelabel) as ?nature) 
(sample(?capitaleLabel) as ?capital) 
(sample(?PaysPrecedentLabel) as ?PPL) #preceding country
(max(?Fondation) as ?AnneeFondation) #foundation year
(year(?Disparition) as ?AnneeDisparition) #disappearance year
(sample(?PaysRemplacantLabel) as ?PRL) #following country
WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?pays (wdt:P31/wdt:P279*) wd:Q6256 .
  OPTIONAL { ?pays wdt:P17 ?pays. }
  OPTIONAL { ?pays wdt:P31 ?nature. }
  OPTIONAL { ?pays wdt:P36 ?capitale. }
  OPTIONAL { ?pays wdt:P1365 ?PaysPrecedent. }
  OPTIONAL { ?pays wdt:P571 ?Fondation. }
  OPTIONAL { ?pays wdt:P576 ?Disparition. }
  OPTIONAL { ?pays wdt:P1366 ?PaysRemplacant. }
}
group by ?pays ?paysLabel ?PaysPrecedentLabel ?Fondation ?Disparition ?PaysRemplacantLabel
order by ?paysLabel ?Fondation

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v16("?AnneeDisparition") v15("?AnneeFondation") v7("?Disparition"):::projected v2("?Fondation"):::projected v14("?PPL") v17("?PRL") v6("?PaysPrecedent") v11("?PaysPrecedentLabel"):::projected v8("?PaysRemplacant") v12("?PaysRemplacantLabel"):::projected v13("?capital") v5("?capitale") v10("?capitaleLabel"):::projected v13("?nature") v9("?naturelabel"):::projected v3("?pays"):::projected v1("?paysLabel"):::projected a1((" ")) a2((" ")) c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal c7(["wd:Q6256"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; f0[["sameterm(?pays,)"]] f0 --> v3 f0 --> a2 v3 -."wdt:P17".-> a2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P31".-> v13 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P36".-> v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P1365".-> v6 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P571".-> v2 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P576".-> v7 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P1366".-> v8 end bind6[/"sample(?naturelabel)"/] v9 --o bind6 bind6 --as--o v13 bind7[/"sample(?capitaleLabel)"/] v10 --o bind7 bind7 --as--o v13 bind8[/"sample(?PaysPrecedentLabel)"/] v11 --o bind8 bind8 --as--o v14 bind9[/"max(?Fondation)"/] v2 --o bind9 bind9 --as--o v15 bind10[/"year-from-dateTime(?Disparition)"/] v7 --o bind10 bind10 --as--o v16 bind11[/"sample(?PaysRemplacantLabel)"/] v12 --o bind11 bind11 --as--o v17