Search code examples
sparqlrdfjenaarq

Getting the value of a RDF predicate when it points to a resource


I want to get an object that is a resource (see "hasAgentWithRole" predicate below).

The document (simplified to illustrate my problem):

<?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>

The query:

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

I want to get the resource value contained within the hasAgentWithRole predicate: http://abstractsearch.agu.org/meetings/2014/FM/S54A-06/author1

However, my current query using arq throws an IRIImplException:

enter image description here


Solution

  • Does the error really occur with the current data and query shown in the question? Just from the exception, you can see that in the resultset there is some malformed IRI file:///C:/Users/abartoli/... I guess it's not a resource in your data. That means you have somewhere resources with a relative IRI which resolve to the document if no base IRI is given.