一些维基百科文章在信息框中有精确的时间戳,如下所示:
https://en.wikipedia.org/wiki/Apollo_11
(发布日期:1969年7月16日,UTC时间13:32:00)
或:
https://en.wikipedia.org/wiki/Remembrance_Day_bombing
(日期:1987年11月8日10:43(GMT))
有没有办法获得这样的所有文章的列表?似乎可能使用SPARQL
答案 0 :(得分:1)
AFAIK这是可能的,但它需要知道什么wiki属性链接到信息框的日期(或日期时间)字段;让我用一个例子来解释:
PREFIX : <http://dbpedia.org/resource/>
PREFIX time-of-spacecraft-launch: <http://www.wikidata.org/entity/P619c>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?entity_label, ?property_label, ?time_of_spacecraft_launch WHERE {
:Apollo_11 owl:sameAs ?wikidata_entity .
?wikidata_entity time-of-spacecraft-launch: ?time_of_spacecraft_launch .
?wikidata_entity rdfs:label ?entity_label .
?wke_prop ?property_rel time-of-spacecraft-launch:.
?wke_prop rdfs:label ?property_label .
FILTER (LANG(?property_label)='en' && LANG(?entity_label)='it')
}
现在我们可以通过删除Apollo_11中的where条件来使用相同类型的信息来粘贴所有文章:
PREFIX : <http://dbpedia.org/resource/>
PREFIX time-of-spacecraft-launch: <http://www.wikidata.org/entity/P619c>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?entity_label, ?property_label, ?time_of_spacecraft_launch WHERE {
?wikidata_entity time-of-spacecraft-launch: ?time_of_spacecraft_launch .
?wikidata_entity rdfs:label ?entity_label .
?wke_prop ?property_rel time-of-spacecraft-launch:.
?wke_prop rdfs:label ?property_label .
FILTER (LANG(?property_label)='en' && LANG(?entity_label)='it')
}
在某些情况下可能有助于简化查询:
PREFIX : <http://dbpedia.org/resource/>
PREFIX time-of-spacecraft-launch: <http://www.wikidata.org/entity/P619c>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {
?wikidata_entity time-of-spacecraft-launch: ?time_of_spacecraft_launch .
?wikidata_entity rdfs:label ?entity_label .
FILTER (LANG(?entity_label)='en')
}
ORDER BY DESC(?time_of_spacecraft_launch)