Skip to content

Instantly share code, notes, and snippets.

@davemackintosh
Last active May 22, 2024 09:44
Show Gist options
  • Save davemackintosh/6a4aa30e5518f6361f35bb59447670b5 to your computer and use it in GitHub Desktop.
Save davemackintosh/6a4aa30e5518f6361f35bb59447670b5 to your computer and use it in GitHub Desktop.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?game ?genres (GROUP_CONCAT(DISTINCT ?image; SEPARATOR=", ") AS ?images) (GROUP_CONCAT(DISTINCT ?video; SEPARATOR=", ") AS ?videos) ?logo ?gameDescription ?steamLink ?official_website ?title ?releaseDate ?description ?publication_date WHERE {
?game wdt:P31 wd:Q7889;
wdt:P400 wd:Q1406;
OPTIONAL { ?game rdfs:label ?title. }
OPTIONAL { ?game wdt:P18 ?image. } # image
OPTIONAL { ?game wdt:P154 ?logo. } # logo
OPTIONAL { ?game wdt:P10 ?video. } # video
OPTIONAL { ?game dbo:releaseDate ?releaseDate. }
OPTIONAL { ?game dbo:abstract ?description. }
OPTIONAL { ?game dbo:platform ?platform. }
OPTIONAL { ?game wdt:P577 ?publication_date. }
OPTIONAL {
?game wdt:P136 ?genre.
?genre rdfs:label ?genre_label.
FILTER((LANG(?genre_label)) = "en")
}
OPTIONAL { ?game wdt:P1733 ?steam. }
BIND(URI(CONCAT("https://store.steampowered.com/app/", ?steam)) AS ?steamLink)
OPTIONAL { ?game wdt:P856 ?official_website. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
FILTER(REGEX(?title, "halo", "i"))
}
GROUP BY ?game ?genres ?logo ?gameDescription ?steamLink ?official_website ?title ?releaseDate ?description ?publication_date
ORDER BY DESC(?publication_date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment