SPARQL Update Formal Model

This section formally defines the semantics of Update Operations by describing their effects in terms of transformations of the Graph Store.

Mapping Update Requests to the Formal Model

In this section we show how to map Update Requests in the SPARQL 1.1. Update Language to Update Operations over the Graph Store as defined earlier in this section. This mapping assumes that in all Update requests, any PREFIXes have been expanded. Moreover, we assume that WITH clauses have been replaced by wrapping both the QuadPatterns in subsequent DELETE and INSERT clauses, and likewise - in the absence of USING and USING NAMED clauses - the GroupGraphPattern in the subsequent WHERE clause, into GRAPH patterns.

The mapping from requests to Update Operations is defined in terms of the recursive translation function Tr(GS,R) which takes the Graphstore GS - as before executing the request - and an update request R as input and exands it to an Update Operation call as shown in the following table. The COPY, MOVE, and ADD operations are not mentioned explicitly here, since they are understood as shortcuts.

Table 1: Mapping from Update Requests to Update Operations
Update request R Tr(GS,R) =
R1 ; R2 Tr(Tr(GS, R1), R2)
INSERT DATAQuadData OpInsertData(GS, QuadData)
DELETE DATAQuadData OpDeleteData(GS, QuadData)
DELETEQuadPatternDELINSERTQuadPatternINS
UsingClause*
WHEREGroupGraphPattern
OpDeleteInsert(GS, TrDataset(GS,UsingClause*), QuadPatternDEL, QuadPatternINS, GroupGraphPattern)
DELETEQuadPatternDEL
UsingClause*
WHEREGroupGraphPattern
OpDeleteInsert(GS, TrDataset(GS,UsingClause*), QuadPatternDEL, {}, GroupGraphPattern)
INSERTQuadPatternINS
UsingClause*
WHEREGroupGraphPattern
OpDeleteInsert(GS, TrDataset(GS,UsingClause*), {}, QuadPatternINS, GroupGraphPattern)
DELETE WHEREQuadPattern OpDeleteInsert(GS, GS, QuadPattern, {}, QuadPattern)
LOAD (SILENT)?IRIref OpLoad(GS, IRIref)
LOAD (SILENT)?IRIreffromINTO GRAPHIRIrefto OpLoad(GS, IRIreffrom, IRIrefto)
CLEAR (SILENT)? GRAPHIRIref OpClear(GS, IRIref)
CLEAR (SILENT)? DEFAULT OpCleardef(GS)
CLEAR (SILENT)? NAMED OpClearnamed(GS)
CLEAR (SILENT)? ALL OpClearall(GS)
CREATE (SILENT)? GRAPHIRIref OpCreate(GS, IRIref)
DROP (SILENT)? GRAPHIRIref OpDrop(GS, IRIref)
DROP (SILENT)? DEFAULT OpDropdef(GS)
DROP (SILENT)? NAMED OpDropnamed(GS)
DROP (SILENT)? ALL OpDropall(GS)

This table uses one auxiliary translation function TrDataset() which constructs a dataset from the optional set of USING and USING NAMED clauses and is defined as follows:

Table 2: Mapping UsingClauses to RDF Datasets
Translation Function Definition
TrDataset(GS,UsingClause*) =
  • the RDF Dataset DS described by the UsingClauses, if non-empty
  • the RDF Dataset corresponding to the current state of GS, otherwise

Note:

How exactly an RDF Dataset is obtained from the

USING and

USING NAMED clauses (e.g. by dereferencing graph name IRIs and trying to retrieve them, or by picking those graphs from the existing Graph Store) is implementation dependent. Particularly, this specification does not mandate any assumptions about blank node identity beyond the consideration for the analogous

FROM and

FROM NAMED clauses in Section

Specifying RDF Datasets of the SPARQL 1.1 Query Language specification.