Hello Mikael,

In current version of Virtuoso, the constructor of DELETE acts like any
plain constructor so it does not search for appropriate values of variables
in the database. This is the first issue.
In addition, Virtuoso is quad store, not triple store, and graphs are not
entirely separated from each other. When in doubt, be verbose re. graphs in
use.
Thus I'd recommend to use 'fair' syntax in spirit of 2.d), not 2.c) example
of same specification:

PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE FROM GRAPH <http://example/bookStore>  { ?book ?p ?v } WHERE
  { GRAPH <http://example/bookStore> {
    { dc:date ?date .
      FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
      ?book ?p ?v
  } }

In common, Virtuoso intentionally reports errors in some cases when other
SPARQL implementations silently ignore uninitialized variables. The
rationale is that unlike many other implementations Virtuoso allows SPARQL
subqueries in SQL queries and Virtuoso/PL stored procedures. In a
complicated SQL environment it is much better to stop compilation than to
miss unintentional typo in variable name.

E.g., if we permit unitialized variables then the following statement will
silently delete all data from graph:

PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE FROM GRAPH <http://example/bookStore>  { ?bok ?p ?v } WHERE
  { ?book dc:date ?date .
    FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
  }

Moreover, Virtuoso may map relational data to RDF by 'RDF Views' and now
we're implementing updateable RDF views so SPARUL statement will be able to
write to relational tables, if needed, including tables on remote SQL
servers. Thus, instead of removal of all data from RDF graph such query may
actually drop all data of a relational table of a business application,
repelling IT manager from using SPARUL anymore :)

Best Regards,
Ivan Mikhailov
OpenLink Software.

-----Original Message-----
From: virtuoso-users-boun...@lists.sourceforge.net
[mailto:virtuoso-users-boun...@lists.sourceforge.net] On Behalf Of Mikael
Hogqvist
Sent: Thursday, July 12, 2007 7:26 PM
To: virtuoso-users@lists.sourceforge.net
Subject: [Virtuoso-users] SPARUL insert/delete

Hi!

I'm using the virtuoso SPARUL implementation to manage the RDF-data from
remote. I ran into a problem when trying to remove and insert data in a
single query which I think is due to the SPARUL implementation in virtuoso.
I'm running the example query 2.c) from:
http://jena.hpl.hp.com/~afs/SPARQL-Update.html. I added "FROM GRAPH
<http://example/bookStore>" since it doesnt work without that.

Here is the result from virtuoso:

37000 Error SP031: SPARQL compiler: Variable 'v' is used in the query result
set but not assigned

SPARQL query:
define output:valmode "LONG" PREFIX dc:  <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

DELETE FROM GRAPH <http://example/bookStore>  { ?book ?p ?v } WHERE
  { ?book dc:date ?date .
    FILTER ( ?date < "2000-01-01T00:00:00"^^xsd:dateTime )
  }

>From my point of view, it is ok if ?v is not assigned. This should
then mean that all triples matching the (?book, ?p)-bindings should be
removed independent of the value of the object.

Best Regards,
Mikael

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express Download DB2 Express C - the
FREE version of DB2 express and take control of your XML. No limits. Just
data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Reply via email to