I've been reading about SPARQL and RDF and please correct me if my reasoning about these technologies is wrong here.
Assuming that we have a local SPARQL database called LOCAL.. and url to remote RDF file called URL_RDF. Can I write a script lets say in PHP which will do a SPARQL query like this ?
Pseudo code.
SELECT * FROM LOCAL,URL_RDF WHERE LOCAL.id=URL_RDF.id
In other words can I combine sources within SPARQL query like this (remote file + local db) ?
The SERVICE keyword extends SPARQL 1.1 to support queries that merge data distributed across the Web.
Federated query is the ability to take a query and provide solutions based on information from many different sources. A building block is the ability to have one query be able to issue a query on another SPARQL endpoint during query execution.
SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions. SPARQL also supports aggregation, subqueries, negation, creating values by expressions, extensible value testing, and constraining queries by source RDF graph.
The CONSTRUCT query form returns an RDF graph. The graph is built based on a template which is used to generate RDF triples based on the results of matching the graph pattern of the query.
You can do this using the federation features in SPARQL 1.1. These are described at http://www.w3.org/TR/sparql11-federated-query, but to give you a quick impression of what it looks like, your example query would be something like this (still in pseudocode):
SELECT * WHERE {
# the local part of the query
?s ?p ?id
SERVICE <http://url/to/remote/data> {
# The remote part of the query
?x ?y ?id
}
}
Note that the URL would have to point to a SPARQL endpoint, i.e. a server that can respond to SPARQL queries, and not just a remote RDF file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With