Below are some thoughts on extending the RDF Patch format syntax to a line-based protocol that allows updating and querying RDF triple and quad stores. This allows triple or quad stores to be used directly by systems that require direct access to the data (e.g. with access to real blank node labels unavailable via SPARQL Query/Update). It also allows modular implementation without requiring systems to use the same language as the store (e.g. using the Jena API) or use wrappers/adapters (e.g. using things like SWIG or XS).
Operation keyword letters (arity):
A Add / Query Result (3/4)
D Delete (3/4)
Q Query (3/4)
F Finished (0)
RDF Tuples keyword letters:
R Repeat
U Term Undefined
The new Q
and F
operation keyword letters are used to query the underlying store.
A triple or quad pattern (using the U
token to represent variables) and trailing DOT
follows a Q
indicating the query pattern. The
store responds to such a query with zero or more result lines with ground triple or
quad data, using the A
dd syntax (meaning query results are valid RDF Patch documents).
After all statements matching the query pattern have been returned, a line
containing a single F
inished is used to indicate the completion of the query results.
Example trace:
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix foaf: <http://xmlns.com/foaf/0.1/> .
> A _:a rdf:type foaf:Person <g> .
> A <s> rdf:type foaf:Person .
> A <p> R R .
> Q U rdf:type foaf:Person .
< A <s> rdf:type foaf:Person .
< A <p> R R .
< A _:a R R <g> .
< F .
(none)
- 2013.09.06
- Changed
Q
uery syntax to useU
ndefined tokens instead of VAR syntax. - Changed the Query
R
esult syntax to useA
dd, instead (allowing query results to be valid RDF Patch data). - 2013.09.07
- Removed use of
a
token to conform with RDF Patch grammar.