query-86a7ea134cc286d7bf0f6828487a9e86

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  distinct ?item ?itemLabel ?country_of_citizenship ?country_of_citizenshipLabel
WHERE
{
  ?item wdt:P31 wd:Q5.                   # item is a person
  ?item wdt:P27 ?country_of_citizenship. # has a country of citizenship
  ?item wdt:P569 ?dob.                  # has date of birth

  ?country_of_citizenship wdt:P571 ?inception.                      # the country of citizenship has an inception date
  optional{?country_of_citizenship wdt:P576 ?dissolved.}            # might or might not have a dissolved date

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } # get Labels for items
  FILTER (?dob >?dissolved)                                         # show items only when birth after dissolution
 }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?country_of_citizenship"):::projected v2("?dissolved") v1("?dob") v5("?inception") v3("?item"):::projected c8(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c10(["en"]):::literal f0[["?dob > ?dissolved"]] f0 --> v1 f0 --> v2 v3 --"wdt:P31"--> c2 v3 --"wdt:P27"--> v4 v3 --"wdt:P569"--> v1 v4 --"wdt:P571"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P576".-> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end