On 05/08/16 09:05, Pavel Klinov wrote:
On Thu, Aug 4, 2016 at 11:04 PM, Pavel Klinov <[email protected]
<mailto:[email protected]>> wrote:
According to my, perhaps incorrect, reading of 3.1.3 this should be
equivalent to:
DELETE
{
GRAPH <http://example.org/g1> { ?s ?p ?o }
}
USING <http://example.org/g2> WHERE
{
GRAPH <http://example.org/g1> { :a foaf:knows ?s . ?s ?p ?o }
}
that is, WITH is ignored for DELETE because there's the explicit
GRAPH clause but applies to WHERE because there's no USING [NAMED].
Then this query should not delete any triples because the dataset
for WHERE is composed of the empty default graph and :g2 as the only
named graph, while WHERE matches triples in :g2.
A correction here: the dataset for WHERE should be :g2 as the default
graph and no named graphs (or unspecified named graphs, as per 13.2 in
[3]). But the rest of the email holds, the query can still return no
results contarry to the test.
Hi Pavel,
(not an official reply)
I believe the intent is that WITH sets the default graph but otherwise
the named graph are in the dataset visible.
Unlike USING, WITH is not describing the whole dataset to use. Is there
text that suggested to it did? Or entangles WITH and USING? If so, an
errata would be in order.
The later text:
[[
If a graph name is specified in a WITH clause, then - for the purposes
of evaluating the WHERE clause - this will define an RDF Dataset
containing a default graph with the specified name
]]
look to me to be at odds with:
[[
The WITH clause defines the graph that will be modified or matched
against for any of the subsequent elements (in DELETE, INSERT, or WHERE
clauses) if they do not specify a graph explicitly.
]]
[[
That is, a WITH clause may be viewed as syntactic sugar for wrapping
both the QuadPatterns in subsequent DELETE and INSERT clauses, and
likewise the GroupGraphPattern in the subsequent WHERE clause into GRAPH
patterns.
]]
which both suggest your example of:
> {
> GRAPH <http://example.org/g2> {
> GRAPH <http://example.org/g1> { :a foaf:knows ?s . ?s ?p ?o }
> }
> }
is intended.
Andy
Thanks,
Pavel
[3] https://www.w3.org/TR/sparql11-query/#specDataset
However, this is not what DAWG tests [2] expect and it is not how
ARQ or Sesame implement it (they pass the test). What I can tell
from ARQ's source code is that it treats the query as follows:
DELETE
{
GRAPH <http://example.org/g1> { ?s ?p ?o }
}
{
GRAPH <http://example.org/g2> {
GRAPH <http://example.org/g1> { :a foaf:knows ?s . ?s ?p ?o }
}
}
In this case, of course, WHERE will match triples because the inner
GRAPH will set :g1 as the active graph for the BGP. However 3.1.3
says explicitly that WITH, when not ignored, defines an RDF Dataset
-- this isn't what happens here.
Another interpretation could be as follows: WITH is in effect for
WHERE if there's no USING [NAMED] *and* there is no GRAPH clause in
either DELETE or INSERT. According to that interpretation the test
again should pass because WITH is simply ignored for the whole
query, including WHERE, even though there's no USING [NAMED].
So the question is: which interpretation is the intended one?
Thanks,
Pavel
[1] https://www.w3.org/TR/sparql11-update/#deleteInsert
<https://www.w3.org/TR/sparql11-update/#deleteInsert>
[2]
https://www.w3.org/2009/sparql/docs/tests/data-sparql11/delete/manifest#dawg-delete-with-02
<https://www.w3.org/2009/sparql/docs/tests/data-sparql11/delete/manifest#dawg-delete-with-02>