sparql - 如何查询 Wikidata 以获取最近一天修改的项目?
问题描述
我正在尝试检索过去 24 小时内已编辑的纬度/经度边界框中的所有 wikidata 项目
我可以通过边界框部分,但我无法确定“修改后”位。
这是我能找到的最接近的例子,我试图从中完成这项工作:
SELECT ?place WHERE {
SERVICE wikibase:box {
?place wdt:P625 ?location .
# looks like cornerwest must be south of cornereast
# otherwise you go around the globe
# this is lng lat
bd:serviceParam wikibase:cornerWest "Point(SW_LNG SW_LAT)"^^geo:wktLiteral .
bd:serviceParam wikibase:cornerEast "Point(NE_LNG NE_LAT)"^^geo:wktLiteral .
}
?place wdt:P31 ?placeCategory .
?place wdt:P625 ?placeCoords .
optional{ ?place wdt:P18 ?placePicture . }
BIND (now() - ?modified as ?date_range)
FILTER (?date_range > 2)
}
没有结果。
解决方案
使用schema:dateModified
. 顺便说一句,Blazegraph 支持日期和时间算法:
SELECT ?place ?placeLabel ?location WHERE {
BIND ((now() - "P7D"^^xsd:duration) AS ?date_)
SERVICE wikibase:box {
?place wdt:P625 ?location .
bd:serviceParam wikibase:cornerSouthWest "Point(55.000 55.000)"^^geo:wktLiteral.
bd:serviceParam wikibase:cornerNorthEast "Point(65.000 65.000)"^^geo:wktLiteral.
}
?place schema:dateModified ?date .
# hint:Prior hint:rangeSafe true .
FILTER (?date >= ?date_)
SERVICE wikibase:label { bd:serviceParam wikibase:language "ru". }
}
还有一个wikibase:timestamp
相当辅助的谓词。
推荐阅读
- javascript - Parcel 不会重新加载对 HTML 页面的更改
- c - 需要在特定位置放置 const 数据,但该区域在文本部分的中间
- python - ConvLstm ucf101 到 hmdb51 的迁移学习
- python - 将浮点数转换为二进制
- emacs - 需要包时生成运行时警告
- c# - 当设备处于服务器模式时,我无法取消选中使用服务器模式和 facestation 至上设备中的命令
- asp.net-core - 添加后如何编辑实体(使用 AsNoTracking)
- javascript - 使用 node.js 访问服务器端的 Json 文件
- ruby-on-rails - 切换到强参数后,没有为 db-query 提供任何值
- php - 比较数组中的数据 - PHP