query-2a69c327a56056413f45304205aa732b

rq turtle/ttl

14:46, 11 January 2022 (UTC)) talk (Popperipopp20:04, 11 January 2022 (UTC)) talk (Infovarius (and they have different subclasses and instances)... --(Q7275)state !=(Q6256)country And note that 16:52, 11 January 2022 (UTC) JuraYes, thanks. I wonder if one should try to look at it by year and list those that end or start. ---

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?y ?exit ?new
WHERE
{

{
  SELECT DISTINCT ?y WHERE
  {
    ?item wdt:P31/wdt:P279? wd:Q3186692 ; wdt:P585 ?d . 
    BIND(YEAR( ?d) as ?y) FILTER( ?y > 1900 && ?y < 2023 )
  }
}  OPTIONAL { 
{
  SELECT DISTINCT ?y (GROUP_CONCAT(DISTINCT ?item2Label; separator="; ") as ?exit)
  {                     
    ?item2 p:P31 ?st ; wdt:P30 wd:Q46 .
    ?st ps:P31/wdt:P279* wd:Q6256 .
    ?item2 wdt:P576 ?d0 .   BIND(YEAR( ?d0) as ?y) FILTER( ?y > 1900 && ?y < 2023 )
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". ?item2 rdfs:label ?item2Label }
  }
  GROUP BY ?y
}}
  OPTIONAL { 
{
  SELECT DISTINCT ?y (GROUP_CONCAT(DISTINCT ?item0Label; separator="; ") as ?new)
  {                     
    ?item0 p:P31 ?st ; wdt:P30 wd:Q46 .
    ?st ps:P31/wdt:P279* wd:Q6256 .
    ?item0 wdt:P571 ?d0 .   BIND(YEAR( ?d0) as ?y) FILTER( ?y > 1900 && ?y < 2023 )
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". ?item0 rdfs:label ?item0Label }
  }
  GROUP BY ?y
}}
}
ORDER BY ?y

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?d") v6("?d0") v8("?exit"):::projected v2("?item") v9("?item0") v10("?item0Label") v4("?item2") v7("?item2Label") v11("?new"):::projected v5("?st") v10("?y"):::projected a1((" ")) a2((" ")) a3((" ")) c16(["en"]):::literal c9(["wd:Q46"]):::iri c14(["bd:serviceParam"]):::iri c4(["wd:Q3186692"]):::iri c11(["wd:Q6256"]):::iri f0[["?y > '1900^^xsd:integer'?y < '2023^^xsd:integer'"]] f0 --> v10 v2 --"p:direct/P31"--> a1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; a1 --"p:direct/P279"--> c4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end v2 --"p:direct/P585"--> v3 bind1[/"year-from-dateTime(?d)"/] v3 --o bind1 bind1 --as--o v10 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; f2[["?y > '1900^^xsd:integer'?y < '2023^^xsd:integer'"]] f2 --> v10 v4 -."p:P31".-> v5 v4 --"p:direct/P30"--> c9 v5 --"p:statement/P31"--> a2 a2 --"p:direct/P279"--> c11 v4 --"p:direct/P576"--> v6 bind3[/"year-from-dateTime(?d0)"/] v6 --o bind3 bind3 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 v4 --"rdfs:label"--> v7 end bind5[/"?item2Label"/] v7 --o bind5 bind5 --as--o v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; f6[["?y > '1900^^xsd:integer'?y < '2023^^xsd:integer'"]] f6 --> v10 v9 -."p:P31".-> v5 v9 --"p:direct/P30"--> c9 v5 --"p:statement/P31"--> a3 a3 --"p:direct/P279"--> c11 v9 --"p:direct/P571"--> v6 bind7[/"year-from-dateTime(?d0)"/] v6 --o bind7 bind7 --as--o v10 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 v9 --"rdfs:label"--> v10 end bind9[/"?item0Label"/] v10 --o bind9 bind9 --as--o v11 end