Hi Martynas

I think for this case you can't use the short form of DELETE, instead you
should be able to do the following with the long form (and this passes the
Update Validator fine):

PREFIX a: <http://a>

DELETE
{
  ?s a:p1 ?o1 .
  ?s a:p2 ?o2 .
}
WHERE
{
  ?s a:p1 ?o1 .
  OPTIONAL { ?s a:p2 ?o2 . }
}

The patterns in the construct part of the DELETE (or an INSERT for that
matter) work the same way as in a CONSTRUCT, if there aren't the variable
bound to create a specific triple that will be ignored.  I.e. for solutions
which have nothing bound for ?o2 the ?s a:p2 ?o2 triple will just not be
created but the ?s a:p1 ?o1 triple still gets created.

HTH,

Rob

> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Martynas Jusevicius
> Sent: 26 August 2011 20:19
> To: [email protected]
> Subject: [jena-dev] OPTIONAL in DELETE
> 
> Hey,
> 
> I can't wrap my head around a DELETE query that would delete OPTIONAL
> values.
> I can specify them in the WHERE pattern, but how should the DELETE
> template should look like?
> 
> Say ?o2 is an optional value which needs to be deleted as well - I
> thought this is how the query should look like:
> 
> PREFIX a: <http://a>
> 
> DELETE
> WHERE
> {
>   ?s a:p1 ?o1
>   OPTIONAL { ?s a:p2 ?o2 }
> }
> 
> But what I get from http://sparql.org/update-validator is:
> Encountered " "optional" "OPTIONAL "" at line 7, column 3.
> 
> What's wrong? Am I getting the syntax wrong?
> 
> Thanks,
> 
> Martynas
> 
> 
> ------------------------------------
> 
> The Jena user list is moving to Apache.
> 
> The new list name is 'jena-users' and the mail server is
> 'incubator.apache.org'.
> 
> Send email to
>   'jena-users-subscribe' at 'incubator.apache.org'
> to subscribe.
> Yahoo! Groups Links
> 
> <*> To visit your group on the web, go to:
>     http://groups.yahoo.com/group/jena-dev/
> 
> <*> Your email settings:
>     Individual Email | Traditional
> 
> <*> To change settings online go to:
>     http://groups.yahoo.com/group/jena-dev/join
>     (Yahoo! ID required)
> 
> <*> To change settings via email:
>     [email protected]
>     [email protected]
> 
> <*> To unsubscribe from this group, send an email to:
>     [email protected]
> 
> <*> Your use of Yahoo! Groups is subject to:
>     http://docs.yahoo.com/info/terms/


Reply via email to