【问题标题】:Getting the value of a RDF predicate when it points to a resource获取指向资源的 RDF 谓词的值
【发布时间】:2016-08-27 17:57:00
【问题描述】:

我想获得一个资源对象(参见下面的“hasAgentWithRole”谓词)。

文档(简化说明我的问题):

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:ns0="http://purl.org/dc/terms/"
  xmlns:ns1="http://tw.rpi.edu/schema/">
  <rdf:Description rdf:about="http://abstractsearch.agu.org/meetings/2014/FM/S54A-06">
    <ns0:identifier>ID</ns0:identifier>
    <ns1:hasAgentWithRole rdf:resource="http://abstractsearch.agu.org/meetings/2014/FM/S54A-06/author1"/>
  </rdf:Description>
</rdf:RDF>

查询:

PREFIX  ns1:  <http://tw.rpi.edu/schema/>
SELECT  ?author_uri
WHERE
{ <http://abstractsearch.agu.org/meetings/2014/FM/S54A-06> ns1:hasAgentWithRole ?author_uri}

我想获取包含在 hasAgentWithRole 谓词中的资源值:http://abstractsearch.agu.org/meetings/2014/FM/S54A-06/author1

但是,我当前使用 arq 的查询会引发 IRIImplException:

【问题讨论】:

  • .../.\alt.rq -- 反斜杠在 URI 中是非法的。

标签: sparql rdf jena arq


【解决方案1】:

问题中显示的当前数据和查询是否真的发生错误?只是从异常中,您可以看到结果集中有一些格式错误的 IRI file:///C:/Users/abartoli/... 我想这不是您数据中的资源。这意味着如果没有给出基本 IRI,那么您在某处具有相对 IRI 的资源会解析为文档。

【讨论】:

  • 某处一定有错字。只需在不同的 RDF 文档上运行查询,没有任何问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-15
  • 1970-01-01
  • 2014-06-27
  • 1970-01-01
相关资源
最近更新 更多