On 08/10/15 20:52, Zen 98052 wrote:
Thanks Rob for very nice explanation. Do you somehow know the answer for first 
question?
Is putting them in separate query like example below the only workaround?

Is there a way to re-write the query so that that first pattern
onlyapply delete operation not as many as multiplying with result >> from
second pattern? Is separating them the only option?

The code is UpdateEngineWorker -- you can look at that to see what is going on. Open source.

The contract is that the WHERE clause generates bindings, the DELETE template removes triples formed by instantiating the template with the all the bindings. How that happens is up to the implementation.

The default implementation, UpdateEngineWorker deletes each triple - in most storage systems, it is as easy to simply delete the triple regardless of existence. Indeed, that scales better than duplicate suppression which is inherently requiring temporary state.

If you want to suppress duplicate deletes, you can subclass UpdateEngineWorker and do that processing. Suppressing with a sliding window would address the scale issue at the possibility of occasional duplicates. There is no "one size fits all" answer.

        Andy


DELETE
{
   ?email ?emailPredicate ?emailObject .
}
WHERE
{
    ?person abc:name "foobar" .
    ?person abc:hasContactInfo ?contactInfo .
    ?contactInfo abc:hasEmail ?email .
    ?email ?emailPredicate ?emailObject .
};
DELETE
{
   ?contactInfo abc:hasEmail ?email .
}
WHERE
{
    ?person abc:name "foobar" .
    ?person abc:hasContactInfo ?contactInfo .
    ?contactInfo abc:hasEmail ?email .
};


Thanks,
Z
________________________________________
From: Rob Vesse <[email protected]>
Sent: Thursday, October 8, 2015 9:20 AM
To: [email protected]
Subject: Re: DELETE with WHERE clause

On 08/10/2015 13:48, "Zen 98052" <[email protected]> wrote:

Second question, I notice that update operation is instance of
UpdateModify. Do you know why it is not UpdateDeleteWhere?

UpdateDeleteWhere is a special case for the following:

DELETE WHERE {
   # Some patterns
}

I.e. a DELETE where the template is also treated as the WHERE clause

http://www.w3.org/TR/sparql11-update/#deleteWhere

This is more limited than a general DELETE/INSERT operation because you
can only have quad patterns I.e. can't use FILTERs, BINDs, sub-queries etc
that you could use in the WHERE clause of the longer form

Your update is the full form (separate template and WHERE clause) so is an
UpdateModify

Rob





Reply via email to