You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Kamalraj Jairam <kj...@semanticsoftware.com.au> on 2015/03/16 01:37:03 UTC

Federated query

Hello,

     if i create federated query like

    CONSTRUCT 
  { ?s <http://localhost/target#patientId> ?o .}
WHERE
  { SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
      { ?s <http://localhost.com/traleerdf/csv#ID> ?o }
    SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
      { ?s <http://localhost.com/db#patient_patientid> ?o }
  }
LIMIT   10

   will jena always send a select query to the endpoints?

   I’m getting the following exception i execute this query

   om.hp.hpl.jena.sparql.resultset.ResultSetException: skipToHead: Unexpected tag: {http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF

Thanks
Kamalraj

Re: Federated query

Posted by Rob Vesse <rv...@dotnetrdf.org>.
You'd need to embed SELECT DISTINCT inside the SERVICE statement

SERVICE { Foo }

Translates to SELECT * WHERE { Foo } on the remote endpoint, Foo can be a
sub-query if you want to apply modifiers to the remote query

Rob

On 16/03/2015 13:05, "Mark Feblowitz" <ma...@icloud.com> wrote:

>That reminds me of a question I have: for a DISTINCT result from the
>service, would one embed a SELECT DISTINCT within the SERVICE statement?
>Or is that assumed to be performed in the enclosing context?
>
>Mark
>
>
>> On Mar 16, 2015, at 6:12 AM, Andy Seaborne <an...@apache.org> wrote:
>> 
>> On 16/03/15 00:37, Kamalraj Jairam wrote:
>>> Hello,
>>> 
>>>      if i create federated query like
>>> 
>>>     CONSTRUCT
>>>   { ?s <http://localhost/target#patientId> ?o .}
>>> WHERE
>>>   { SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
>>>       { ?s <http://localhost.com/traleerdf/csv#ID> ?o }
>>>     SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
>>>       { ?s <http://localhost.com/db#patient_patientid> ?o }
>>>   }
>>> LIMIT   10
>>> 
>>>    will jena always send a select query to the endpoints?
>>> 
>>>    I’m getting the following exception i execute this query
>>> 
>>>    om.hp.hpl.jena.sparql.resultset.ResultSetException: skipToHead:
>>>Unexpected tag: {http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF
>>> 
>>> Thanks
>>> Kamalraj
>>> 
>> 
>> Yes - SERVICE is always a SELECT, with HTTP headers for SPARQL results
>>sets.
>> 
>> 	Andy
>





Re: Federated query

Posted by Mark Feblowitz <ma...@icloud.com>.
That reminds me of a question I have: for a DISTINCT result from the service, would one embed a SELECT DISTINCT within the SERVICE statement? Or is that assumed to be performed in the enclosing context?

Mark


> On Mar 16, 2015, at 6:12 AM, Andy Seaborne <an...@apache.org> wrote:
> 
> On 16/03/15 00:37, Kamalraj Jairam wrote:
>> Hello,
>> 
>>      if i create federated query like
>> 
>>     CONSTRUCT
>>   { ?s <http://localhost/target#patientId> ?o .}
>> WHERE
>>   { SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
>>       { ?s <http://localhost.com/traleerdf/csv#ID> ?o }
>>     SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
>>       { ?s <http://localhost.com/db#patient_patientid> ?o }
>>   }
>> LIMIT   10
>> 
>>    will jena always send a select query to the endpoints?
>> 
>>    I’m getting the following exception i execute this query
>> 
>>    om.hp.hpl.jena.sparql.resultset.ResultSetException: skipToHead: Unexpected tag: {http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF
>> 
>> Thanks
>> Kamalraj
>> 
> 
> Yes - SERVICE is always a SELECT, with HTTP headers for SPARQL results sets.
> 
> 	Andy


Re: Federated query

Posted by Andy Seaborne <an...@apache.org>.
On 16/03/15 00:37, Kamalraj Jairam wrote:
> Hello,
>
>       if i create federated query like
>
>      CONSTRUCT
>    { ?s <http://localhost/target#patientId> ?o .}
> WHERE
>    { SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
>        { ?s <http://localhost.com/traleerdf/csv#ID> ?o }
>      SERVICE <http://localhost:8084/processor/webresources/rs/sparql>
>        { ?s <http://localhost.com/db#patient_patientid> ?o }
>    }
> LIMIT   10
>
>     will jena always send a select query to the endpoints?
>
>     I’m getting the following exception i execute this query
>
>     om.hp.hpl.jena.sparql.resultset.ResultSetException: skipToHead: Unexpected tag: {http://www.w3.org/1999/02/22-rdf-syntax-ns#}RDF
>
> Thanks
> Kamalraj
>

Yes - SERVICE is always a SELECT, with HTTP headers for SPARQL results sets.

	Andy