Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I combine local and remote dataset within SPARQL query?

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) ?

like image 404
AndroidGecko Avatar asked Oct 27 '11 15:10

AndroidGecko


People also ask

Which SPARQL 1.1 feature helps to merge data that is distributed across the Web?

The SERVICE keyword extends SPARQL 1.1 to support queries that merge data distributed across the Web.

What is a federated SPARQL query?

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.

What types of queries does SPARQL support select all that apply?

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.

What is construct query in SPARQL?

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.


1 Answers

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.

like image 112
Jan Avatar answered Sep 18 '22 10:09

Jan