使用Jena在SPARQL查询中xsd:dateTime的数据类型格式异常? [英] Datatype format exception for xsd:dateTime in SPARQL query with Jena?

查看:128
本文介绍了使用Jena在SPARQL查询中xsd:dateTime的数据类型格式异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对xsd:dateTime格式的RDF的属性应用范围查询.这是我的查询:

I am trying to apply a range query on a property of the RDF which is of xsd:dateTime format. This is my query:

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT ?x WHERE { ?y <DATE:> ?x . 
FILTER(?x>"2014-06-05T10:10:10+0530"^^xsd:dateTime) }

它给出警告,但没有任何结果:

It gives warning and nothing as result:

WARN [main] (Log.java:78) - Datatype format exception: "2014-06-11T12:44:22+0530"^^xsd:dateTime

我不明白问题是什么?我仅以xsd:dateTime格式存储了该属性.

I don't understand what the problem is? I have stored the property in xsd:dateTime format only.

推荐答案

我仅以xsd:dateTime格式存储了该属性.

I have stored the property in xsd:dateTime format only.

简单的答案是,不,您已经 not 将值存储为xsd:dateTime.标准 xsd:dateTime 表示:

The simple answer is that no, you have not stored the value as an xsd:dateTime. The standard xsd:dateTime says:

dateTime的词汇空间由以下项的有限长度序列组成: 格式的字符:'-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?

The lexical space of dateTime consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?

您的dateTime的一部分与2014-06-05T10:10:10相匹配.但是,

Part of your dateTime matches that, viz., 2014-06-05T10:10:10. However,

zzzzzz(如果存在)表示时区(如下所述).

zzzzzz (if present) represents the timezone (as described below).

当我们在下面看时,我们看到

When we look below, we see

时区的词汇表示形式为字符串: (('+' | '-') hh ':' mm) | 'Z',其中

The lexical representation of a timezone is a string of the form: (('+' | '-') hh ':' mm) | 'Z', where

  • hh是一个两位数的数字(根据需要带有前导零),表示小时,
  • mm是两位数字,代表分钟,
  • '+'表示持续时间为非负数,
  • '-'表示非正数持续时间.
  • hh is a two-digit numeral (with leading zeros as required) that represents the hours,
  • mm is a two-digit numeral that represents the minutes,
  • '+' indicates a nonnegative duration,
  • '-' indicates a nonpositive duration.

您的时区与此不符.我想您可能是说+05:30.因此应该有

Your timezone doesn't match that. I think you probably meant +05:30. and thus should have

"2014-06-05T10:10:10+05:30"^^xsd:dateTime

果然,如果我们使用耶拿的命令行工具qparse:

Sure enough, if we use Jena's command line tool qparse:

$ qparse --query query.rq # the original query, warnigns
14:12:22 WARN  NodeValue            :: Datatype format exception: "2014-06-05T10:10:10+0530"^^xsd:dateTime
14:12:22 WARN  NodeValue            :: Datatype format exception: "2014-06-05T10:10:10+0530"^^xsd:dateTime
14:12:22 WARN  NodeValue            :: Datatype format exception: "2014-06-05T10:10:10+0530"^^xsd:dateTime
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>

SELECT  ?x
WHERE
  { ?y <DATE:> ?x
    FILTER ( ?x > "2014-06-05T10:10:10+0530"^^xsd:dateTime )
  }

$ qparse --query query.rq # the updated query, no warnings
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>

SELECT  ?x
WHERE
  { ?y <DATE:> ?x
    FILTER ( ?x > "2014-06-05T10:10:10+05:30"^^xsd:dateTime )
  }

这篇关于使用Jena在SPARQL查询中xsd:dateTime的数据类型格式异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