SPARQL DATETIME减法,具有特定格式

发布于 2025-02-03 13:25:47 字数 604 浏览 4 评论 0原文

在这里,我们看到,当我尝试用角括号减去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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文