如何在SPARQL中验证日期时间对象? (Virtuoso 22007错误DT006) [英] How to validate datetime object in SPARQL? (Virtuoso 22007 Error DT006)
本文介绍了如何在SPARQL中验证日期时间对象? (Virtuoso 22007错误DT006)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误。
Virtuoso 22007 Error DT006: Cannot convert -0359 to datetime : Incorrect month field length
SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define sql:signal-void-variables 1 select ?item bif:year(xsd:dateTime( str(?dob))) as ?m{
?item <h://f.cm/ns/common/topic/notable_types> <h://f.cm/ns/people/person> .
?item <h://f.cm/ns/people/person/date_of_birth> ?dob
} limit 675
如果我将限制更改为 674
,它起作用。
If I change the limit to 674
, it works.
我怀疑某个日期时间字段在某处有误并打印了?dob
,这表明其中一个值是 -0359
。
What I suspected was that some datetime field is wrong somewhere and printed ?dob
, which revealed that one of the values is -0359
.
解决方案是验证
但是,如何在SPARQL中验证日期时间呢?
But, how can we validate datetime in SPARQL?
推荐答案
好吧,我通过Google找到了这个问题,因为我遇到了同样的问题。在其他地方寻求帮助,我找到了以下解决方案:
Well, I found this question via Google because I had the same problem. Looking elsewhere for help, I found the following solution:
SELECT * {
?s ?p ?o
FILTER ( datatype(?o) = xsd:datetime )
FILTER ( coalesce(xsd:datetime(str(?o)), '!') != '!')
}
这对我有用。
请注意,我在 SemanticWeb 。
这篇关于如何在SPARQL中验证日期时间对象? (Virtuoso 22007错误DT006)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文