You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Monika Solanki <mo...@gmail.com> on 2011/04/24 06:05:09 UTC

Executing federated queries at http://www.sparql.org/sparql.html

I have been trying to execute this federated query

PREFIX dc: <http://purl.org/dc/terms/>
PREFIX void: <http://rdfs.org/ns/void#>

SELECT DISTINCT *
from <http://xmlns.com/foaf/0.1/> # bogus, not used
WHERE {
SERVICE <http://void.rkbexplorer.com/sparql>
{
 ?dataset a void:Dataset.
  ?dataset dc:title ?title.
}
SERVICE <http://semantic.ckan.net/snorql>
{
 ?dataset a void:Dataset.
 ?dataset dc:title ?title.
}
}

 over the endpoint available at

http://www.sparql.org/sparql.html

It does not seem to work. What am I missing?

Thanks,

Monika

Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Andy Seaborne <an...@epimorphics.com>.
Whatever goes in the URI slot of SERVICE <uri>.

They all take the URL of the SPARQL query endpoint.

	Andy


On 27/04/11 08:00, Monika Solanki wrote:
> One more thing,
>
> If I want to use QueryExecutionFactory.sparqlService to execute the
> federated query, what should the remote service be set to?
>
> I understand that it may be possible to send a request to one of the
> endpoints supporting sparq1.1 E with SERVICE set to the other endpoint,
> but I was wondering if Jena provides a class to execute federated queries.
>
> Thanks
>
> On 26/04/11 11:16, Andy Seaborne wrote:
>>
>>
>> On 26/04/11 10:55, Monika Solanki wrote:
>>> On 25/04/11 21:25, Andy Seaborne wrote:
>>>> Works for me.
>>>>
>>> Now for me as well. Thanks!
>>>> Just in case all the previous attempts had used up threads (or some of
>>>> the other weird queries the server seems to be getting currently) I
>>>> restarted the server.
>>>>
>>>> By the way, you can execute this at the command line using:
>>>>
>>>> arq.sparql --query Q.rq
>>> I am using the arq bundled with Jena 2.6.4. I can run the queries using
>>>
>>> arq --query Q.rq or sparql --query Q.rq but not with arq.sparql
>>> ....hopefully this is as expected?
>>
>> arq.sparql is the class name - "arq" and "sparql" are the script names
>> calling arq.arq and arq.sparlq respectively.
>>
>> Andy
>>
>>>
>>> M
>>>>
>>>> where Q.rq contains your query.
>>>>
>>>> ----------------------------------------
>>>>
>>>> PREFIX dc: <http://purl.org/dc/terms/>
>>>> PREFIX void: <http://rdfs.org/ns/void#>
>>>>
>>>> SELECT DISTINCT *
>>>> from <http://openjena.org/~afs/empty.nt> # bogus, not used
>>>> {
>>>> {
>>>> SERVICE <http://void.rkbexplorer.com/sparql>
>>>> {
>>>> ?dataset a void:Dataset.
>>>> ?dataset dc:title ?title.
>>>> }
>>>> }UNION{
>>>> SERVICE <http://semantic.ckan.net/sparql/>
>>>> {
>>>> ?dataset a void:Dataset.
>>>> ?dataset dc:title ?title1.
>>>> }
>>>> }
>>>> }
>>>>
>>>>
>>>> Andy
>>>
>

Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Monika Solanki <mo...@gmail.com>.
One more thing,

If I want to use QueryExecutionFactory.sparqlService to execute the 
federated query, what should the remote service be set to?

I understand that it may be possible to send a request to one of the 
endpoints supporting sparq1.1 E with SERVICE set to the other endpoint, 
but I was wondering if Jena provides a class to execute federated queries.

Thanks

