User talk:Jean-Frédéric/ExLudo.js
Jump to navigation
Jump to search
Try it!
Series display
[edit]I would like to enrich the display on video game series (Q7058673) items.
Currently, it would display the games part of the series ; on eg Dark Souls (Q99431276):
- Dark Souls (Q1166232) (2011)
- Dark Souls II (Q3702740) (2014)
- Dark Souls III (Q20112508) (2016)
I would like (inspired by what IGDB does) to enrich that with the expansions of each game (the things linked to each item with expansion of (P8646). With the same example that would be:
- Dark Souls (Q1166232) (2011)
- Dark Souls II (Q3702740) (2014)
- Dark Souls III (Q20112508) (2016)
Here would be a query that retrieves the data:
SELECT ?item ?itemLabel (MIN(YEAR(?date)) AS ?year) ?game WHERE {
{
?item wdt:P179 wd:Q99431276.
VALUES ?type {
wd:Q7889
wd:Q16070115
wd:Q4393107
wd:Q65963104
}
?item wdt:P31 ?type.
}
UNION
{
?item wdt:P8646 ?game.
?game wdt:P179 wd:Q99431276.
}
OPTIONAL { ?item wdt:P577 ?date. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?game
ORDER BY (?year)
But I have no clue how I would wrangle that in JavaScript to get what I want :) Jean-Fred (talk) 14:56, 13 January 2023 (UTC)