SPARQL Queries to a remote URI with Sesame Workbench

152 views
Skip to first unread message

Jean-Baptiste Pressac

unread,
May 9, 2016, 11:53:49 AM5/9/16
to Sesame users
Hello,
I installed on Jetty a Sesame Server 2.7.10  with Sesame Workbench 2.7.10. I created a new In memory store repository that I left empty by now because I would like to test queries to remote SPARQL Endpoint or URI. I don't understand why the following query to a Worldcat URI retrives a result on http://sparql.org/sparql.html (based on Fuseki) while it retrieves nothing in the Query interface of Sesame Workbench (http://localhost:8080/openrdf-workbench/repositories/test/query).
Thanks,

PREFIX schema: <http://schema.org/>
PREFIX library: <http://purl.org/library/>

SELECT ?oclcNumber
WHERE { 
<http://www.worldcat.org/oclc/660967222> library:oclcnum ?oclcNumber.
}






Jeen Broekstra

unread,
May 9, 2016, 4:10:49 PM5/9/16
to sesame...@googlegroups.com
On 10/05/16 03:53, Jean-Baptiste Pressac wrote:
> Hello,
> I installed on Jetty a Sesame Server 2.7.10 with Sesame Workbench 2.7.10.

Just as an aside: you're aware that this is a very old version of Sesame? We're
currently at release 4.1.2.

> I
> created a new /In memory store/ repository that I left empty by now because I
> would like to test queries to remote SPARQL Endpoint or URI. I don't understand
> why the following query to a Worldcat URI retrives a result on
> http://sparql.org/sparql.html (based on Fuseki) while it retrieves nothing in
> the Query interface of Sesame Workbench
> (http://localhost:8080/openrdf-workbench/repositories/test/query).
> Thanks,
>
> PREFIX schema: <http://schema.org/>
> PREFIX library: <http://purl.org/library/>
>
> SELECT ?oclcNumber
> FROM <http://www.worldcat.org/oclc/660967222>
> WHERE {
> <http://www.worldcat.org/oclc/660967222> library:oclcnum ?oclcNumber.
> }

The FROM clause in a SPARQL query merely indicates a named graph _in the current
RDF dataset_ (that is, the current repository). Since your repository is empty,
that named graph is empty, and so the query returns nothing.

You probably got a result in Fuseki because it has implemented some extension
that inspects FROM-clauses and tries to retrieve the named graph data over the
Web. This is non-standard behavior however, and you can not rely on other SPARQL
endpoint implementations working like this.

There is no option in Sesame Server to load remote data on the fly. However, you
can of course query remote *endpoints* using SPARQL. If that dataset you're
interested in has such an endpoint, you can modify your query as follows:

SELECT ?oclcNumber
WHERE {
SERVICE <http://www.worldcat.org/sparql>
{ <http://www.worldcat.org/oclc/660967222> library:oclcnum ?oclcNumber. }
}

(I made up this SPARQL endpoint URL, no idea if they have such a service)

FWIW loading remote data on the fly *is* possible in the Sesame libraries, but
there is no easily configurable option for it in the Server. If you want
something like this, you'll either have to do some Java programming yourself, or
log a feature request and "encourage" us to develop it :)

Cheers,

Jeen

Mark Hale

unread,
May 11, 2016, 9:50:31 AM5/11/16
to Sesame users

Doesn't the DatasetRepository do this? I believe it loads the activeDataset from the dataset url. So, it would try to load the RDF at http://www.worldcat.org/oclc/660967222.

Jeen Broekstra

unread,
May 11, 2016, 3:30:32 PM5/11/16
to sesame...@googlegroups.com
On 12/05/16 01:50, Mark Hale wrote:
>
> Doesn't the DatasetRepository do this? I believe it loads the activeDataset from
> the dataset url. So, it would try to load the RDF at
> http://www.worldcat.org/oclc/660967222 <http://www.worldcat.org/oclc/660967222>.

Yes, exactly. However we don't provide a template to create a DatasetRepository
from the Server, which is something I've been meaning to look into for a while now.

Cool new project for anyone interested in becoming an RDF4J contributor I reckon :)

Jeen

Reply all
Reply to author
Forward
0 new messages