On 15.08.2017 10:56, Sidra shah wrote:
> Hi Lorenz, I know him and I have read your discussions.
>
> DELETE will delete the class also, or just triples. Moreover, we need a
> sort of condition in query which says if a player (which earlier has
> score<10 and member of Player class) score exceeds 10, he will now be
> member of StarPlayer and thus we need DELETE query to delete the earlier
> class.
Again, everything is done by matching triple patterns. Don't forget that
SPARQL allows to define FILTERs on values! Indeed only in the WHERE
clause of the query. Not in DELETE or INSERT section!
>
> And DELETE what? The class to be deleted will be identified dynamic i-e if
> score>10, delete Player class if exist already.
To just repeat myself, everything is done by pattern matching - SPARQL
is **not** a programming language
- define variables that match whatever in the WHERE part
- define (matching) triple patterns or even proper triples that have to
be removed in the DELETE part
- define (matching) triple patterns or even proper triples that have to
be added in the INSERT part
>
> This is why jena rules, I think, provide more power in this scenario. Will
> Construct query works here?
>
> Construct {?x rdf:type :StarPlayer} Where {?x rdf:type:Player. ?x :Score
> ?score. (here I am not sure how score value can be compared using sparql)
>
> Regards
>
> On Tue, Aug 15, 2017 at 11:22 AM, Lorenz Buehmann <
> [email protected]> wrote:
>
>> We had the same discussion here with Javed Khan [1] - this might be
>> somebody you already know as you're doing both almost the same
>> project...do you know each other?
>>
>> Anyways, I'll cite myself:
>>
>>> SPARQL 1.1 Update is straightforward ...
>>>
>>> General structure for making update queries aka. delete + insert:
>>>
>>>
>>> DELETE {
>>>
>>> }
>>>
>>> INSERT {
>>>
>>> }
>>>
>>> WHERE {
>>>
>>> }
>>
>> [1]
>> https://mail-archives.apache.org/mod_mbox/jena-users/
>> 201707.mbox/%3CCAJhui%2BtTHYsz4qtYjpsVBmZp0p%3DpjOjvtR5_DcF4O7MQWC5RyQ%
>> 40mail.gmail.com%3E
>>
>>
>> On 15.08.2017 00:08, Sidra shah wrote:
>>> Hi Dave,
>>>
>>> "Your example just shows deducing an extra type, there's nothing to
>>> replace."
>>>
>>> I think there is a need to replace existing data. For instance, if a
>>> player score is less than 10, he is from the Player class. When the score
>>> becomes greater than 10, he becomes the instance of StarPlayer while the
>>> old value also exists i-e remains the instance of Player class.
>>>
>>> I am not sure if same problem will arise also when we use INSERT query
>>> rather than jena rules.
>>>
>>> Regards
>>>
>>>
>>>
>>> On Mon, Aug 14, 2017 at 11:39 PM, Dave Reynolds <
>> [email protected]>
>>> wrote:
>>>
>>>> On 14/08/17 21:31, Sidra shah wrote:
>>>>
>>>>> Hi Dave, I know its not the complete syntax of jena rule but I just
>>>>> included it for understanding.
>>>>>
>>>>> Would you mind if you could just briefly explain how update query can
>> be
>>>>> used here in the situation above. Frankly speaking, I dont like jena
>> rules
>>>>> (as it does not replace existing data with new one)
>>>>>
>>>> Well you can write rules which drop existing values but it's true that
>>>> rules are normally used to add new values (new entailments). Your
>> example
>>>> just shows deducing an extra type, there's nothing to replace.
>>>>
>>>> and want if it could be
>>>>> replaced with SPARQL queries.
>>>>>
>>>> I've already said you can. Lookup the syntax for the Sparql update
>>>> INSERT...WHERE command and use that. If you need to also delete triples
>>>> then use the general DELETE...INSERT...WHERE form.
>>>>
>>>> Dave
>>>>
>>>>
>>>> On Mon, Aug 14, 2017 at 11:20 PM, Dave Reynolds <
>> [email protected]
>>>>> wrote:
>>>>>
>>>>> On 14/08/17 19:05, Sidra shah wrote:
>>>>>> Can we perform jena rules duties from SPARQL?
>>>>>>> (?x rdf:type :Player) (?x :Score ?score) greaterthan (?score "10") -?
>>>>>>> (?x
>>>>>>> rdf:type :StarPlayer)
>>>>>>>
>>>>>>> Construct {?x rdf:type :StarPlayer}
>>>>>>>
>>>>>>> Where { ?x rdf:type :Player. ?x :Score ?score. > ?score 10)
>>>>>>>
>>>>>>>
>>>>>> That's not the exact syntax for either Jena rules or sparql but yes,
>> for
>>>>>> a
>>>>>> single rule you can implement the same thing as a Sparql update.
>>>>>>
>>>>>> For an entire rule set you many need to iteratively apply the updates
>>>>>> until nothing more changes.
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>
>>>>>>
>>