-
Notifications
You must be signed in to change notification settings - Fork 1
Capturing triple origin in SPARQL star
This use case wiki page corresponds to https://github.com/w3c/rdf-ucr/issues/18.
When executing a Federated SPARQL Query (i.e., a query across multiple SPARQL endpoints), users may want to know which sources contributed to which query results.
At the minimum, there needs to a way to tell SPARQL to add source information to query results.
One way to do this would be via a special property, as in
SELECT * WHERE {
?s ?p ?o {| rdf:source ?source |} .
}
Assume we have the following endpoints with datasets:
http://example.org/endpoint1/sparql:
:Alice :name "Alice".
:Alice :knows :Bob.
http://example.org/endpoint2/sparql:
:Bob :name "Bob".
:Bob :knows :Alice.
Federated query across the two endpoints:
SELECT * WHERE {
?personA :knows ?personB.
?personB :name ?name {| rdf:source ?sourceOfName |} .
}
Results:
personA | personB | name | sourceOfName |
---|---|---|---|
:Alice | :Bob | "Bob" | http://example.org/endpoint2/sparql |
:Bob | :Alice | "Alice" | http://example.org/endpoint1/sparql |
Instead of using a special property it would be possible to use some new SPARQL syntax, perhaps SOURCE, as in
SELECT * WHERE {
?personA :knows ?personB.
?personB :name ?name SOURCE ?sourceOfName .
}
A minimal solution does not require quoted triples at all, just a new feature in SPARQL. But this feature would be useful in CONSTRUCT queries that add provenance information, like
CONSTRUCT ?personA :friendname ?name {| :source ?sourceOfName |} .
WHERE {
?personA :knows ?personB.
?personB :name ?name SOURCE ?sourceOfName .
}
If there are multiple kinds of information added to the base triple, such as source and date retrieved, there needs to be intermediate entities to keep information from different sources from being conflated.
It is unclear whether the syntax of the quoted triples components is important.