user5721551
user5721551

Reputation:

How to access wikidata revision history?

Is there a way to access wikidata revision history page using SPARQL or wikimedia-API for the Item Eden Hazard (Q214204) as an example, to get the latest and oldest timestamps values?

Upvotes: 0

Views: 741

Answers (2)

Lokal_Profil
Lokal_Profil

Reputation: 394

Answers above have described how to get the timestamps of older versions of a Wikidata object. To get the contents of an older version of the wikidata-object you can use the MediaWiki Revisions API.

The following query gives you the contents of two named revisions of Q42175289

https://www.wikidata.org/w/api.php?action=query&format=json&formatversion=2&prop=revisions&revids=580231008|580231017&rvprop=timestamp|comment|content&rvslots=main

whereas the following gives you the first 3 revisions of the same item (with contents)

https://www.wikidata.org/w/api.php?action=query&format=json&prop=revisions&titles=Q42175289&formatversion=2&rvprop=ids%7Ccomment%7Ccontent%7Ccontentmodel&rvslots=main&rvlimit=3&rvdir=newer

Upvotes: 0

Karl Amort
Karl Amort

Reputation: 16394

There’s a fun way to access mediawiki data that happens to be excellent for such metadata: https://quarry.wmflabs.org

Set the database to wikidatawiki_p. Here‘s the SQL:

SELECT MAX(rev_timestamp), MIN(rev_timestamp) 
FROM page JOIN revision 
ON page.page_id = revision.rev_page 
WHERE page_title = "Q214204";

I’ve published the query here: https://quarry.wmflabs.org/query/57342

Upvotes: 0

Related Questions