Information Technology Reference
In-Depth Information
top
Granted(t,r)
join
release(t,r)
[Granted(t,r)]
grant(t,r)
end
join
join
join
remove(Granted(t,r))
fail
fail
Fig. 1. The Rete network for rules r 2 , r 3 ,and r 4
2.3 Specification Patterns
Rule-based programming as we have seen demonstrated above is an expres-
sive and moderately convenient notation for writing monitoring properties. Al-
though specifications are longer than traditional temporal logic specifications,
they are simple to construct due to their straight forward and intuitive seman-
tics. However, the more succinct a specification is, the better. We have as an
example implemented a specification pattern in 50 lines of Scala code in the
class PathMonitor (not shown here). In a path expression one can provide a
sequence of events and/or negation of events. A match on such a sequence any-
where in the trace will trigger a user-provided code segment to get executed.
As an example, consider the following formulation of the requirement that a
resource should not be granted to a task if it is already granted:
class DoubleGrant extends PathMonitor
{
when( double grant )(grant('t, 'r),no(release ('t, 'r )),grant(' ,'r))
{
fail ()
}
}
The property states that when a grant ( t, r ) is observed, and then subsequently
another grant ( , r ) of the same resource, without a release ( t, r ) in between,
then the code provided as the last argument is executed, in this case just the
reporting of a failure. The function when is itself defined as a sequence of rule
definitions.
Search WWH ::




Custom Search