There are two sides to such a mechanism: one is the maintenance APIs and the physical realization of storage of statement context in a store, the other is how to add this to the query language. We've got the first part figured out pretty much, and are currently thinking about how to fit it into SeRQL.
Like SPARQL, SeRQL will distinguish between a default context and zero or more named contexts. How these different contexts relate (for example, if the default context contains the named contexts or is separate) will be a configurable feature of the store - so it is up to the publisher to decide what goes where. The default behaviour will be that the default context contains the union of all named contexts, and all inferred triples are part of the default context as well. This setting allows for the best 'backward compatible' behaviour of SeRQL as non-contextualized queries will just query the entire store.
Syntax then. There are several candidate syntaxes we are considering. Rendering the SPARQL example query from section 8.4 of the WD in different SeRQL alternatives:
- CONTEXT keyword:
SELECT name, mbox, date FROM {g} dc:publisher {name}; dc:date {date}, CONTEXT g ( {person} foaf:name {name}; foaf:mbox {mbox} ) - Multiple FROM clauses:
SELECT name, mbox, date FROM {g} dc:publisher {name}; dc:date {date} FROM g {person} foaf:name {name}; foaf:mbox {mbox} - Virtual reification through a built-in 'serql:context' operator:
SELECT name, mbox, date FROM {{person} foaf:name {name}; foaf:mbox {mbox}} serql:context {g} dc:publisher {name}; dc:date {date}