我有以下SPARQL查询
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?d
WHERE { GRAPH <https:/my/triples>{
?s <http://my/ontology/v1.0#hasTimestamp> ?d .
FILTER(?d > "1945-01-01"^^xsd:date)
}
}
当我执行上述操作时,它无法按日期正确过滤结果。实际上,它根本没有给我任何结果,也没有错误。
如果删除日期过滤器,则会收到此响应:
"bindings": [ { "s": { "type": "uri" , "value": "seo:S2A_MSI_2019_11_28_09_33_31_T33SXB_t_dogliotti" } , "d": { "datatype": "xsd:date" , "type": "typed-literal" , "value": "2019-11-28" } }
可能有什么问题?
我尝试了评论中的所有建议,但无法使其正常运行。
我偶然发现了2011年发布的帖子(!!),部分解决了我的问题。帖子为here,它指出以下解决方案(又称“字符串化”日期仅适用于平等)>
用于比较。FILTER(str(?d) >= "2018") .
并强制转换为xsd:dateTime
就我而言,第一个解决方案适用于比较(包括相等性),而强制转换失败了。