On 26/04/11 11:16, Andy Seaborne wrote:
>
>
> On 26/04/11 10:55, Monika Solanki wrote:
>> On 25/04/11 21:25, Andy Seaborne wrote:
>>> Works for me.
>>>
>> Now for me as well. Thanks!
>>> Just in case all the previous attempts had used up threads (or some of
>>> the other weird queries the server seems to be getting currently) I
>>> restarted the server.
>>>
>>> By the way, you can execute this at the command line using:
>>>
>>> arq.sparql --query Q.rq
>> I am using the arq bundled with Jena 2.6.4. I can run the queries using
>>
>> arq --query Q.rq or sparql --query Q.rq but not with arq.sparql
>> ....hopefully this is as expected?
>
> arq.sparql is the class name - "arq" and "sparql" are the script names 
> calling arq.arq and arq.sparlq respectively.
>
>     Andy
>
>>
>> M
>>>
>>> where Q.rq contains your query.
>>>
>>> ----------------------------------------
>>>
>>> PREFIX dc: <http://purl.org/dc/terms/>
>>> PREFIX void: <http://rdfs.org/ns/void#>
>>>
>>> SELECT DISTINCT *
>>> from <http://openjena.org/~afs/empty.nt> # bogus, not used
>>> {
>>> {
>>> SERVICE <http://void.rkbexplorer.com/sparql>
>>> {
>>> ?dataset a void:Dataset.
>>> ?dataset dc:title ?title.
>>> }
>>> }UNION{
>>> SERVICE <http://semantic.ckan.net/sparql/>
>>> {
>>> ?dataset a void:Dataset.
>>> ?dataset dc:title ?title1.
>>> }
>>> }
>>> }
>>>
>>>
>>> Andy
>>


Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Monika Solanki <mo...@gmail.com>.
On 26/04/11 11:16, Andy Seaborne wrote:
>
>
> On 26/04/11 10:55, Monika Solanki wrote:
>> On 25/04/11 21:25, Andy Seaborne wrote:
>>> Works for me.
>>>
>> Now for me as well. Thanks!
>>> Just in case all the previous attempts had used up threads (or some of
>>> the other weird queries the server seems to be getting currently) I
>>> restarted the server.
>>>
>>> By the way, you can execute this at the command line using:
>>>
>>> arq.sparql --query Q.rq
>> I am using the arq bundled with Jena 2.6.4. I can run the queries using
>>
>> arq --query Q.rq or sparql --query Q.rq but not with arq.sparql
>> ....hopefully this is as expected?
>
> arq.sparql is the class name - "arq" and "sparql" are the script names 
> calling arq.arq and arq.sparlq respectively.
Ah, yes of course ! All working now !

M
>
>     Andy
>
>>
>> M
>>>
>>> where Q.rq contains your query.
>>>
>>> ----------------------------------------
>>>
>>> PREFIX dc: <http://purl.org/dc/terms/>
>>> PREFIX void: <http://rdfs.org/ns/void#>
>>>
>>> SELECT DISTINCT *
>>> from <http://openjena.org/~afs/empty.nt> # bogus, not used
>>> {
>>> {
>>> SERVICE <http://void.rkbexplorer.com/sparql>
>>> {
>>> ?dataset a void:Dataset.
>>> ?dataset dc:title ?title.
>>> }
>>> }UNION{
>>> SERVICE <http://semantic.ckan.net/sparql/>
>>> {
>>> ?dataset a void:Dataset.
>>> ?dataset dc:title ?title1.
>>> }
>>> }
>>> }
>>>
>>>
>>> Andy
>>


Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Andy Seaborne <an...@epimorphics.com>.

On 26/04/11 10:55, Monika Solanki wrote:
> On 25/04/11 21:25, Andy Seaborne wrote:
>> Works for me.
>>
> Now for me as well. Thanks!
>> Just in case all the previous attempts had used up threads (or some of
>> the other weird queries the server seems to be getting currently) I
>> restarted the server.
>>
>> By the way, you can execute this at the command line using:
>>
>> arq.sparql --query Q.rq
> I am using the arq bundled with Jena 2.6.4. I can run the queries using
>
> arq --query Q.rq or sparql --query Q.rq but not with arq.sparql
> ....hopefully this is as expected?

arq.sparql is the class name - "arq" and "sparql" are the script names 
calling arq.arq and arq.sparlq respectively.

	Andy

