-
Notifications
You must be signed in to change notification settings - Fork 34
Query decorators
RoderickvanderWeerdt edited this page Jan 8, 2019
·
2 revisions
In addition to the actual query the .rq files can also hold specific query decorators that enhance the resulting query in the API. The decorators always start with #+ and must be placed at the beginning of the query. These are some of the decorators that can be used:
-
defaultsis used to set a default value for a specific parameter in the query, in case it is not supplied by the user. -
enumeraterestricts the input for specified parameters to a given set of possibilities. -
endpointwill be the endpoint for the query. When endpoint is not defined it will default to http://dbpedia.org/sparql. -
methodsets the HTTP method that is used to send the query (GET is default). -
mimedeclares the mime-type of the endpoint when it is not a SPARQL endpoint. -
paginationdetermines the number of items that are returned per page and adds a parameter which is the page number of the page that is returned. -
summaryadds a short description of the functionality of the query to the API, so users will know what the query will return. -
tagswill be used to categorize the query within the API, grouping the queries with the same tag. Multiple tags will result in multiple duplicates of the query on the the API page.
The decorators of the queries are based on the decorators used in YAML.
#+ summary: Returns the track names of the MIDI file of the Ghostbusters theme
#+ endpoint: https://raw.githubusercontent.com/albertmeronyo/lodapi/master/ghostbusters.ttl
#+ mime: text/turtle
#+ tags:
#+ - RDF dump
#+ method: GET
#+ pagination: 50
#+ defaults:
#+ - midiEvent: http://example.org/midi/Track
#+ enumerate:
#+ - midiEvent:
#+ - http://example.org/midi/Track
#+ - http://example.org/midi/ProgramChangeEvent
#+ - http://example.org/midi/TrackNameEvent
PREFIX mid: <http://example.org/midi/>
SELECT ?s WHERE {
?s a ?_midiEvent_iri .
}