query-6de41ee02614bb44e03e5b39dc84b72b

rq turtle/ttl

?items with P8303 statements of all ranks with novalue or somevalue, and P577 at 2020-08-12 or earlier SELECT ?item ?itemLabel ?release_date ?value { ?item wdt:P577 ?release_date . hint:Prior hint:rangeSafe true . FILTER ( ?release_date <= "+2020-08-12T00:00:00Z"^^xsd:dateTime ) ?item p:P8303 ?statement . { ?statement a wdno:P8303 . BIND ("novalue" as ?value) } UNION { ?statement ps:P8303 ?v . FILTER wikibase:isSomeValue(?v) BIND ("somevalue" as ?value) }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } }

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# ?items with P8303 statements of all ranks with novalue or somevalue, and P577 at 2020-08-12 or earlier
SELECT ?item ?itemLabel ?release_date ?value
{
  ?item wdt:P577 ?release_date .

  FILTER ( ?release_date <= "+2020-08-12T00:00:00Z"^^xsd:dateTime )
  ?item p:P8303 ?statement .
  {
    ?statement a wdno:P8303 .
    BIND ("novalue" as ?value)
  }
  UNION
  {
    ?statement ps:P8303 ?v .
    FILTER wikibase:isSomeValue(?v)
    BIND ("somevalue" as ?value)
  }      
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v1("?release_date"):::projected v3("?statement") v5("?v") v6("?value"):::projected c5(["p:novalue/P8303"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?release_date <= '+2020-08-12T00:00:00Z^^xsd:dateTime'"]] f0 --> v1 v2 --"p:direct/P577"--> v1 v2 --"p:P8303"--> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f1[["http://wikiba.se/ontology#isSomeValue(?v)"]] f1 --> v5 v3 --"p:statement/P8303"--> v5 bind2[/"'somevalue'"/] bind2 --as--o v6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"a"--> c5 bind3[/"'novalue'"/] bind3 --as--o v6 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end