Hello esteemed friends, Is it possible to use the API to ascertain last-updated for a particular statement/property/claim (or an etag, lastrevid)? Or is this information only available at the item/entity level? Thanks! Michael Lindsey UC Berkeley School of Law
Hi Michael,
In short, I think data values (but not entities used as values) have direct hashes potentially usable as ETags to identify changes/identical values (even between entities, as long as all details are the same), while statements have seemingly persistent IDs (even if their values change) and only entire entity revisions have revision dates.
For actual programmatic use you probably want to use e.g. /w/api.php?action=wbgetentities&props=claims&id=Q5 or /w/api.php?action=wbgetclaims&id=Q5 which will retrieve the above information. If you want old revisions you may need Special:EntityData.
I am not sure if you consider it part of the API per-se, but the JSON linked as <link rel="alternate" href="[...]" type="application/json"> in the header of the entity pages from Q5.json identifies hashes of data values and IDs of entire statements, the former switching on changes to the value and then going back to the original on rollback - these hashes therefore may potentially act as an ETag.
Similarly the TTL files linked as <link rel="alternate" href="[...]" type="text/turtle"> in the header of the entity pages that are like Special:EntityData/Q5.ttl contain values identified by v:xxxxx where xxxxx appears to be a hash.
Other formats are available per https://www.mediawiki.org/wiki/Wikibase/EntityData#Usage
Looking at the HTML source of old revision pages, the links to entity data do not change - I think this is a bug, because they could have e.g. Special:EntityData/Q5.ttl?revision=1234 to output the data displayed when accessing oldid=1234. (This revision ID is schema:version of the schema:Dataset in the TTL, which is the only thing to which a revision date is attached. It is not clear to me if this data is accessible via api.php.)
The revision page HTML also contains encoded CSS classes for snaks (wikibase-snakview-xxxx) and statements (wikibase-statement-xxxxx).
Hopefully someone can correct me if I got anything wrong; it's late this side of the pond. :-)
Best regards, -- Laurence 'GreenReaper' Parry https://furry.wikibase.cloud ________________________________ From: Michael Colin Lindsey mlindsey@berkeley.edu Sent: Thursday, June 15, 2023 11:30:50 pm To: Wikibase Community User Group wikibaseug@lists.wikimedia.org Subject: [Wikibase] statement/claim versioning?
Hello esteemed friends, Is it possible to use the API to ascertain last-updated for a particular statement/property/claim (or an etag, lastrevid)? Or is this information only available at the item/entity level? Thanks! Michael Lindsey UC Berkeley School of Law
Thank you Laurence, this is very helpful. After reading your notes, I'll likely incorporate the hashes into the checks I'm doing. Also, thanks for pointing out the json and TTL files. It is likely worth my time to compare these serializations in the context of understanding revisions. Have a great day over there! Michael
wikibaseug@lists.wikimedia.org