query-1f5ae36ac56ce5c527d9e40d5ddc5b50

rq turtle/ttl

Script #2 SELECT (GROUP_CONCAT(DISTINCT ?dateYear ; separator = ", ") AS ?dateYears) WHERE { # types of item {?game wdt:P136 wd:Q744038} # regular RPGs UNION {?game wdt:P136 wd:Q1529437} # tactical RPGs UNION {?game wdt:P136 wd:Q1422746} # action RPGs UNION {?game wdt:P136 wd:Q1143132} # roguelikes #?game wdt:P136/wdt:P279* wd:Q744038. # any class or subclass of role-playing video game, including MMORPGs ?game wdt:P31 wd:Q7889. # instance of video game

    # release date (simple)
    OPTIONAL {?game wdt:P577 ?date BIND(YEAR(?date) AS ?dateYear)}    # faster substitute
  }
GROUP BY $game
ORDER BY asc (?dateYears)
#limit 100

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
# Script #2
SELECT
      (GROUP_CONCAT(DISTINCT     ?dateYear ; separator = ", ") AS     ?dateYears)
      WHERE {
        # types of item
              {?game wdt:P136 wd:Q744038}   # regular RPGs
        UNION {?game wdt:P136 wd:Q1529437}  # tactical RPGs
        UNION {?game wdt:P136 wd:Q1422746}  # action RPGs
        UNION {?game wdt:P136 wd:Q1143132}  # roguelikes
        #?game wdt:P136/wdt:P279* wd:Q744038.   # any class or subclass of role-playing video game, including MMORPGs
        ?game wdt:P31 wd:Q7889.             # instance of video game

        # release date (simple)
        OPTIONAL {?game wdt:P577 ?date BIND(YEAR(?date) AS ?dateYear)}    # faster substitute
      }
    GROUP BY $game
    ORDER BY asc (?dateYears)
    #limit 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?date") v4("?dateYear"):::projected v5("?dateYears") v2("?game") c4(["wd:Q1422746"]):::iri c3(["wd:Q1529437"]):::iri c2(["wd:Q744038"]):::iri c7(["wd:Q7889"]):::iri c5(["wd:Q1143132"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P136"--> c5 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P136"--> c4 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P136"--> c3 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P136"--> c2 end union0r <== or ==> union0l end v2 --"wdt:P31"--> c7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P577".-> v3 bind0[/"year-from-dateTime(?date)"/] v3 --o bind0 bind0 --as--o v4 end bind2[/"?dateYear"/] v4 --o bind2 bind2 --as--o v5