>
> M
>>
>> where Q.rq contains your query.
>>
>> ----------------------------------------
>>
>> PREFIX dc: <http://purl.org/dc/terms/>
>> PREFIX void: <http://rdfs.org/ns/void#>
>>
>> SELECT DISTINCT *
>> from <http://openjena.org/~afs/empty.nt> # bogus, not used
>> {
>> {
>> SERVICE <http://void.rkbexplorer.com/sparql>
>> {
>> ?dataset a void:Dataset.
>> ?dataset dc:title ?title.
>> }
>> }UNION{
>> SERVICE <http://semantic.ckan.net/sparql/>
>> {
>> ?dataset a void:Dataset.
>> ?dataset dc:title ?title1.
>> }
>> }
>> }
>>
>>
>> Andy
>

Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Monika Solanki <mo...@gmail.com>.
On 25/04/11 21:25, Andy Seaborne wrote:
> Works for me.
>
Now for me as well. Thanks!
> Just in case all the previous attempts had used up threads (or some of 
> the other weird queries the server seems to be getting currently) I 
> restarted the server.
>
> By the way, you can execute this at the command line using:
>
> arq.sparql --query Q.rq
I am using the arq bundled with Jena 2.6.4. I can run the queries using

arq --query Q.rq or sparql --query Q.rq but not with arq.sparql 
....hopefully this is as expected?

M
>
> where Q.rq contains your query.
>
> ----------------------------------------
>
> PREFIX dc: <http://purl.org/dc/terms/>
> PREFIX void: <http://rdfs.org/ns/void#>
>
> SELECT DISTINCT *
> from <http://openjena.org/~afs/empty.nt> # bogus, not used
> {
>   {
>     SERVICE <http://void.rkbexplorer.com/sparql>
>     {
>       ?dataset a void:Dataset.
>       ?dataset dc:title ?title.
>     }
>   }UNION{
>     SERVICE <http://semantic.ckan.net/sparql/>
>     {
>       ?dataset a void:Dataset.
>       ?dataset dc:title ?title1.
>     }
>   }
> }
>
>
>     Andy


Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Andy Seaborne <an...@epimorphics.com>.
Works for me.

Just in case all the previous attempts had used up threads (or some of 
the other weird queries the server seems to be getting currently) I 
restarted the server.

By the way, you can execute this at the command line using:

arq.sparql --query Q.rq

where Q.rq contains your query.

----------------------------------------

PREFIX dc: <http://purl.org/dc/terms/>
PREFIX void: <http://rdfs.org/ns/void#>

SELECT DISTINCT *
from <http://openjena.org/~afs/empty.nt> # bogus, not used
{
   {
     SERVICE <http://void.rkbexplorer.com/sparql>
     {
       ?dataset a void:Dataset.
       ?dataset dc:title ?title.
     }
   }UNION{
     SERVICE <http://semantic.ckan.net/sparql/>
     {
       ?dataset a void:Dataset.
       ?dataset dc:title ?title1.
     }
   }
}


	Andy

Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Monika Solanki <mo...@gmail.com>.
Many thanks for the js hint, did not realise that.

Yes, I did mean UNION. Is this a better query to run? I still do not get 
any outputs though, only timeouts.

PREFIX dc: <http://purl.org/dc/terms/>
PREFIX void: <http://rdfs.org/ns/void#>

SELECT DISTINCT *
from <http://xmlns.com/foaf/0.1/> # bogus, not used
{
SERVICE <http://void.rkbexplorer.com/sparql>
{
  ?dataset a void:Dataset.
   ?dataset dc:title ?title.
}
}UNION
{
SERVICE <http://semantic.ckan.net/sparql/>
{
  ?dataset a void:Dataset.
  ?dataset dc:title ?title1.
}
}


Monika

