query-b24e6d70214d935c5a83a84fc0142e91
title:Query for recent revisions to items select ?item ?itemLabel ?string ?content ?timestamp ?user { ?item wdt:P31 wd:Q146. # find cats SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
BIND(STRAFTER(wikibase:decodeUri(str(?item)), "http://www.wikidata.org/entity/") AS ?string) # need to make the ID something the API can understand
SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Generator"; wikibase:limit "once"; mwapi:generator "allpages"; mwapi:gapfrom ?string; mwapi:gapnamespace 0 ; # main namespace mwapi:gaplimit 1; # only one mwapi:prop "revisions"; mwapi:rvdir "newer"; # FIRST revision mwapi:rvprop "timestamp
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
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#>
#title:Query for recent revisions to items
select ?item ?itemLabel ?string ?content ?timestamp ?user {
?item wdt:P31 wd:Q146. # find cats
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
BIND(STRAFTER(wikibase:decodeUri(str(?item)), "http://www.wikidata.org/entity/") AS ?string)
# need to make the ID something the API can understand
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "www.wikidata.org";
wikibase:api "Generator";
wikibase:limit "once";
mwapi:generator "allpages";
mwapi:gapfrom ?string;
mwapi:gapnamespace 0 ; # main namespace
mwapi:gaplimit 1; # only one
mwapi:prop "revisions";
mwapi:rvdir "newer"; # FIRST revision
mwapi:rvprop "timestamp