Rules engines

645 views
Skip to first unread message

ryan...@gmail.com

unread,
Mar 5, 2014, 5:02:45 PM3/5/14
to node...@googlegroups.com
Dear all,

I'm looking at performing message routing, flow-control and tagging of messages and whilst there's nothing I can't do with the existing functions (switch, change etc.), I'd like to make it a bit cleaner and more scalable. Being new to Node I thought i'd ask if anyone had a suggestion?

I have stumbled across the node-rules package (https://www.npmjs.org/package/node-rules), which seems to play nicely. Would be happy to learn of others...

Cheers,
Ryan.

chris mobberley

unread,
Mar 6, 2014, 7:17:23 AM3/6/14
to node...@googlegroups.com
I'll be honest I don't really see what the node-rules package offers in comparison to what we have already (as you have mentioned). In my opinion I like the separation of the current nodes is a plus, but happy to see other opinions.

ryan...@gmail.com

unread,
Mar 6, 2014, 7:36:56 AM3/6/14
to node...@googlegroups.com
Thanks for the input Chris. I can see the existing graphical interface being overwhelmed when handling greater complexity, so the idea of a simple db of JSON rules to define the business logic makes sense to me. I appreciate it might be moving away from the ethos of Node-Red but it'd be useful for my task.

Martin Jarvis

unread,
Mar 6, 2014, 8:52:51 AM3/6/14
to node...@googlegroups.com
Before I found Node-Red I was looking at a project called Homa. They embedded a rules engine called Nools https://github.com/C2FO/nools. I do like the clean DSL that Nools provides.

MartinJ

Guizmo

unread,
Dec 9, 2015, 8:56:19 PM12/9/15
to Node-RED
Hi,

Can we use node-red for the orchestration of rules defined by nodes-rules or nools (i don't know the best of the 2).

How node-red compare to noflo?

Dave C-J

unread,
Dec 10, 2015, 3:42:12 AM12/10/15
to node...@googlegroups.com
Hi

it may be possible. Those npm packages would need to be wrapped into Node-RED nodes (see http://nodered.org/docs/creating-nodes/
The main effort would probably be in working out how best to allow construction or definition of the rules in a manner that is easy for the user and makes sense within the graphical environment.

NoFlo is another flow based programming environment that was an early project on Kickstarter. I've not really been following it since so can't really comment further :-)

Julian Knight

unread,
Dec 10, 2015, 6:49:13 AM12/10/15
to Node-RED
I did give NoFlo a go but I didn't find it as usable as Node-Red :)

In fact, it didn't work at all well for me though that might just have been me. They seem focussed on their cloud offering anyway now & that's not a way I wanted to go for the projects at hand. Anything I'm likely to want to process with flow-based tools is likely to need to be kept close at hand and secured from prying eyes not on an unknown platform.

Guizmo

unread,
Dec 10, 2015, 7:04:42 AM12/10/15
to Node-RED
Thanks you Dave,
I was thinking of using directly rules js code into node-red nodes functions, is it possible?
Maybe by creating our own node-red nodes.

Guizmo

unread,
Dec 10, 2015, 7:08:34 AM12/10/15
to Node-RED
Yes, Noflo does not seem to be straitghforward usable.
You're not alone, Morrison invented flow based programming and he very often struggle with noflo.

Noflo is not cloud based only but i'm looking something simple, straightforward but also something not only related to iot, is node-red adapted to that?
What about conccurency / parallelism?

Dave C-J

unread,
Dec 10, 2015, 7:22:04 AM12/10/15
to node...@googlegroups.com
You can use other js libraries within functions if you add them to the Global Context via the settings.js file - see http://nodered.org/docs/writing-functions.html - global context section.


Max Hadley

unread,
Dec 10, 2015, 8:22:31 AM12/10/15
to Node-RED
I looked at the idea of a rules engine for nodered a while back. Either using nools or durable. I never found the time to go beyond some preliminary design thoughts, which I can share here.

I propose three nodes plus a configuration node. To start with that, the node would be called a "rulebook" and would serve only to link the other node instances together. The only property is its name.

There are two message-accepting nodes and one message-generating node. The "event" node sends a data-free event into the rules engine when it receives a message. The event name is defined in the node (may be overridden by a message property). The event time is the system time when the message arrives.
The "value" node sets the value of a rules engine value (or fact) when a message arrives. The value will come from a message property.
The "rule" node generates a message when the rule fires. This is where the actual DSL defining the rule is entered. Unlike most rules engines, the rule descriptions are not in a single file but split up among the rule nodes.
I have no idea how feasible this architecture would be, but if anyone wants to try it there is no charge!

Max

Guizmo

unread,
Dec 10, 2015, 10:01:34 AM12/10/15
to Node-RED
Good idea Max, thanks.
Do you think your idea could be "approable" with either nools or nodes-rules?

Max Hadley

unread,
Dec 10, 2015, 10:59:00 AM12/10/15
to Node-RED
Nools was the first engine I looked at. Durable has the advantage that it won't forget everything it 'knows' when a flow is redeployed (at least I think not). It's also in C rather than pure JS so may be better suited to RPi and similar devices.

Max

Guizmo

unread,
Dec 10, 2015, 12:26:02 PM12/10/15
to Node-RED
What is durable? you mean this => https://github.com/jruizgit/rules ?
Do you have an example of the durable advantage you mention? I mean a use case

Max Hadley

unread,
Dec 10, 2015, 3:21:53 PM12/10/15
to Node-RED
Yes, that's the durable I had in mind. A typical use case would be the famous node-RED automated chicken coop, where you want to remember the various facts that govern the rule which opens & shuts the door (am I home, is it after sunset, has the door been opened, etc.) when modifying the node-RED flow. Otherwise you have to save the entire knowledge base and restore it, which can be difficult to coordinate with node-RED's own startup.

But I never got around to actually coding anything - not enough free time :(

Max

Guizmo

unread,
Dec 10, 2015, 3:31:41 PM12/10/15
to Node-RED
Good point, i will keep this one in my radar.
It would be interesting Node-red integrate directly a rule engine itself, that would simplifies things.

Did you had a look on nodes-rule and compare it to nools?

Julian Knight

unread,
Dec 11, 2015, 4:35:30 AM12/11/15
to Node-RED
It would be interesting but would it bloat NR for those people who didn't really need it?

Max, I like your thinking on this and it sounds like a good starting point though I am far from an expert on rules engines. I can certainly see some uses for this myself - as long as the interface can be kept simple enough for a non-information scientist, non-developer to use :)

Be even better if you could find a way to integrate an easy to use machine learning interface! :)

Jochen Scheib

unread,
Jan 9, 2016, 12:30:57 PM1/9/16
to Node-RED
Hey.

I started some time ago to implement node-RED nodes for nools. Its based on the architecture of Robert Hekkers. Its a first version and not fully tested. Suggestions and Pull Requests are welcome ;). 

Greetings,
mapero
Reply all
Reply to author
Forward
0 new messages