On 24/04/11 19:35, Andy Seaborne wrote:
>
>
> On 24/04/11 19:15, Andy Seaborne wrote:
>>
>>
>> On 24/04/11 05:05, Monika Solanki wrote:
>>> PREFIX dc:<http://purl.org/dc/terms/>
>>> PREFIX void:<http://rdfs.org/ns/void#>
>>>
>>> SELECT DISTINCT *
>>> from<http://xmlns.com/foaf/0.1/> # bogus, not used
>>> WHERE {
>>> SERVICE<http://void.rkbexplorer.com/sparql>
>>> {
>>> ?dataset a void:Dataset.
>>> ?dataset dc:title ?title.
>>> }
>>> SERVICE<http://semantic.ckan.net/snorql>
>>> {
>>> ?dataset a void:Dataset.
>>> ?dataset dc:title ?title.
>>> }
>>> }
>>
>> The endpoint isn't /snorql, it's /sparql.
>
> Sorry - correction --it's "/sparql/" -- the trailing slash is necessary.
>
> It will be very, very slow (I got some timeouts), but that's the 
> nature of the query I'm afraid because it's a join across the sources 
> (did you mean UNION to concatenate the results?).  ARQ isn't 
> particular clever but then it does not know the relative sizes of the 
> results from the services.
>
>     Andy
>
> PS log has a lot of
>
> FORM 
> <https://docs.google.com/uc?id=0B2a_FqNAY1tsODhiNDFkYzktYTEyMC00ODU1LWEyNjEtMzI3OTUxMzExZjFh>
>
> so the server may be under load currently.
>
>
>>
>> There's a lot of javascript at http://semantic.ckan.net/snorql -- the
>> top of snorql.js has "this._endpoint = '/sparql/';" and this is used in
>> this.submitQuery
>>
>> document.getElementById('queryform').action = this._endpoint;
>>
>>
>>
>> Andy
>>
>>


Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Andy Seaborne <an...@epimorphics.com>.

On 24/04/11 19:15, Andy Seaborne wrote:
>
>
> On 24/04/11 05:05, Monika Solanki wrote:
>> PREFIX dc:<http://purl.org/dc/terms/>
>> PREFIX void:<http://rdfs.org/ns/void#>
>>
>> SELECT DISTINCT *
>> from<http://xmlns.com/foaf/0.1/> # bogus, not used
>> WHERE {
>> SERVICE<http://void.rkbexplorer.com/sparql>
>> {
>> ?dataset a void:Dataset.
>> ?dataset dc:title ?title.
>> }
>> SERVICE<http://semantic.ckan.net/snorql>
>> {
>> ?dataset a void:Dataset.
>> ?dataset dc:title ?title.
>> }
>> }
>
> The endpoint isn't /snorql, it's /sparql.

Sorry - correction --it's "/sparql/" -- the trailing slash is necessary.

It will be very, very slow (I got some timeouts), but that's the nature 
of the query I'm afraid because it's a join across the sources (did you 
mean UNION to concatenate the results?).  ARQ isn't particular clever 
but then it does not know the relative sizes of the results from the 
services.

	Andy

PS log has a lot of

FORM 
<https://docs.google.com/uc?id=0B2a_FqNAY1tsODhiNDFkYzktYTEyMC00ODU1LWEyNjEtMzI3OTUxMzExZjFh>

so the server may be under load currently.


>
> There's a lot of javascript at http://semantic.ckan.net/snorql -- the
> top of snorql.js has "this._endpoint = '/sparql/';" and this is used in
> this.submitQuery
>
> document.getElementById('queryform').action = this._endpoint;
>
>
>
> Andy
>
>

Re: Executing federated queries at http://www.sparql.org/sparql.html

Posted by Andy Seaborne <an...@epimorphics.com>.

On 24/04/11 05:05, Monika Solanki wrote:
> PREFIX dc:<http://purl.org/dc/terms/>
> PREFIX void:<http://rdfs.org/ns/void#>
>
> SELECT DISTINCT *
> from<http://xmlns.com/foaf/0.1/>  # bogus, not used
> WHERE {
> SERVICE<http://void.rkbexplorer.com/sparql>
> {
>   ?dataset a void:Dataset.
>    ?dataset dc:title ?title.
> }
> SERVICE<http://semantic.ckan.net/snorql>
> {
>   ?dataset a void:Dataset.
>   ?dataset dc:title ?title.
> }
> }

The endpoint isn't /snorql, it's /sparql.

There's a lot of javascript at http://semantic.ckan.net/snorql -- the 
top of snorql.js has "this._endpoint = '/sparql/';" and this is used in 
this.submitQuery

document.getElementById('queryform').action = this._endpoint;



	Andy