Skip to content

Commit 7e6e82a

Browse files
committed
Initial values-insertion draft
1 parent dc25411 commit 7e6e82a

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed

spec/index.html

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10425,7 +10425,152 @@

Evaluation Semantics

1042510425
eval(D(G), Slice(L, start, length)) = Slice(eval(D(G), L), start, length)
1042610426
1042710427
10428+
10429+
10430+
10431+

Values Insertion and `EXISTS`

10432+

The following sections contain draft of material for a revised

10433+
"`exists`" operation.
10434+

10435+

10436+
Background: SPARQL CG SEP-0007
10437+

10438+
10439+
10440+

Syntax Restriction

10441+

Additional [[[#sparqlGrammar]]] note:

10442+
10443+
Any variable that is assigned to in the graph pattern of `EXISTS`/`NOT EXISTS` must not be in-scope.
10444+
This applies to `BIND`, variables introduced by `AS` in a `SELECT` clause, variables in a `VALUES`
10445+
clause, and variables introduced by `AS` in `GROUP BY`.
10446+
10447+

Extend the "in-scope" rules to include the variables in-scope from the current row:

10448+
10449+
10450+
10451+
Syntax Form
10452+
In-scope variables
10453+
10454+
10455+
`EXISTS` and `NOT EXISTS` filters
10456+
v is in-scope if it is in-scope for the pattern to which the `FILTER` is applied.
10457+
10458+
10459+
10460+
10461+

10462+
This restriction means that values inserted
10463+
do not conflict with values assigned to variables with the pattern.
10464+

10465+
10466+
10467+
10468+

Remapping

10469+

10470+
Remapping ensures that a variable name used inside a project expression,
10471+
but which is not part of the results of the evaluation of the project expression,
10472+
does not coincide with a variable mentioned anywhere else in the
10473+
algebra expression of a query.
10474+

10475+

10476+
Renaming these variables does not change the results of evaluating
10477+
the project expresssion.
10478+

10479+
10480+
Definition: Projection Expression Variable Remapping
10481+

10482+
For a projection algebra operation #sparqlProjection `Project(A, PV)` acting on algreg express `A` and with set of variables `PV`, define
10483+
a partial mapping `F` from
10484+
`V`,
10485+
the set of all variables, to `V` where:
10486+

10487+
F(v) = v1 if v is in PV, where v1 is a fresh variable
10488+
F(v) = v if v is not in PV
10489+

10490+
Define the Projection Expression Variable Remapping `ProjectMap(P,PV)`
10491+

10492+
ProjectMap(Project(A, PV)) = Project(A1, PV) 
10493+
where A1 is the result of applying F
10494+
to every variable mentioned in A.
10495+
10496+

10497+
The Projection Expression Variable Remapping yields an algrebra expression that
10498+
evaluates to the same results as the Project argument. No variable of `ProjectMap(Project(A, PV))`
10499+
that is not in `PV` is mentioned anywhere else in the algebra expression for the query.
10500+

10501+
10502+
10503+

This process is applied throughout the graph pattern of EXISTS:

10504+
10505+
10506+
Definition: Variable Remapping
10507+

10508+
For any algebra expression `X`, define the Variable Remapping `PrjMap(X)`
10509+
of algebra expression `X`:
10510+

10511+
PrjMap(X) = replace all project operations Project(P, PV) 
10512+
with ProjectMap(P, PV) for each projection in X.
10513+
10514+

10515+
The outcome of `PrjMap` is independent of the order of replacement
10516+
(e.g. bottom-up or top-down).
10517+
Replacements may happen several times, depending on recursive order
10518+
but each time a replacement is made, the variable not used anywhere else.
10519+

10520+
10521+

10522+
A variable inside a project expression that is not in the variables projected
10523+
is not affected by the values insertion operation because it is renamed apart.
10524+

10525+
10526+
10527+
10528+

Values Insertion

10529+
10530+
10531+
Definition: Values Insertion
10532+

10533+
Define the Values Insertion function `ValuesInsert(X, μ)`
10534+

10535+
Let Table(μ) = { μ } and multiplicity( μ | Table(μ) = { μ } ) = 1
10536+
10537+
Replace each occurence of `Y` in X where `Y` is one of
10538+
10539+
10540+
10541+
10542+
with `join(Y, Table(μ))`.
10543+
10544+
10545+

@@ rename as ???correllate

10546+
10547+
10548+
10549+

10550+
Examples
10551+

10552+
10553+
10554+
10555+
10556+

Evaluation of EXISTS

10557+
10558+
Definition: Evaluation of Exists
10559+

10560+
Let `μ` be the current solution mapping for a filter, and `X` a graph pattern,
10561+
define the Evaluation of Exists `exists(X)`
10562+

10563+
exists(X) = true 
10564+
if eval( D(G), ValuesInsert(PrjMap(X), μ) )
10565+
is a non-empty solution sequence.
10566+
exists(X) = false otherwise
10567+
10568+
10569+
10570+
10571+
1042810572
10573+
1042910574
1043010575

Extending SPARQL Basic Graph Matching

1043110576

The overall SPARQL design can be used for queries which assume a more elaborate form of

0 commit comments

Comments
 (0)