query-33c8b34e180ebc0f912c4eea5a60ae6b

rq turtle/ttl

A query to get all video games with a valid release date be included. should has valid release dates and therefore (Q193581)Half-Life 2 has a publication date of "1983" and would also be considered invalid. Wikidata represents these dates as 2005-03-00 and 2005-00-00 respectively (although the query service seems to return it as "March 1, 2005" and "January 1, 2005"? idk if that's just some weird formatting it's doing and the raw values are different). If the dates have "00" for either the month or day, it shouldn't included. (Q794150)Aztec Challenge has a publication date of "March 2005", this would be invalid. Similarly, (Q6738128)Major League Baseball 2K5 Hi! I'm hoping I can get a query that will get all video games with a valid release date, where "valid release date" means "a release date with a year, month, and day". For example, Note that games can have more than one release date, and ideally this would filter to games where at least one of their release dates is valid. Though if you only check the first release date for a given game, that's good enough for me. This is what I have right now, it doesn't currently merge the games with multiple release dates into one row, but if it could do that, that'd be great :) I don't really need the release date(s) to be returned in the query response, just the Wikidata ID, so feel free to remove that if you don't want to deal with formatting it to support multiple release dates.

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#>
SELECT ?item ?itemLabel ?releaseDate
{
  ?item wdt:P31 wd:Q7889; # items that are video games
        wdt:P577 ?releaseDate. # items with a publication date.
       # TODO: Need to add something for filtering out invalid release dates
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?releaseDate"):::projected c5(["bd:serviceParam"]):::iri c2(["wd:Q7889"]):::iri c7(["en"]):::literal v1 --"wdt:P31"--> c2 v1 --"wdt:P577"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end