NodeBrain  Demonstration Site
A Rule Engine for State and Event Monitoring     


Next  Prior  Up        Home        
This example demonstrates the @kids, @rows, and @hits functions of a Cache node. These functions enable you to monitor counts in the cache for specified entries. The sentence HostUser@kids(x,y) evaluates to the number of different values of c for a given value of the tuple (a,b) specified by the current value of (x,y). The sentence HostUser@rows(x) evalutes to the number of unique tuples (b,c) for a given value of a specified by the current value of x. The sentence HostUser@hits(x,y) evalutes to the number of times a given tuple (a,b) specified by (x,y) has been asserted. Make sure you understand why the rules fire when they do.

This demo also illustrates the more general concept of node functions. The functions demonstrated here are only available because the node HostUser is a Cache node and the Cache module implements these functions. Different types of nodes provide different node functions.

Tutorial: Cache Node     Language: Define Assert     Module: Cache




again after modifications.     Reset to orignal rules and transactions.

N o d e B r a i n   0.9.04 (Columbo) 2015-09-24
Spec 0.0.904 built for x86_64-redhat-linux-gnu
Copyright (C) 2014-2015 Ed Trettevik <>
MIT or NodeBrain License
/usr/bin/nb = ++safe 
Date       Time     Message
---------- -------- --------------------------------------------
2017-06-23 15:21:30 NB000I NodeBrain nb[24688]
2017-06-23 15:21:30 NB000I Argument [1] =
2017-06-23 15:21:30 NB000I Reading from standard input.
---------- --------
| define HostUser node cache:(a,b,c(0));
| define r1 on(HostUser@kids(x,y)>2);
| define r2 on(HostUser@rows(x)=5);
| define r3 on(HostUser@hits(x,y)=4);
| HostUser. assert ("a","b","c");
| HostUser. assert ("a","b","d");
| HostUser. assert ("a","b","e");
| assert x="a",y="b"
2017-06-23 15:21:30 NB000I Rule r1 fired 
| HostUser. assert ("a","a","e");
| HostUser. assert ("a","b","f");
2017-06-23 15:21:30 NB000I Rule r3 fired 
2017-06-23 15:21:30 NB000I Rule r2 fired 
| show (HostUser@hits(x,y))
() = 4 == HostUser@hits(x,y)
2017-06-23 15:21:30 NB000I NodeBrain nb[24688] terminating - exit code=0