query-be634978561e2bd85054177be58bc7d5

rq turtle/ttl

TODO

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel WHERE {
  {
    SELECT ?item {
      BIND("2010-05-00T00:00:00Z"^^xsd:dateTime AS ?pointintime) .
      ?item p:P39 ?positionstatement .
      ?positionstatement ps:P39 wd:Q18887908 .
      ?positionstatement pq:P580 ?startdate .
      MINUS { ?positionstatement pq:P582 ?enddate } . 
      FILTER( ?startdate < ?pointintime ) .
    }
  } UNION {
    SELECT ?item WHERE {
      BIND("2010-05-00T00:00:00Z"^^xsd:dateTime AS ?pointintime) .
      ?item p:P39 ?positionstatement .
      ?positionstatement ps:P39 wd:Q18887908 .
      ?positionstatement pq:P580 ?startdate .
      ?positionstatement pq:P582 ?enddate . 
      FILTER( ?startdate < ?pointintime && ?pointintime < ?enddate ) .
    }
  } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
} ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?enddate") v4("?item"):::projected v1("?itemLabel"):::projected v7("?pointintime") v5("?positionstatement") v2("?startdate") c7(["bd:serviceParam"]):::iri c9(["en"]):::literal c3(["wd:Q18887908"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["?startdate < ?pointintime?pointintime < ?enddate"]] f0 --> v2 f0 --> v7 f0 --> v6 bind1[/"'2010-05-00T00:00:00Z^^xsd:dateTime'"/] bind1 --as--o v7 v4 --"p:P39"--> v5 v5 --"p:statement/P39"--> c3 v5 --"p:qualifier/P580"--> v2 v5 --"p:qualifier/P582"--> v6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f2[["?startdate < ?pointintime"]] f2 --> v2 f2 --> v7 bind3[/"'2010-05-00T00:00:00Z^^xsd:dateTime'"/] bind3 --as--o v7 v4 --"p:P39"--> v5 v5 --"p:statement/P39"--> c3 v5 --"p:qualifier/P580"--> v2 subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v5 --"p:qualifier/P582"--> v6 end end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end