我收到以下错误。
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
,则可以。
我怀疑某个日期时间字段在某处错误并打印?dob
,其中显示其中一个值为-0359
。
解决方案是在应用bif
函数之前验证该值。
但是,我们如何在SPARQL中验证日期时间?
答案 0 :(得分:5)
好吧,我通过Google发现了这个问题,因为我遇到了同样的问题。在其他地方寻求帮助,我找到了以下解决方案:
SELECT * {
?s ?p ?o
FILTER ( datatype(?o) = xsd:datetime )
FILTER ( coalesce(xsd:datetime(str(?o)), '!') != '!')
}
这对我有用。
请注意,我在SemanticWeb找到了答案。