What I currently believe to be true:
Question:
Is it possible to run a query that spans multiple heterogeneous RDF triplestores?
Example:
Yes, this is quite possible, and it's what the SPARQL 1.1 Federated Query W3C recommendation is about. In a SPARQL query you use the SERVICE
keyword to specify different SPARQL endpoints that you want to query. An example from the linked recommendation is
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name
FROM <http://example.org/myfoaf.rdf>
WHERE
{
<http://example.org/myfoaf/I> foaf:knows ?person .
SERVICE <http://people.example.org/sparql> {
?person foaf:name ?name . }
}
The service
keyword there says that the triple ?person foaf:name ?name
should be retrieved from <http://people.example.org/sparql>
. In your case, you might end up with something like:
PREFIX ex: <http://example.org/>
SELECT ?person ?age ?weight ?resume WHERE {
values ?person { ex:Bill ex:John }
SERVICE <http://jobs.example.org/sparql> { ?person ex:resume ?resume }
SERVICE <http://age.example.org/sparql> { ?person ex:age ?age }
SERVICE <http://weight.example.org/sparql> { ?person ex:weight ?weight }
}
You'll have to run this query somewhere, though. If you run it locally, then all three triplestores can be specified as service
s, but if you're running the query directly against one of them, then you could have just the other two as service
s. This will all depend on having some SPARQL engine that supports federated queries, of course. I expect that most do, these days, but I only have experience with Jena (which does support federated queries).