query-c85c69a9b35fb9a6eca090069bf61359
title: Get revision ID for last revision of some items SELECT ?item ?revid WHERE { VALUES ?item_strings { "Q2" "Q5" } SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org" . bd:serviceParam wikibase:api "Generator" . bd:serviceParam mwapi:generator "revisions" . bd:serviceParam mwapi:prop "revisions" . bd:serviceParam mwapi:titles ?item_strings . ?item wikibase:apiOutputItem mwapi:title . ?revid wikibase:apiOutput "revisions/rev/@revid" . } }
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Get revision ID for last revision of some items
SELECT ?item ?revid
WHERE
{
VALUES ?item_strings { "Q2" "Q5" }
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam mwapi:generator "revisions" .
bd:serviceParam mwapi:prop "revisions" .
bd:serviceParam mwapi:titles ?item_strings .
?item wikibase:apiOutputItem mwapi:title .
?revid wikibase:apiOutput "revisions/rev/@revid" .
}
}
Query found at
- https://www.wikidata.org/wiki/User:Stefan_K%C3%BChn/SPARQL
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2022/04
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v1("?item_strings")
v3("?revid"):::projected
c4(["www.wikidata.org"]):::literal
c14(["revisions/rev/@revid"]):::literal
c2(["bd:serviceParam"]):::iri
c8(["revisions"]):::literal
c12(["mwapi:title"]):::iri
c6(["Generator"]):::literal
bind0[/VALUES ?item_strings/]
bind0-->v1
bind00(["Q2"])
bind00 --> bind0
bind01(["Q5"])
bind01 --> bind0
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:endpoint"--> c4
c2 --"mwapi:api"--> c6
c2 --"mwapi:generator"--> c8
c2 --"mwapi:prop"--> c8
c2 --"mwapi:titles"--> v1
v2 --"mwapi:apiOutputItem"--> c12
v3 --"mwapi:apiOutput"--> c14
end