Wikidata:WikiProject Video games/Queries

From Wikidata
Jump to navigation Jump to search
Home

Video game-related SPARQL queries.

Showcase queries[edit]

Series with the most games[edit]

SELECT ?series (SAMPLE(?_label) AS ?label) (COUNT(?game) AS ?count)
WHERE
{
  ?game wdt:P31 wd:Q7889;
          wdt:P179 ?series.
  ?series rdfs:label ?_label.
  FILTER(LANG(?_label) = "en").
}
GROUP BY ?series
ORDER BY DESC(?count)
Try it! (QLever)

Upcoming video games[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?date WHERE {
       ?item wdt:P31 wd:Q7889 .
       ?item wdt:P577 ?date .
       FILTER(?date > NOW()).
       SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Recent video-game-related items with sitelinks and external identifiers[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, formatter URL (P1630)  View with Reasonator View with SQID, Wikidata item of this property (P1629)  View with Reasonator View with SQID
    SELECT ?item ?qid (GROUP_CONCAT( DISTINCT ?sitelink) as ?sitelinks) (GROUP_CONCAT( DISTINCT ?identifier) as ?identifiers) {
      VALUES ?gametype {wd:Q7889 wd:Q16070115 wd:Q7058673} .
      ?item wdt:P31 ?gametype .
      BIND (xsd:integer(STRAFTER(str(?item), "Q")) AS ?qid)
      FILTER (?qid > 51090000) . 
      OPTIONAL { 
        # Get sitelinks
        ?s schema:about ?item ; schema:inLanguage ?lang . 
        BIND(CONCAT("[", str(?s), " ", ?lang, "]") as ?sitelink)
        
        # Get external identifiers
        ?item ?prop ?id.
        ?propItem wikibase:directClaim ?prop.
        ?propItem wikibase:propertyType wikibase:ExternalId.
        ?propItem wdt:P31 wd:Q28147643 .
        ?propItem wdt:P1630 ?formatterurl . 
        ?propItem wdt:P1629 ?website .
        ?propItem rdfs:label ?propItemLabel .
        FILTER (lang(?propItemLabel) = "en"). 
        BIND(IRI(REPLACE(?id, '^(.+)$', ?formatterurl)) AS ?url).
        BIND(CONCAT("[", str(?url), " ", ?propItemLabel, "]") as ?identifier)
      } 
    } GROUP BY ?item ?qid ORDER BY DESC(?qid) LIMIT 50
    

Films based on video games[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, based on (P144)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?videogame ?videogameLabel WHERE {
      ?item wdt:P31 wd:Q11424.
      ?item wdt:P144 ?videogame.
      ?videogame (wdt:P31/wdt:P279*) wd:Q7889.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

All video games developed or published by a given company[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, developer (P178)  View with Reasonator View with SQID, publisher (P123)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID
    #TEMPLATE={"template":"Games developed and published by ?studio","variables":{"?studio":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q210167 . }"} } }
    SELECT DISTINCT ?item ?itemLabel ?developer ?developerLabel ?publisher ?publisherLabel ?year WHERE {
      BIND(wd:Q55587315 AS ?studio)
      { ?item wdt:P178 ?studio. }
      UNION
      { ?item wdt:P123 ?studio. }
      OPTIONAL { ?item wdt:P178 ?developer. }
      OPTIONAL { ?item wdt:P123 ?publisher. }
      OPTIONAL {
        ?item wdt:P577 ?date.
        BIND(YEAR(?date) AS ?year)
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    } ORDER BY ?year
    

Characters[edit]

Video game characters named after humans[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, named after (P138)  View with Reasonator View with SQID
    SELECT DISTINCT ?item ?itemLabel ?named ?namedLabel
    WHERE 
    {
      ?item wdt:P31/wdt:P279* wd:Q1569167.
      ?item wdt:P138 ?named. 
      ?named wdt:P31 wd:Q5.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

source

Characters from the Mario franchise by games in which they appear[edit]

The following query uses these:

Features: Graph (Q24515287)  View with Reasonator View with SQID

#defaultView:Graph
SELECT ?item ?itemLabel ?game ?gameLabel ("00FFFF" AS ?rgb) WHERE {
  ?item wdt:P31 wd:Q33093124.
  ?game wdt:P674 ?item;
    wdt:P31 wd:Q7889.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

source

Games with the most player characters[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, characters (P674)  View with Reasonator View with SQID, object has role (P3831)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel (COUNT(?character) AS ?playable_characters) WHERE {
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
      ?item (wdt:P31/(wdt:P279*)) wd:Q7889;
        p:P674 ?statement.
      ?statement ps:P674 ?character;
        pq:P3831 wd:Q1062345.
    }
    GROUP BY ?item ?itemLabel
    ORDER BY DESC (?playable_characters)
    

Games with female protagonists[edit]

The following query uses these:

Games with female player characters[edit]

The following query uses these:

Games with female characters[edit]

The following query uses these:

Games with LGBT characters[edit]

The following query uses these:

Games with LGBT protagonists[edit]

The following query uses these:

Games with LGBT player characters[edit]

The following query uses these:

Graph of video games genres[edit]

Graph of video game genre (Q659563) and outline the ones that are linked to OLAC video game genre vocabulary ID (P6352)

The following query uses these:

Features: Graph (Q24515287)  View with Reasonator View with SQID

#defaultView:Graph
SELECT DISTINCT ?genre ?genreLabel ?rgb ?OLAC ?_subclass_of ?_subclass_ofLabel WHERE {
  ?genre wdt:P31 wd:Q659563.
  OPTIONAL {
    ?genre wdt:P279 ?_subclass_of.
    { ?_subclass_of wdt:P31 wd:Q659563. } UNION {?_subclass_of wdt:P279 wd:Q2249149.}
  }

  OPTIONAL { ?genre wdt:P6352 ?OLAC. }
  BIND(IF(BOUND(?OLAC), "FFA500", "7FFF00") AS ?rgb)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}


Video games whose composer is Japanese, not born in Tokyo, and less than 25 at the time[edit]

The following query uses these:

Timeline of games per platform[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, platform (P400)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID
    #title:Timeline of games per platform
    #defaultView:AreaChart
    SELECT (SAMPLE(?year) AS ?year) (COUNT(?_platform) AS ?count) (SAMPLE(?_platformLabel) AS ?platformLabel)  WHERE {
      ?video_game wdt:P31 wd:Q7889.
      ?video_game wdt:P400 ?_platform.
      ?video_game wdt:P577 ?date.
      BIND ( STR(year(?date)) as ?year )
      FILTER(BOUND(?year))
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
                              ?_platform rdfs:label ?_platformLabel.}
    }
    GROUP BY ?year ?_platform
    HAVING (?count > 10)
    

Video games and their trailers[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, YouTube video ID (P1651)  View with Reasonator View with SQID, video (P10)  View with Reasonator View with SQID, object has role (P3831)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel (GROUP_CONCAT(DISTINCT ?value; SEPARATOR = " ") AS ?trailer) WHERE {
      {
        ?item p:P1651 ?statement.
        ?statement ps:P1651 ?v;
          pq:P3831 wd:Q65972034.
        BIND(CONCAT("https://www.youtube.com/watch?v=", ?v) AS ?value)
      }
      UNION
      {
        ?item p:P10 ?statement.
        ?statement ps:P10 ?v;
          pq:P3831 wd:Q65972034.
        BIND(CONCAT("[", STR(?v), " C]") AS ?value)
      }
      ?item (wdt:P31/(wdt:P279*)) wd:Q7889.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    }
    GROUP BY ?item ?itemLabel
    ORDER BY DESC (xsd:integer(STRAFTER(STR(?item), "Q")))
    


Reviews[edit]

Video games with a 10/10 in Edge Magazine[edit]

The following query uses these:

  • Properties: review score (P444)  View with Reasonator View with SQID, review score by (P447)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel WHERE {
      ?item p:P444 ?review_scoreStatement.
      ?review_scoreStatement pq:P447 wd:Q793975;
        ps:P444 "10/10".
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    LIMIT 100
    

Video games with an OpenCritic “Critics recommend” rating[edit]

The following query uses these:

  • Properties: review score (P444)  View with Reasonator View with SQID, review score by (P447)  View with Reasonator View with SQID, determination method (P459)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?score WHERE {
      ?item p:P444 ?review_scoreStatement.
      ?review_scoreStatement pq:P447 wd:Q21039459;
        pq:P459 wd:Q119576498;
        ps:P444 ?score.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    } ORDER BY DESC(?score)
    

Most-cited reviewers[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, review score (P444)  View with Reasonator View with SQID, review score by (P447)  View with Reasonator View with SQID
    SELECT ?reviewer ?reviewerLabel (COUNT(?item) AS ?items) WHERE {
      ?item wdt:P31/wdt:P279* wd:Q7889;
            p:P444/pq:P447 ?reviewer.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?reviewer ?reviewerLabel
    ORDER BY DESC (?items)
    

Video game series with the longest time time gap between a game and its direct sequel[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, followed by (P156)  View with Reasonator View with SQID, part of the series (P179)  View with Reasonator View with SQID
    # Video game series with the longest time time gap between a game and its direct sequel
    # (as games can have more than one publication date [because re-releases], we only take the earliest one [using MIN])
    SELECT ?series ?seriesLabel ?years ?interval ?game ?gameLabel ?original_date_game ?sequel ?sequelLabel ?original_date_sequel 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; # All video games...
            wdt:P577 ?game_date.                # with their publication date(s)...
          {
            ?game p:P179 ?series_statement.     # (Unpacking the series statement)
            ?series_statement ps:P179 ?series;  #   ...in a series...
              pq:P156 ?sequel.                  #   ...with a sequel...
          } UNION {                             # ...or...
            ?game wdt:P156 ?sequel.             #   ...with a sequel...
            OPTIONAL {
              ?game wdt:P179 ?series            # ...maybe with a series
            }
          }
          ?sequel wdt:P577 ?sequel_date.        # with its own publication date(s)
          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)  # Calculating the time gap between the original releases, in days...
      BIND(ROUND(?interval / 365 ) AS ?years)                         # ...and converting to years, for convenience...
      FILTER(?interval > 0 )                                          # Only keeping sequels published after (filtering out some bad data)
    }
    ORDER BY DESC (?interval)                                         # Longest time gaps first
    

Video games with the most expansions[edit]

The following query uses these:

  • Properties: expansion of (P8646)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT ?game ?gameLabel (COUNT(?item) AS ?count) WHERE {
      ?item wdt:P8646 ?game.
      ?game (wdt:P31/(wdt:P279*)) wd:Q7889.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?game ?gameLabel
    ORDER BY DESC (?count)
    

Video games with the most time elapsed between their announcement and their release[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, announcement date (P6949)  View with Reasonator View with SQID
    #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)
    

Events by number of video games announced[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, announcement date (P6949)  View with Reasonator View with SQID, announced at (P9731)  View with Reasonator View with SQID
    SELECT ?event ?eventLabel (COUNT(?video_game) as ?count) WHERE {
      ?video_game wdt:P31 wd:Q7889;
                  p:P6949 / pq:P9731 ?event.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?event ?eventLabel
    ORDER BY DESC(?count)
    

Awards[edit]

Video games with the most nominations at the given award ceremony[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, facet of (P1269)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, developer (P178)  View with Reasonator View with SQID, nominated for (P1411)  View with Reasonator View with SQID, statement is subject of (P805)  View with Reasonator View with SQID
    #TEMPLATE={ "template":"Video games with the most nominations at the ?ceremony award ceremony","variables":{"?ceremony":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q4504495; wdt:P1269 ?award. ?award wdt:P279 wd:Q18328126. }"} } }
    SELECT ?item ?itemLabel ?developer (GROUP_CONCAT(?awardLabel; SEPARATOR = ", ") AS ?awards) (COUNT(?award) AS ?nominations) WHERE {
      BIND(wd:Q106016685 AS ?ceremony)
      ?item p:P1411 ?statement.
      ?statement ps:P1411 ?award;
        pq:P805 ?ceremony.
      OPTIONAL { ?item wdt:P178 ?developer. }
      SERVICE wikibase:label {
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
        ?award rdfs:label ?awardLabel.
        ?item rdfs:label ?itemLabel.
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?item ?itemLabel ?developer
    ORDER BY DESC (?nominations)
    

Video games with the most wins at the given award ceremony[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, facet of (P1269)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, developer (P178)  View with Reasonator View with SQID, award received (P166)  View with Reasonator View with SQID, statement is subject of (P805)  View with Reasonator View with SQID
    #TEMPLATE={ "template":"Video games with the most nominations at the ?ceremony award ceremony","variables":{"?ceremony":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q4504495; wdt:P1269 ?award. ?award wdt:P279 wd:Q18328126. }"} } }
    SELECT ?item ?itemLabel ?developer (GROUP_CONCAT(?awardLabel; SEPARATOR = ", ") AS ?awards) (COUNT(?award) AS ?award_received) WHERE {
      BIND(wd:Q102300180 AS ?ceremony)
      ?item p:P166 ?statement.
      ?statement ps:P166 ?award;
        pq:P805 ?ceremony.
      OPTIONAL { ?item wdt:P178 ?developer. }
      SERVICE wikibase:label {
        bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
        ?award rdfs:label ?awardLabel.
        ?item rdfs:label ?itemLabel.
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?item ?itemLabel ?developer
    ORDER BY DESC (?award_received)
    

Crowdfunding[edit]

Money, per currency, raised by video games through Kickstarter (crowdfunding)[edit]

(will be refined later on --Poslovitch (talk) 22:15, 6 August 2021 (UTC))[reply]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, Kickstarter project ID (P8019)  View with Reasonator View with SQID, total revenue (P2139)  View with Reasonator View with SQID
    #title:Money, per currency, raised by video games through Kickstarter (crowdfunding)
    #defaultView:BarChart
    SELECT ?currencyLabel (SUM(?money) AS ?totalMoney) (COUNT(?game) AS ?games) WHERE {
      ?game wdt:P31 wd:Q7889;
            p:P8019 ?statement. # Get the Kickstarter statement
      ?statement pq:P2139 ?money. # Get the amount of money
      
      ?statement pqv:P2139 ?pqv.
      ?pqv wikibase:quantityUnit ?currency. # Get the currency
      
      # FILTER (?currency != wd:Q39099) # Uncomment this to filter out the renminbi
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?currencyLabel
    

Units sold per crowdfunded games[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, units sold (P2664)  View with Reasonator View with SQID, Kickstarter project ID (P8019)  View with Reasonator View with SQID, Indiegogo project ID (P7953)  View with Reasonator View with SQID, total revenue (P2139)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel (MAX(?units) AS ?unitsSold) ?money ?currencyLabel WHERE {
      ?item wdt:P31 wd:Q7889. 
      ?item wdt:P2664 ?units.
      
      { ?item p:P8019 ?statement. } UNION { ?item p:P7953 ?statement. } # Kickstarter and Indiegogo
      
      ?statement pq:P2139 ?money .
        OPTIONAL { ?statement pqv:P2139 ?pqv .
                   ?pqv wikibase:quantityUnit ?currency }. 
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?item ?itemLabel ?money ?currencyLabel
    

Video games with their sequels, predecessors and so on[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, part of the series (P179)  View with Reasonator View with SQID, follows (P155)  View with Reasonator View with SQID, followed by (P156)  View with Reasonator View with SQID
    SELECT DISTINCT ?item ?itemLabel ?follows ?followsLabel ?followed_by ?followed_byLabel ?statement WHERE {
      ?item wdt:P31/wdt:P279* wd:Q7889.
      ?item p:P179 ?statement.
      OPTIONAL { ?statement pq:P155 ?follows. FILTER (!wikibase:isSomeValue(?follows)) }
      OPTIONAL { ?statement pq:P156 ?followed_by. FILTER (!wikibase:isSomeValue(?followed_by)) }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY (UCASE(STR(?itemLabel)))
    

Information on a video game series[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, genre (P136)  View with Reasonator View with SQID, part of the series (P179)  View with Reasonator View with SQID, platform (P400)  View with Reasonator View with SQID, developer (P178)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, follows (P155)  View with Reasonator View with SQID, followed by (P156)  View with Reasonator View with SQID
    #TEMPLATE={"template":"Information about the ?series video games series","variables":{"?series":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q7058673. }"} } }
    SELECT ?series ?seriesLabel ?first_gameLabel ?first_game_date ?latest_gameLabel 
      (GROUP_CONCAT(DISTINCT ?genreLabel; SEPARATOR = ", ") AS ?genres)
      (GROUP_CONCAT(DISTINCT ?platformLabel; SEPARATOR = ", ") AS ?platforms) (GROUP_CONCAT(DISTINCT ?developerLabel; SEPARATOR = ", ") AS ?developers)
    WHERE {
      BIND(wd:Q289129 AS ?series)
      OPTIONAL {
        ?series wdt:P136 ?genre.
        ?genre rdfs:label ?genreLabel.
        FILTER((LANG(?genreLabel)) = "en")
      }
      ?games wdt:P179 ?series;
        wdt:P400 ?platform;
        wdt:P178 ?developer.
      OPTIONAL {
        ?first_game p:P179 ?seriesStatement.
        ?seriesStatement ps:P179 ?series;
          rdf:type wdno:P155.
        ?first_game wdt:P577 ?first_game_date
      }
      OPTIONAL {
        ?latest_game p:P179 ?seriesStatement2.
        ?seriesStatement2 ps:P179 ?series;
          rdf:type wdno:P156.
        ?latest_game wdt:P577 ?latest_game_date
      }
      ?platform rdfs:label ?platformLabel.
      FILTER((LANG(?platformLabel)) = "en")
      ?developer rdfs:label ?developerLabel.
      FILTER((LANG(?developerLabel)) = "en")
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?series ?seriesLabel ?first_gameLabel ?first_game_date ?latest_gameLabel
    

Graph of relationships between video game databases[edit]

The following query uses these:

Features: Graph (Q24515287)  View with Reasonator View with SQID

#title: Graph of relationships between video game databases 
#defaultView:Graph
SELECT DISTINCT ?item ?itemLabel ?rgb ?link ?linkLabel ?rgb2 WHERE {
  {
    ?item wdt:P31/wdt:P279* wd:Q55341040; # ?item is a video games database
      wdt:P10568 ?link.                    # which is linked to ?link
  }
  UNION
  {
    ?item ^wdt:P10568 ?vgd.                 # item is linked to from ?vgd
    ?vgd wdt:P31/wdt:P279* wd:Q55341040.    # ?vgd is a video games database
    OPTIONAL {
               ?item wdt:P10568 ?link.      # item might be linked to ?link
             }
  }
  UNION
  {
    ?item99 ^wdt:P10568 ?vgd.                 # item99 is linked to from ?vgd
    ?vgd wdt:P31/wdt:P279* wd:Q55341040.    # ?vgd is a video games database
    ?item99 wdt:P10568 ?item.      # item99 is linked to ?item
  }
  OPTIONAL {
    ?item wdt:P1687 ?property.
  }
  BIND(IF(BOUND(?property),"FFA500","") AS ?rgb)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}

Maintenance queries[edit]

Video games with few statements and identifiers[edit]

See report at Wikidata:WikiProject Video games/Maintenance/Few statements

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID
    #adapted from query by User:Matěj Suchánek
    SELECT ?item ?st ?sl ?ids (str(?i) as ?offset)
    WITH { SELECT DISTINCT ?item        WHERE { ?item wdt:P31 wd:Q7889 ; wikibase:statements ?st . FILTER(?st < 2) }  } AS %all
    WITH { SELECT (COUNT(*) AS ?count)  WHERE { INCLUDE %all }  } AS %count
    WITH { SELECT (?item AS ?item2)     WHERE { INCLUDE %all }  } AS %all2
    WITH
    {
      SELECT ?item (SUM(?x) AS ?i)  WHERE  { INCLUDE %all . INCLUDE %all2 .
        BIND( IF( STR( ?item ) > STR( ?item2 ), 1, 0 ) AS ?x ) .
      } GROUP BY ?item
    } AS %main 
    WHERE
    {
      hint:Query hint:optimizer "None".
      INCLUDE %count .
      BIND(ROUND( ?count / 20) as ?slice ) BIND( ROUND(FLOOR( RAND() * ?count / 20 )) AS ?rnd) 
      INCLUDE %main .
      FILTER( ROUND( ( ?i/ ?slice - FLOOR( ?i / ?slice ) ) * ?slice ) = ?rnd)
      ?item wikibase:statements ?st; wikibase:sitelinks ?sl; wikibase:identifiers ?ids.
    }
    

Games published after their sequels[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, publication date (P577)  View with Reasonator View with SQID, part of the series (P179)  View with Reasonator View with SQID, followed by (P156)  View with Reasonator View with SQID
    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 )
    }
    

DLCs not linked to the main game[edit]

The following query uses these:

  • Properties: expansion of (P8646)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, of (P642)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?game ?gameLabel WHERE {
      ?item p:P31 ?p31.
      ?p31 ps:P31 wd:Q1066707.
      OPTIONAL { ?p31 pq:P642 ?game. }
      FILTER(NOT EXISTS { ?item wdt:P8646 _:b6. })
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Video games whose developer is headquartered in a given country but with a different country of origin[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, developer (P178)  View with Reasonator View with SQID, country (P17)  View with Reasonator View with SQID, headquarters location (P159)  View with Reasonator View with SQID, country of origin (P495)  View with Reasonator View with SQID
    #TEMPLATE={"template":"Video games whose developer is headquartered in ?country but with a different country of origin","variables":{"?country":{"query":" SELECT ?id WHERE { ?id wdt:P31 wd:Q6256 . }"} } }
    SELECT DISTINCT ?item ?itemLabel ?dev ?devLabel ?hq ?hqLabel ?country_originLabel WHERE {
      BIND(wd:Q142 AS ?country)
      ?item (wdt:P31/(wdt:P279*)) wd:Q7889;
        wdt:P178 ?dev.
      ?dev wdt:P17 ?country.
      OPTIONAL { ?dev wdt:P159 ?hq. }
      FILTER(NOT EXISTS { ?item wdt:P495 ?country. })
      OPTIONAL {
        ?item wdt:P495 ?country_origin
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    


Video game released on both a handheld and home platform of the same console generation[edit]

(In many cases, an handheld platform would not be powerful enough to run a game from a home platform − hinting these might be two different games that need to be split up).

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, platform (P400)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT DISTINCT ?item ?itemLabel ?handheld_platform ?handheld_platformLabel ?home_platform ?home_platformLabel ?generationLabel WHERE {
      ?item wdt:P31 wd:Q7889; 
        wdt:P400 ?home_platform, ?handheld_platform.
      ?home_platform wdt:P361 ?generation;
        (wdt:P279*) wd:Q17589470.
      ?handheld_platform wdt:P361 ?generation;
        (wdt:P279*) wd:Q941818.
      ?generation wdt:P31 wd:Q61697632.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Video Games with series that are not "video game series"[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, part of the series (P179)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel ?series ?seriesLabel (GROUP_CONCAT(DISTINCT ?type; SEPARATOR = ", ") AS ?types) WHERE {
      ?item (wdt:P31/(wdt:P279*)) wd:Q7889;
        wdt:P179 ?series.
      OPTIONAL {
        ?series wdt:P31 ?_type.
        ?_type rdfs:label ?type.
        FILTER((LANG(?type)) = "en")
      }
      FILTER(NOT EXISTS { ?series wdt:P31/wdt:P279* wd:Q7058673. })
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    GROUP BY ?item ?itemLabel ?series ?seriesLabel
    

Video games with a subclass of video game genre (Q659563) as instance of (P31)[edit]

In most cases, this indicates video games where the instance of (P31) statement should (not must) be moved to genre (P136).

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    SELECT DISTINCT ?item ?itemLabel ?nature ?natureLabel WHERE {
      ?item wdt:P31/wdt:P279* wd:Q7889;
            wdt:P31 ?nature.
      ?nature wdt:P31/wdt:P279* wd:Q659563.
        SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    ORDER BY ?nature
    

Video games without gameplay-related genres[edit]

Since genres like indie game (Q2762504) themselves don't describe the gameplay, video game items should also have additional genres set, like adventure game (Q23916) or puzzle video game (Q54767).

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID, genre (P136)  View with Reasonator View with SQID
    SELECT ?item ?itemLabel {
      ?item wdt:P31/wdt:P279* wd:Q7889 .
      ?item wdt:P136 [] .
      FILTER NOT EXISTS {
        ?item wdt:P136 ?xxx .
        FILTER( ?xxx NOT IN (
            wd:Q2762504,
            wd:Q21192427,
            wd:Q85341917,
            wd:Q85422949,
            wd:Q107542272
        ) ) .
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    

Most used properties on video game items[edit]

SELECT ?propertyItem ?propertyItemLabel ?propertyType (count(distinct ?item) as ?total) WHERE {
  ?item wdt:P31 wd:Q7889;
        ?propertyRel ?v.
  ?propertyItem wikibase:directClaim ?propertyRel.
  ?propertyItem rdfs:label ?propertyItemLabel
  FILTER (lang(?propertyItemLabel) = "en").
  ?propertyItem wikibase:propertyType ?propertyType.
}
group by ?propertyItem ?propertyItemLabel ?propertyType
order by desc(?total)
Try it! (QLever)