From SPARQL Working Group
Jump to: navigation, search

Feature: Pragmas

As interop is never 100%, we need a uniform indicator for implementation-specific language extensions. XQuery approach can be reused.

Feature description

We propose an XQuery-like feature for pragmas in SPARQL. The syntax may be (* qname ... *) and would be allowed in places where it

  • Affects the whole query, as in the prefface with namespace declarations
  • Affects a triple pattern
  • Affects a group pattern or subquery. What comes after the qname depends on the qname.

An implementation would signal an error if the qname were unknown to it. Thus a query could assert that it required certain functionality. Note that not all functionality is designated by special syntax, for example run time inference does not have a corresponding syntactic consttruct but still a query might state that it expects a certain inference to be made.


(* zzs:TimeLineInterpolation mode=polinomial window=10 shape=trapezoid ban=1 *)
(* virt:Sponge proxy="proxy.intranet.private:8080" input:grab-depth=10 input:grab-limit=100 *)

Existing Implementation(s)

Virtuoso uses clauses with syntax OPTION ( option-list ) in many places and for many porposes, but a common short syntax would be better.

Existing Specification / Documentation

The feature is similar to Section 3.14 Extension Expressions of [1.0: An XML Query Language]


The concatenation of a "(" and a binary operator is obviously "safe" for any LALR(1) parser and can not alter the meaning of any valid SPARQL 1.0 query text.

Links to postponed Issues

Has this extension/use case some history in the group already? I.e. are there posponed issues or archived mail-threads related to this originating from DAWG?

Related Features

If SPARQL protocol is extended to let web service endpoints to announce their capabilities then QNames of pragmas can be used in tha announce.


  • OpenLink

Use cases

Any experimental, product-specific or domain-specific language extension could become a use case.