November 2022
Intermediate to advanced
294 pages
5h 58m
English
Something we’ve not touched on before is a neat feature of SPARQL that opens up the game—federated querying. This extension to SPARQL allows for a portion of a query to be directed to any other SPARQL endpoint.
This means that instead of making two separate queries to two separate endpoints in the example we just walked through, we could have done this within a single query.
Let’s see how.
Well, we need to wrap a portion of a SPARQL query with the SERVICE keyword, followed by the endpoint URI. So, we could have queried both endpoints with a single query like this:
| | CONSTRUCT { |
| | ?s ?p ?o |
| | } |
| | WHERE { |
| | { |
| | SERVICE <https://dbpedia.org/sparql> { |
| | BIND (<http://dbpedia.org/resource/Bob_Dylan> AS ?s) |
| | ?s ?p ?o . |
| | } |
| | } |
| |
Read now
Unlock full access