query-b83a7a893e2b81a9370d78d275a84261

rq turtle/ttl

Ship pennants

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 wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?itemAltLabel ?pennant WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
  {
    SELECT DISTINCT ?item ?pennant WHERE {
      ?item p:P137 ?statement0.
      ?statement0 (ps:P137/(wdt:P279*)) wd:Q11220.
      {
        ?item p:P879 ?statement1.
        ?statement1 (ps:P879) _:anyValueP879.
      }
      ?item p:P31 ?statement2.
     ?statement2 (ps:P31/(wdt:P279*)) wd:Q3114762.
    ?item wdt:P879 ?pennant.
  ?item schema:dateModified ?change .
    FILTER(BOUND(?change) && DATATYPE(?change) = xsd:dateTime).
    # not in the future, and not more than 1 day ago
    BIND(NOW() - ?change AS ?distance).
    FILTER(0 <= ?distance && ?distance < 1).
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?change") v8("?distance") v3("?item"):::projected v7("?pennant"):::projected v4("?statement0") v5("?statement1") v6("?statement2") a2((" ")) a1((" ")) a3((" ")) c4(["en-gb,en,mul"]):::literal c2(["bd:serviceParam"]):::iri c11(["wd:Q11220"]):::iri c16(["wd:Q3114762"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end f0[["'0^^xsd:integer' <= ?distance?distance < '1^^xsd:integer'"]] f0 --> v8 f1[["bound(?change)?change = 'xsd:dateTime'"]] f1 --> v2 v3 --"p:P137"--> v4 v4 --"p:statement/P137"--> a1 a1 --"p:direct/P279"--> c11 v3 --"p:P879"--> v5 v5 --"p:statement/P879"--> a2 v3 --"p:P31"--> v6 v6 --"p:statement/P31"--> a3 a3 --"p:direct/P279"--> c16 v3 --"p:direct/P879"--> v7 v3 --"schema:dateModified"--> v2 bind2[/"NOW() - ?change"/] v2 --o bind2 bind2 --as--o v8