Ampersand
Ampersand copied to clipboard
ClearRelation function needed in the PHP-environment.
When I need a helper relation (e.g. with transitive closures), I sometimes need to delete the entire population of that relation. It would be very nice to have a PHP function for that. To clear out the entire relation, e.g. rel[A*A]
, I would like to write
TXT "{EX} ClearRelation;rel;A;A"
Use case for this feature
To edit a relation means to insert and delete pairs at arbitrary times during the lifetime of that relation. Suppose I want to edit a relation that is used in a transitive closure. E.g.
RELATION rel[A*A]
RELATION relPlus[A*A]
ENFORCE relPlus >: (rel \/ relPlus;rel) - I[A]
(Side note: - I[A]
is necessary to avoid infinite loops, in particular cases.)
Suppose I want to edit rel
, including the deletion of pairs, maintaining that relPlus = rel*
. Now, I have to change my code to:
RELATION rel[A*A]
RELATION relPlus[A*A]
RELATION relCopy[A*A]
ENFORCE relCopy >: rel
ENFORCE relPlus >: (relCopy \/ relPlus;relCopy) - I[A] -- compute the transitive closure
RELATION relCopy[A*A]
RULE rel |- relCopy
VIOLATION (TXT "{EX} ClearPop;relCopy;A;A"
,TXT "{EX} ClearPop;relPlus;A;A")
We use relCopy
for deleting the contents of relPlus
when deleting one or more pairs from rel
.