Re: Compiling information from several different triplestores

On Tue, May 5, 2009 at 5:33 AM, Nicolas Raoul
<> wrote:
> Hello all,
> How can I run a query over several different triplestores ?
> For instance, I want to get a list of Anthony's friends.
> Triplestore1 says Jack is Tony's friend.
> Triplestore2 says Tony sameAs Anthony.
> What clever mechanism would undestand that Jack is Anthony's friend?
> Do I have to copy all information from both triplestores my own
> triplestore, or is there something smarter to do ?

Mos triplestores will let you use graph URIs that contain CONSTRUCT
queries on a SPARQL endpoint. This will transfer more information than
you need, but will often work if the data is not too large. The other
issue is that the resulting URL is unwieldy:

For instance:

PREFIX owl: <>

SELECT ?friend
FROM <triplestore1.uri>
where {
  ?person :hasFriend ?friend
    ?person :hasFriend ?f2
    GRAPH <http://triplestore2/sparql/?>
      ?f2 owl:sameAs ?friend

The above query will find local friend statements (?person :hasFriend
?friend) and then import the owl:sameAs statements from the foreign
store to see their alternative URIs. Of course, I made up the URIs for
the 2 triplestores, but I'm sure you can adjust as necessary.

I don't know if all triplestores support this, but I believe Jena and
Sesame do, and I know that Mulgara does.

Paul Gearon

Received on Tuesday, 5 May 2009 12:39:49 UTC