query-d317001e1a5adef62df4834671625d0e

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)publication date (P577)part of the series (P179)followed by (P156)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 ?game ?gameLabel ?original_date_game ?sequel ?sequelLabel ?original_date_sequel ?interval ?series ?seriesLabel WHERE {
  {
    SELECT ?game ?gameLabel (MIN(?game_date) AS ?original_date_game) ?sequel ?sequelLabel (MIN(?sequel_date) AS ?original_date_sequel) ?series ?seriesLabel WHERE {
      ?game wdt:P31/wdt:P279* wd:Q7889;
        wdt:P577 ?game_date;
        p:P179 ?series_statement.
      ?series_statement pq:P156 ?sequel;
        ps:P179 ?series.
      ?sequel wdt:P577 ?sequel_date.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?game ?gameLabel ?sequel ?sequelLabel ?series ?seriesLabel
  }
  BIND(?original_date_sequel - ?original_date_game AS ?interval)
  FILTER ( ?interval < 0 )
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?game"):::projected v3("?game_date") v10("?interval"):::projected v8("?original_date_game"):::projected v9("?original_date_sequel"):::projected v5("?sequel"):::projected v7("?sequel_date") v6("?series"):::projected v4("?series_statement") a1((" ")) c10(["bd:serviceParam"]):::iri c4(["wd:Q7889"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?interval < '0^^xsd:integer'"]] f0 --> v10 v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c4 v2 --"p:direct/P577"--> v3 v2 --"p:P179"--> v4 v4 --"p:qualifier/P156"--> v5 v4 --"p:statement/P179"--> v6 v5 --"p:direct/P577"--> v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind3[/"min(?game_date)"/] v3 --o bind3 bind3 --as--o v8 bind4[/"min(?sequel_date)"/] v7 --o bind4 bind4 --as--o v9 bind5[/"?original_date_sequel - ?original_date_game"/] v9 --o bind5 v8 --o bind5 bind5 --as--o v10