You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to call external web services from a SPARQL query, it would be helpful to be able to LOAD their results.
The example below shows how such a query could work. The WHERE block generates an access URL dynamically (based on the content in the current graph). The access URL contains a string (text=...) that is analysed by a web service (https://api.dbpedia-spotlight.org/en/annotate?...) and returns dynamically generated RDF data (try this url)
PREFIX nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
LOAD ?access_uri
WHERE {
?s a nif:Sentence; rdfs:comment ?comments.
BIND(replace(?comments,".*text\\s*=\\s*([^\n]*).*","$1") as ?text)
BIND(URI(
CONCAT(
"https://api.dbpedia-spotlight.org/en/annotate?text=",
ENCODE_FOR_URI(?text),
"&url=",str(?s))) as ?access_uri)
}
Notes:
I can see why this could be considered harmful, because people might easily overload their end points. But this could be controlled by making this an optional feature and/or allowing implementations do enable or to disable WHERE block support for LOAD.
This proposal focuses on updates, but a similar effect could also be achieved/required during querying, e.g., using the FROM keyword. But note that at the moment, variable values for FROM are not possible because it is out of scope for variable binding.
PS: I know this is not in the core interest of the RDF-Star proposal, but it could be something to be considered in the process of developing SPARQL 1.2.
The text was updated successfully, but these errors were encountered:
I suspect this won't be in-scope for the current WG.
But you could consider opening this as an issue here, for consideration for a future WG: https://github.com/w3c/sparql-dev
Yes, as @rubensworks suggest, this is for sparql-dev. The area of "scripting for federated query" is quite a large area that could have its own community of interest. Its going to have to handle errors and partial errors carefully to given an understandable and controllable outcome.
The working group looked at this issue. Given it is not core to RDF Star, the WG asked that it be moved to sparql-dev CG to get wider input and discussion. All content is transferred.
afs
transferred this issue from w3c/sparql-update
Sep 19, 2024
In order to call external web services from a SPARQL query, it would be helpful to be able to
LOAD
their results.The example below shows how such a query could work. The
WHERE
block generates an access URL dynamically (based on the content in the current graph). The access URL contains a string (text=...
) that is analysed by a web service (https://api.dbpedia-spotlight.org/en/annotate?...
) and returns dynamically generated RDF data (try this url)Notes:
WHERE
block support forLOAD
.FROM
keyword. But note that at the moment, variable values forFROM
are not possible because it is out of scope for variable binding.PS: I know this is not in the core interest of the RDF-Star proposal, but it could be something to be considered in the process of developing SPARQL 1.2.
The text was updated successfully, but these errors were encountered: