问题描述
昨天,我问了一个有关如何获取"Kevin Kratz(Q939047)"的Wikidata最旧和最新时间戳的问题,有人建议使用API沙箱创建这样的查询:
Yesterday, I asked a question about how to get wikidata oldest and latest timestamp for "Kevin Kratz (Q939047)", someone suggested using API sandbox to create the query like this:
最早的时间戳:https://www.wikidata.org/w/api.php?action=query&format=json&list=allrevisions&titles=Kevin%20Kratz&arvprop=ids|timestamp|flags|comment|user&arvlimit=1&arvdir=newer
最新时间戳:https://www.wikidata.org/w/api.php?action=query&format=json&list=allrevisions&titles=Kevin%20Kratz&arvprop=ids|timestamp|flags|comment|user&arvlimit=1&arvdir=older
它返回了以下结果:->最旧的时间戳时间戳":"2004-07-16T02:43:38Z".
it returned this results:-> oldest timestamp"timestamp": "2004-07-16T02:43:38Z".
->最新时间戳时间戳":"2020-03-06T16:33:59Z".
-> latest timestamp"timestamp": "2020-03-06T16:33:59Z".
但是,在仔细查看"Kevin Kratz"的修订历史之后,我找到了这个(最后的图片)
Howerver, after cheking revision history of "Kevin Kratz", I found this (the pic in the end)
在知道wikidata在2012年启动之后,它使API沙箱查询"2004-07-16T02:43:38Z"返回的最旧时间戳值不相关(修订历史记录中的最新时间戳与api-sandbox中的时间戳不相等)查询).
After knowing that wikidata was launched in 2012, it made the oldest timestamp value returned by the API sandbox query "2004-07-16T02:43:38Z", irrelevant (latest timestamp from revision history unequal the one from api-sandbox query).
那么,有没有一种方法可以从Wikidata修订历史记录中获取最新和最旧的时间戳记?
So is there a way to get the latest and oldest timestamp from wikidata revision history?
推荐答案
使用list=allrevision
,您将获得所有版本,而不仅仅是"Kevin Kratz"版本. Wikidata中最早的修订版本是2004年,因为Wikidata的开头部分页面是从其他Wikimedia项目中导入的,包括修订历史.
With list=allrevision
you are getting all revisions, not only those of "Kevin Kratz". The oldest revision in Wikidata is from 2004 is because at the beginning of Wikidata some pages were imported from other Wikimedia projects including the revision history.
要获取特定Wikidata项目的最早或最新版本,请使用 prop =修订.您将必须使用商品的Q-id(Q939047)而不是标签(Kevin Kratz),因为只有Q-id是唯一的.然后,要获取最早的修订版的API请求将显示为: https://www.wikidata.org/w/api.php?action=query&format=json&prop = revisions& titles = Q939047& rvprop = ids | timestamp | flags | comment | user& rvlimit = 1& rvdir = newer .对于最新修订版: https://www.wikidata.org/w/api.php?action=query&format=json&prop=revisions&titles= Q939047& rvprop = ids | timestamp | flags | comment | user& rvlimit = 1& rvdir = older .
To get the oldest or newest revision of a particular Wikidata item use prop=revisions.You will have to use the Q-id of the item (Q939047) and not the label (Kevin Kratz) because only the Q-id is unique.The API request to get the oldest revision then reads: https://www.wikidata.org/w/api.php?action=query&format=json&prop=revisions&titles=Q939047&rvprop=ids|timestamp|flags|comment|user&rvlimit=1&rvdir=newer.And for the newest revision: https://www.wikidata.org/w/api.php?action=query&format=json&prop=revisions&titles=Q939047&rvprop=ids|timestamp|flags|comment|user&rvlimit=1&rvdir=older.
这篇关于获取Wikidata最旧和最新的修订时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!