You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Sorin Gheorghiu <so...@uni-konstanz.de> on 2016/07/07 14:13:21 UTC

SPARQL 1.1 Update

Hi,

while attempting to remove some triples, I noticed that VALUES is not 
supported, here an example:

DELETE WHERE {
   VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
   ?s ?p ?o .
   ?s _:prop ?value .
}

although SELECT works with multiple values:

SELECT * WHERE {
   VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
   ?s ?p ?o .
   ?s _:prop ?value .
}

I would assume VALUES is not supported by SPARQL 1.1, but at least 
DELETE using the |IN| function in a |FILTER| clause should be supported 
according to example 6 from 
https://www.w3.org/TR/2013/REC-sparql11-update-20130321/

DELETE WHERE {
   ?s ?p ?o .
   ?s _:prop ?value .
   FILTER(?value IN("10","20","30"))
}

Regards,
Sorin



Re: SPARQL 1.1 Update

Posted by Martynas Jusevičius <ma...@graphity.org>.
I don't think there is an rdf:id property? You haven't provided the
namespace for it, but you shouldn't be introducing your own terms in
the RDF namespace.

On Fri, Jul 8, 2016 at 9:20 PM, Sorin Gheorghiu
<so...@uni-konstanz.de> wrote:
> Hi Andy,
>
> Following your answer, I succeeded to delete the whole tuples using:
>
>  DELETE {?s ?p ?o] WHERE
>     ?s ?p ?o .
>     ?s rdf:id ?value .
>     FILTER (?value IN ( { ( '10' ) ( '20' ) ( '30' ) }
>  }
>
> The initial question wasn't related to blank nodes, I used a wrong dummy
> _:prop
>
> Thank you,
> Sorin
>
>
>
>
>
> Am 07.07.2016 um 20:55 schrieb Andy Seaborne:
>>
>> On 07/07/16 15:13, Sorin Gheorghiu wrote:
>>>
>>> Hi,
>>>
>>> while attempting to remove some triples, I noticed that VALUES is not
>>> supported, here an example:
>>>
>>> DELETE WHERE {
>>>    VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>>>    ?s ?p ?o .
>>>    ?s _:prop ?value .
>>> }
>>
>>
>> DELETE WHERE is a shorthand for the full form of DELETE:
>>
>> DELETE { X } WHERE { X }
>>
>> which places restrictions on X to be a template for the first { X }.
>> Templates (c.f. CONSTRUCT) does not allow VALUES.
>>
>>
>>  DELETE {
>>     VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>>     ?s ?p ?o .
>>     ?s _:prop ?value .
>>  }
>> WHERE {
>>  ?s ?p ?o .
>>   ?s _:prop ?value .
>> }
>>
>> DELETE WHERE {
>>  ?s ?p ?o .
>>  ?s _:prop '10' , '20' , '30 .
>> }
>>
>> because it is a single variable VALUES.
>>
>>>
>>> although SELECT works with multiple values:
>>>
>>> SELECT * WHERE {
>>>    VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>>>    ?s ?p ?o .
>>>    ?s _:prop ?value .
>>> }
>>>
>>> I would assume VALUES is not supported by SPARQL 1.1, but at least
>>> DELETE using the |IN| function in a |FILTER| clause should be supported
>>> according to example 6 from
>>> https://www.w3.org/TR/2013/REC-sparql11-update-20130321/
>>
>>
>> ?? I don't see this example in the spec.
>>
>>>
>>> DELETE WHERE {
>>>    ?s ?p ?o .
>>>    ?s _:prop ?value .
>>>    FILTER(?value IN("10","20","30"))
>>> }
>>
>>
>> Example 6 is:
>>
>> DELETE
>>  { ?book ?p ?v }
>> WHERE
>>  { ?book dc:date ?date .
>>    FILTER ( ?date > "1970-01-01T00:00:00-02:00"^^xsd:dateTime )
>>    ?book ?p ?v
>>  }
>>
>> which is the full form.
>>
>>     Andy
>>
>> Oh - and _:prop (a blank node as property) is not legal either. It gets
>> weird otherwise ...
>>
>>>
>>> Regards,
>>> Sorin
>>>
>>>
>>>
>>
>
> --
> Sorin Gheorghiu             Tel: +49 7531 88-3198
> Universität Konstanz        Raum: B703
> 78464 Konstanz              sorin.gheorghiu@uni-konstanz.de
>
> - KIM: Abteilung Contentdienste -
>

Re: SPARQL 1.1 Update

Posted by Sorin Gheorghiu <so...@uni-konstanz.de>.
Hi Andy,

Following your answer, I succeeded to delete the whole tuples using:

  DELETE {?s ?p ?o] WHERE
     ?s ?p ?o .
     ?s rdf:id ?value .
     FILTER (?value IN ( { ( '10' ) ( '20' ) ( '30' ) }
  }

The initial question wasn't related to blank nodes, I used a wrong dummy 
_:prop

Thank you,
Sorin




Am 07.07.2016 um 20:55 schrieb Andy Seaborne:
> On 07/07/16 15:13, Sorin Gheorghiu wrote:
>> Hi,
>>
>> while attempting to remove some triples, I noticed that VALUES is not
>> supported, here an example:
>>
>> DELETE WHERE {
>>    VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>>    ?s ?p ?o .
>>    ?s _:prop ?value .
>> }
>
> DELETE WHERE is a shorthand for the full form of DELETE:
>
> DELETE { X } WHERE { X }
>
> which places restrictions on X to be a template for the first { X }. 
> Templates (c.f. CONSTRUCT) does not allow VALUES.
>
>
>  DELETE {
>     VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>     ?s ?p ?o .
>     ?s _:prop ?value .
>  }
> WHERE {
>  ?s ?p ?o .
>   ?s _:prop ?value .
> }
>
> DELETE WHERE {
>  ?s ?p ?o .
>  ?s _:prop '10' , '20' , '30 .
> }
>
> because it is a single variable VALUES.
>
>>
>> although SELECT works with multiple values:
>>
>> SELECT * WHERE {
>>    VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>>    ?s ?p ?o .
>>    ?s _:prop ?value .
>> }
>>
>> I would assume VALUES is not supported by SPARQL 1.1, but at least
>> DELETE using the |IN| function in a |FILTER| clause should be supported
>> according to example 6 from
>> https://www.w3.org/TR/2013/REC-sparql11-update-20130321/
>
> ?? I don't see this example in the spec.
>
>>
>> DELETE WHERE {
>>    ?s ?p ?o .
>>    ?s _:prop ?value .
>>    FILTER(?value IN("10","20","30"))
>> }
>
> Example 6 is:
>
> DELETE
>  { ?book ?p ?v }
> WHERE
>  { ?book dc:date ?date .
>    FILTER ( ?date > "1970-01-01T00:00:00-02:00"^^xsd:dateTime )
>    ?book ?p ?v
>  }
>
> which is the full form.
>
>     Andy
>
> Oh - and _:prop (a blank node as property) is not legal either. It 
> gets weird otherwise ...
>
>>
>> Regards,
>> Sorin
>>
>>
>>
>

-- 
Sorin Gheorghiu             Tel: +49 7531 88-3198
Universit�t Konstanz        Raum: B703
78464 Konstanz              sorin.gheorghiu@uni-konstanz.de

- KIM: Abteilung Contentdienste -


Re: SPARQL 1.1 Update

Posted by Andy Seaborne <an...@apache.org>.
On 07/07/16 15:13, Sorin Gheorghiu wrote:
> Hi,
>
> while attempting to remove some triples, I noticed that VALUES is not
> supported, here an example:
>
> DELETE WHERE {
>    VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>    ?s ?p ?o .
>    ?s _:prop ?value .
> }

DELETE WHERE is a shorthand for the full form of DELETE:

DELETE { X } WHERE { X }

which places restrictions on X to be a template for the first { X }. 
Templates (c.f. CONSTRUCT) does not allow VALUES.


  DELETE {
     VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
     ?s ?p ?o .
     ?s _:prop ?value .
  }
WHERE {
  ?s ?p ?o .
   ?s _:prop ?value .
}

DELETE WHERE {
  ?s ?p ?o .
  ?s _:prop '10' , '20' , '30 .
}

because it is a single variable VALUES.

>
> although SELECT works with multiple values:
>
> SELECT * WHERE {
>    VALUES (?value) { ( '10' ) ( '20' ) ( '30' ) }
>    ?s ?p ?o .
>    ?s _:prop ?value .
> }
>
> I would assume VALUES is not supported by SPARQL 1.1, but at least
> DELETE using the |IN| function in a |FILTER| clause should be supported
> according to example 6 from
> https://www.w3.org/TR/2013/REC-sparql11-update-20130321/

?? I don't see this example in the spec.

>
> DELETE WHERE {
>    ?s ?p ?o .
>    ?s _:prop ?value .
>    FILTER(?value IN("10","20","30"))
> }

Example 6 is:

DELETE
  { ?book ?p ?v }
WHERE
  { ?book dc:date ?date .
    FILTER ( ?date > "1970-01-01T00:00:00-02:00"^^xsd:dateTime )
    ?book ?p ?v
  }

which is the full form.

	Andy

Oh - and _:prop (a blank node as property) is not legal either.  It gets 
weird otherwise ...

>
> Regards,
> Sorin
>
>
>