SPARQL DATETIME减法,具有特定格式
在这里,我们看到,当我尝试用角括号减去2个日期时,它似乎不起作用,但是如果删除了角度,则可以正常工作。
我目前正在做的是通过python库生成三胞胎,它可以创建带有角括号(乌龟序列化)并在此之后进行查询的三胞胎,当然,我们已经尝试了一个快速修复的修复程序来修复查询之前的文件,但是会更好做的方式?
PREFIX : <http://example.com/abc/abc#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?diff where {
BIND("2020-09-21T12:47:50Z"^^<xsd:dateTime> as ?diff1).
BIND("2020-09-20T12:47:50Z"^^<xsd:dateTime> as ?diff2).
BIND(?diff2 - ?diff1 as ?diff).
}
更新工作
为此
BIND(xsd:dateTime(STR(?diff2)) - xsd:dateTime(STR(?diff1)) as ?diff).
Here we see that when I try to subtract 2 datetime with angular brackets it doesnt seem to work but if the angular is removed it works fine.
what I am currently doing is generating triplets via a python library and it creates the triplets with angular brackets (serialization in turtle) and query runs after it, ofcourse we have tried a quick fix to fix the file before the query but is there a better way to do it?
PREFIX : <http://example.com/abc/abc#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?diff where {
BIND("2020-09-21T12:47:50Z"^^<xsd:dateTime> as ?diff1).
BIND("2020-09-20T12:47:50Z"^^<xsd:dateTime> as ?diff2).
BIND(?diff2 - ?diff1 as ?diff).
}
Update
work around for this
BIND(xsd:dateTime(STR(?diff2)) - xsd:dateTime(STR(?diff1)) as ?diff).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论