I've been thinking about something i think might make authoring rules
easier. I've found that often in rules only one of the patterns is the
reactive trigger pattern, and I use techniques to stop the reactivity of
other patterns; such as using watch(!*). However even with !* you'll get
reactivity when something is first inserted, just not after
modificiation. So I've been thinking about formalising this.
To a certain degree the use of queries already have this, via ?. When ?
is used the query is executed when left triggered only, further it is
not left open and there is no reactivity. There are plans to allow
patterns to also obey ?. Such that if you did ?Person() it would only
join when left triggered and there would be no reactivity from Person
itself.
However I'm not sure this is enough, while I may not want reactivity
from inserts and modifies, I may still want retract to be obeyed.
Assuming A and B are class definitions and we allowed ? on ground terms.
The following would ignore all B insertions until it is left triggered
via an A propagation. However no link is maintained, so we do not
receive B modifications or retracts either - so the behaviour is exactly
like queries.
$a : A()
?B($a; )
Do we want a half measure that ignores modifies, but allows retracts?
Maybe using a double ??
$a : A()
??B($a; )
Or is the default query behaviour adequate? Or are there some other
alternatives people can think of?
I've been thinking about the same for rule groups too. If we have "rule
groups" maybe only certain facts will trigger evaluations for rules. But
again not sure what a syntax would look like.
Mark