You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Rob Vesse <ra...@ecs.soton.ac.uk> on 2011/08/27 12:44:37 UTC
RE: [jena-dev] OPTIONAL in DELETE
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: jena-dev@yahoogroups.com [mailto:jena-dev@yahoogroups.com] On
> Behalf Of Martynas Jusevicius
> Sent: 26 August 2011 20:19
> To: jena-dev@yahoogroups.com
> 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:
> jena-dev-digest@yahoogroups.com
> jena-dev-fullfeatured@yahoogroups.com
>
> <*> To unsubscribe from this group, send an email to:
> jena-dev-unsubscribe@yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
Re: [jena-dev] OPTIONAL in DELETE
Posted by Martynas Jusevicius <ma...@gmail.com>.
Thanks Rob, that explains it.
Martynas
On Sat, Aug 27, 2011 at 12:44 PM, Rob Vesse <ra...@ecs.soton.ac.uk> wrote:
> 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: jena-dev@yahoogroups.com [mailto:jena-dev@yahoogroups.com] On
>> Behalf Of Martynas Jusevicius
>> Sent: 26 August 2011 20:19
>> To: jena-dev@yahoogroups.com
>> 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
>>
>>
>>
>
>
>
> ------------------------------------
>
> 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:
> jena-dev-digest@yahoogroups.com
> jena-dev-fullfeatured@yahoogroups.com
>
> <*> To unsubscribe from this group, send an email to:
> jena-dev-unsubscribe@yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>