Skip to content

SPARQL variable name convention for WEB API parameters mapping

Enrico Daga edited this page Oct 26, 2015 · 2 revisions

Users can specify API parameters directly in the SPARQL query. Some variables will be replaced with input parameters in the GET/POST requests based on a set of conventions. The syntax is based on the underscore character: '_', and can be easily learned by examples:

  • ?_name The variable specifies the API mandatory parameter name. The value is incorporated in the query as plain literal.
  • ?__name The parameter name is optional.
  • ?_name_iri The variable is substituted with the parameter value as a IRI.
  • ?_name_en The parameter value is considered as literal with the language 'en' (e.g., en,it,es, etc.).
  • ?_name_integer The parameter value is considered as literal and the XSD datatype 'integer' is added during substitution.
  • ?_name_prefix_datatype The parameter value is considered as literal and the datatype 'prefix:datatype' is added during substitution. The prefix must be specified according to the SPARQL syntax.

Live example:

Clone this wiki locally