query-4e680435a43f5074b3f3a447f50d9605

rq turtle/ttl

title: Video games with the most time elapsed between their announcement and their release

(as games can have more than one publication date [because re-releases], we only take the earliest one [using MIN])

SELECT ?years ?interval ?game ?gameLabel ?first_publication_date ?announcement_date WHERE { { SELECT ?game ?gameLabel (MIN(?publication_date) AS ?first_publication_date) ?announcement_date WHERE { ?game (wdt:P31/(wdt:P279*)) wd:Q7889; wdt:P577 ?publication_date; wdt:P6949 ?announcement_date. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?game ?gameLabel ?announcement_date } BIND(?first_publication_date - ?announcement_date AS ?interval) BIND(ROUND(?interval / 365 ) AS ?years) FILTER(?interval > 0 ) } ORDER BY DESC (?interval)

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#>
#title: Video games with the most time elapsed between their announcement and their release
# (as games can have more than one publication date [because re-releases], we only take the earliest one [using MIN])
SELECT ?years ?interval ?game ?gameLabel ?first_publication_date ?announcement_date WHERE {
  {
    SELECT ?game ?gameLabel (MIN(?publication_date) AS ?first_publication_date) ?announcement_date WHERE {
      ?game (wdt:P31/(wdt:P279*)) wd:Q7889;
        wdt:P577 ?publication_date;
        wdt:P6949 ?announcement_date.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?game ?gameLabel ?announcement_date
  }
  BIND(?first_publication_date - ?announcement_date AS ?interval)
  BIND(ROUND(?interval / 365 ) AS ?years)
  FILTER(?interval > 0 )
}
ORDER BY DESC (?interval)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?announcement_date"):::projected v5("?first_publication_date"):::projected v2("?game"):::projected v6("?interval"):::projected v3("?publication_date") v6("?years"):::projected a1((" ")) c8(["bd:serviceParam"]):::iri c4(["wd:Q7889"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?interval > '0^^xsd:integer'"]] f0 --> v6 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c4 v2 --"wdt:P577"--> v3 v2 --"wdt:P6949"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind2[/"min(?publication_date)"/] v3 --o bind2 bind2 --as--o v5 bind3[/"?first_publication_date - ?announcement_date"/] v5 --o bind3 v4 --o bind3 bind3 --as--o v6 bind4[/"numeric-round(?interval / '365^^xsd:integer')"/] v6 --o bind4 bind4 --as--o v6