SPARQL source¶
The SPARQL source fetches RDF data about subjects from a
triplestore exposing a SPARQL compliant endpoint.
The endpoint of the source is configured either directly or implicitly by a URL system. The source uses
two SPARQL queries to construct entities; the fragment query is a SPARQL SELECT
query that gets a list of subjects
to get data for and their modification times and a fragment query, which is a SPARQL CONSTRUCT
query that
gathers all relevant statements about a particular subject. The latter is then used to generate the stream of entities.
See the Working with RDF document for more detail on working with RDF in Sesam.
Prototype¶
{
"type": "sparql",
"system": "url-system-id",
"url": "sparql-endpoint",
"fragments_query": "SPARQL select query",
"fragment_query": "SPARQL construct query"
"initial_since_value": "0001-01-01T00:00:00Z"
}
Properties¶
Property |
Type |
Description |
Default |
Req |
---|---|---|---|---|
|
String |
The id of the URL System component to use. |
Yes |
|
|
List<String> or String |
A SPARQL |
Yes |
|
|
List<String> or String |
A SPARQL |
Yes |
|
|
String |
A string literal to use when querying the triplestore the first time. |
“0001-01-01T00:00:00Z” |
|
|
Enum<String> |
Determines the behaviour of the pipe when the SPARQL source does not return any entities. Normally, any previously synced
entities will be deleted even if the pipe does not receive any entities from its source.
If set to The global default |
|
Continuation support¶
See the section on continuation support for more information.
Property |
Value |
---|---|
|
|
|
|
|
|
Example configuration¶
The outermost object would be your pipe configuration, which is omitted here for brevity.
{
"source": {
"type": "sparql",
"url": "http://localhost:8890/sparql",
"fragments_query": [
"PREFIX sdshare: <http://www.sdshare.org/2012/extension/>",
"SELECT DISTINCT ?id ?updated WHERE {",
" ?id sdshare:lastmodified ?updated",
"} FILTER (?updated >= \"${since}\"^^xsd:dateTime) ORDER BY ?updated",
],
"fragment_query": [
"CONSTRUCT { ?subject ?property ?value } WHERE {",
" ?subject ?property ?value .",
"} FILTER (?subject = <${uri}>)",
]
},
}