Using SPARQL LOAD service to get remote endpoint's description.
Provides additional data that might be useful such as: if a local server knows what syntax extensions are supported by the remote SPARQL endpoint for ex.: http://example.com/sparql
then it can improve the compilation of SPARQL queries that contain clauses like:
SERVICE <http://example.com/sparql> {...} .
To get the description of remote endpoint, one should run the following statement at its local server:
SPARQL LOAD SERVICE <http://example.com/sparql> DATA;
The retrieved description will be stored in local RDF storage as a part of " System Metadata" graph
, so the user calling this statement should have appropriate write permissions.
INSERT INTO <http://voc.wkd.de> { ?s owl:sameAs ?o. } WHERE { GRAPH <http://voc.wkd.de> { ?s rdf:type skos:Concept.} SERVICE <http://de.dbpedia.org/sparql> { SELECT ?o WHERE { ?s <http://www.w3.org/2002/07/owl#sameAs> ?o . FILTER REGEX(str(?o), "^http://dbpedia.org") . } LIMIT 10 } }
owl:sameAs
elements in the service <http://de.dbpedia.org/sparql>
, so for ex:
{ dbpedia:A a skos:Concept }
{ dbpedia:B owl:sameAs dbpedia:C. dbpedia:A owl:sameAs dbpedia:D. }
{ dbpedia:A owl:sameAs dbpedia D. }
?s
into its result set:
INSERT INTO <http://voc.wkd.de> { ?s owl:sameAs ?o. } WHERE { GRAPH <http://voc.wkd.de> { ?s rdf:type skos:Concept.} SERVICE <http://de.dbpedia.org/sparql> { SELECT ?s ?o WHERE { ?s <http://www.w3.org/2002/07/owl#sameAs> ?o . FILTER REGEX(str(?o), "^http://dbpedia.org") . } LIMIT 10 } }
?s from service
and ?s from graph <> {}
will both appear at the same scope and the equality between them will be required by the semantics.
?s
as parameter to the service instead of selecting all pairs of ?s
and ?o
and filter them at the main query server.
http://de.dbpedia.org/sparql
but it may fail if it are not known the capabilities of SPARQL compiler at http://de.dbpedia.org/sparql
, so before the first compilation, one should execute the following statement:
SPARQL LOAD SERVICE <http://de.dbpedia.org/sparql> DATA;
SPARQL LOAD SERVICE
statement will be: http://de.dbpedia.org/sparql
service endpoint.
E.g., whether that endpoint can deal with external parameters.
<http://voc.wkd.de> { ?s rdf:type skos:Concept.}
will produce many values for ?s
, there will be many requests to dbpedia, and the sum of round-trip latencies will be high.
In some cases it may be faster to get one big list of ?s ?o pairs
from dbpedia and then search in local graph.
To change the order of execution to "remote first" variant, the order of clauses should be changed to:
INSERT INTO <http://voc.wkd.de> { ?s owl:sameAs ?o. } WHERE { SERVICE <http://de.dbpedia.org/sparql> { SELECT ?s ?o WHERE { ?s <http://www.w3.org/2002/07/owl#sameAs> ?o . FILTER REGEX(str(?o), "^http://dbpedia.org") . } LIMIT 10 } GRAPH <http://voc.wkd.de> { ?s rdf:type skos:Concept.} }