On Tue, Feb 7, 2012 at 10:32 AM, Andy Seaborne <[email protected]> wrote:
> On 07/02/12 14:47, Ozga, Rafal wrote:
>>
>> Hi,
>>
>> Iąve just spotted that for every SPARQL UPDATE query in the form:
>>
>> DELETE ..
>> INSERT ..
>> WHERE ..
>>
>> where in the where clause weąre asking for blank nodes and combine the
>> triplesą templates with UNION,
>>
>> Fuseki produces a lot of warning messages about unbound quads.
>>
>> For instance, for the query:
>>
>> DELETE {
>> graph<http://test.com/graphs/graphs>  { ?b0 void:triples ?triples0 . }
>> graph<http://test.com/graphs/graphs>  { ?b1 void:triples ?triples1 . }
>> } INSERT {
>> graph<http://test.com/graphs/graphs>  { ?b0 void:triples 5 . }
>> graph<http://test.com/graphs/graphs>  { ?b1 void:triples 2 . }
>> } WHERE {
>> { graph<http://test.com/graphs/graphs>
>>  {<http://test.com/graphs/someterms>
>> void:propertyPartition ?b0 .
>> ?b0 void:property<http://xmlns.com/foaf/0.1/familyName>  .
>> ?b0 void:triples ?triples0 . }
>> } union
>> { graph<http://test.com/graphs/graphs>
>>  {<http://test.com/graphs/someterms>
>> void:propertyPartition ?b1 .
>> ?b1 void:property<http://xmlns.com/foaf/0.1/name>  .
>> ?b1 void:triples ?triples1 . }
>> } }
>>
>>
>> the following warnings are being generated:
>>
>> WARN  TemplateLib          :: Unbound quad:<http://test.com/graphs/graphs>
>> ?b1<http://rdfs.org/ns/void#triples>  ?triples1
>> WARN  TemplateLib          :: Unbound quad:<http://test.com/graphs/graphs>
>> ?b0<http://rdfs.org/ns/void#triples>  ?triples0
>> WARN  TemplateLib          :: Unbound quad:<http://test.com/graphs/graphs>
>> ?b1<http://rdfs.org/ns/void#triples>  2
>> WARN  TemplateLib          :: Unbound quad:<http://test.com/graphs/graphs>
>> ?b0<http://rdfs.org/ns/void#triples>  5
>>
>> Interestingly enough, despite the warnings, query is being executed
>> correctly.
>>
>> So, shall I bother ? Or just leave with it ?
>
>
> Live with it or re-structure.
>
> The warning arises with the fact that UNION sets different variables and the
> DELETE/INSERT templates are different variables.
>

The original query is valid however.  I'm a little worried about the
performance implications of writing so much to the log during query
execution.  If the recommended log setting for production use is WARN,
maybe we should downgrade this warning to INFO?  Or maybe a single
warning per query?  Or even eliminate the warning all together?  (I
think I'm in favor of the eliminating it).

The SPARQL spec says only: "If any solution produces a triple
containing an unbound variable or an illegal RDF construct, such as a
literal in a subject or predicate position, then that triple is not
included in the output RDF graph." [1].  There is no indication that
it is bad to rely on this behavior when writing your queries.

-Stephen

[1] http://www.w3.org/TR/sparql11-update/#deleteInsert


>
>>
>> It seems that if we split the query into multiple ones (so that UNION is
>> no
>> longer necessary in WHERE clause) then the warnings disappear.
>> But then, can I be sure that those multiple queries, if sent in one POST
>> request to Fuseki, are being executed in a single transaction, i.e. that
>> either all of them fail or success ?
>
>
> Multiple operations can do in one request separated by ";"
>
> e.g.
> -------------------------------
> DELETE {
>  GRAPH <http://test.com/graphs/graphs> {
>
>    ?b0 void:triples ?triples0 .
>  }
> }
> INSERT {
>  GRAPH <http://test.com/graphs/graphs> {
>
>    ?b0 void:triples 5 .
>  }
> }
> WHERE
> {
>   GRAPH <http://test.com/graphs/graphs>
>
>   { <http://test.com/graphs/someterms> void:propertyPartition ?b0 .
>     ?b0 void:property <http://xmlns.com/foaf/0.1/familyName> .
>     ?b0 void:triples ?triples0
>   }
> } ;
>
> DELETE {
>  GRAPH <http://test.com/graphs/graphs> {
>
>    ?b1 void:triples ?triples1 .
>  }
> }
> INSERT {
>  GRAPH <http://test.com/graphs/graphs> {
>
>    ?b1 void:triples 2 .
>  }
> }
> WHERE
> {
>      GRAPH <http://test.com/graphs/graphs>
>
>      { <http://test.com/graphs/someterms> void:propertyPartition ?b1 .
>        ?b1 void:property <http://xmlns.com/foaf/0.1/name> .
>        ?b1 void:triples ?triples1
>      }
> }
> -------------------------------
>
>        Andy

Reply via email to