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.



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