Hi Peter,

thanks for the feedback, comments below. :)


2014/1/7 Peter Ansell <[email protected]>

> Hi All,
>
> It is a difficult issue, and has been discussed in a few places in
> relation to SPARQL, but not really in relation to the Statement or
> Repository/Sail APIs:
>
> http://www.openrdf.org/issues/browse/SES-848
> http://www.openrdf.org/issues/browse/SES-850
> https://openrdf.atlassian.net/browse/SES-850
>
> From experience on the sesame mailing list, it seems that most users
> have found it fairly simple to either use "null" for all statements,
> or avoid using the default context for any statements. I don't use the
> null context in my permanent repository instances for my projects.
> There are some users who specifically use the default context as a
> management graph referencing the other named graphs, but personally I
> prefer to use well-known URI graph names for that purpose as it is
> clearer what is happening in SPARQL queries and when using the
> Repository API.
>

I also personally prefer having an explicit default graph. However, the
null-context is unfortunately used implicitly or explicitly in many places
in Sesame, especially in SPARQL. The concrete case where I was having
trouble was an DELETE/INSERT/WHERE update query, e.g.

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX mm: <http://marmotta.apache.org/vocabulary/sparql-functions#>

DELETE { ?s foaf:name ?o . }
INSERT { ?s foaf:name "Johannes Meier" }
WHERE  { ?s foaf:name ?o . FILTER(?s = <
http://localhost:8080/LMF/resource/hans_meier>) }


In this case, the default insert graph set in the Dataset of the update
query is ignored in case the value factory already assigns a non-null
context to the ground statement instatiated from the insert statement
pattern and variable bindings. The reason is in
SailUpdateExecutor.insertBoundTriples, line 583 (if-statement). In this
line it checks if the context of the insert statement is null and only in
this case uses the default insert context from the dataset. Which makes
sense, in a way, because it is not an "override insert context" but a
"default insert context". Unfortunately, it also hard codes the semantics
of "null as default".

Funny thing is that it works for other kinds of SPARQL updates, e.g. INSERT
DATA. Unfortunately I don't know which other parts could be affected, so I
think it is safer to use the default Sesame semantics for now.


Greetings,

Sebastian

Reply via email to