-
Notifications
You must be signed in to change notification settings - Fork 21
Sparql query
You specify how the Linked Data Theatre retrieves the data. One way is to specify a sparql statement.
stage:showGraphs a elmo:Representation;
elmo:url-pattern "/query/showGraphs$";
elmo:query '''
SELECT DISTINCT ?graph (count(?x) as ?tripleCount)
WHERE {
GRAPH ?graph {
?x?y?z
}
}
''';
.
The resulting dataset will be the dataset that is retrieved from the particular SPARQL endpoint. Any valid SPARQL statement is allowed, but you are limited to the specific implementation of the SPARQL endpoint you are using.
It is recommended to only use standardized SPARQL 1.1 statements, to minimize compatibility issues if you want to migrate to another implementation.
You can include parameters within your queries. These parameters will be replaced by the actual value that is passed with the URL:
stage:Resource a elmo:Representation;
elmo:query '''
CONSTRUCT {<@SUBJECT@> ?p ?o}
WHERE {<@SUBJECT@> ?p ?o}
'''';
.
The @SUBJECT
parameter contains the URI of the subject, the subject of the page that is presented to the user. The query above is a typical starting-point if you want to show some meaningful data about a specific subject: it will return all triples about the subject in question.
Other default parameters are:
-
@LANGUAGE@
: the language of the http-client; -
@USER@
: the username of a user (or empty if no login was needed); -
@CURRENTMOMENT@
: the current moment.
Any parameter that is added to the URI is also available as the name of the parameter in upercase, and enclosed with @
:
stage:Search a elmo:Representation;
elmo:url-pattern "/query/search$";
elmo:query '''
SELECT *
WHERE {
?s rdfs:label ?s_label
FILTER REGEX(?s,"^@TERM@","i")
}
''';
.
The query above shows all triples that have a rdfs:label
that starts with the term in question. For example /query/search?term=data
will return triples that have a rdfs:label
that starts with "data".
- Home
- Theatre installation
- Tutorial
- Using the theatre
- Configuring the theatre
-
Appearances
- CarouselAppearance
- ChartAppearance
- ContentAppearance
- GeoAppearance
- GeoSelectAppearance
- GraphAppearance
- FormAppearance
- FrameAppearance
- HeaderAppearance
- HiddenAppearance
- HtmlAppearance
- IndexAppearance
- ImageAppearance
- LoginAppearance
- ModelAppearance
- NavbarAppearance
- NavbarSearchAppearance
- ShortTableAppearance
- TableAppearance
- TreeAppearance
- TextAppearance
- VocabularyAppearance
- LDT Vocabulary