views:

1193

answers:

8

I am looking for a rules engine in C or Python, but if you know a rules engine that is implemented in another language I would be glad to know about it.

The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc. So no "office" rules there (aka do you rules in Excel or such).

I have looked into Jess and Drools which are in Java and do a perfect job. I would like to know of others and possibly using less memory than Java does. I have heard of RuleCore in Python but couldn't really find any documentation on it (version 1.0 is available at SourceForge but it looks like they are selling v. 2.0).

EDIT: By rules engine (inference engine), I mean an implementation of RETE or equivalent.

+1  A: 

ruleby is a rule engine in written in ruby. It was subject of a presentation at rubyhoedown 2008: ruleby-the-rule-engine-for-ruby

The MYYN
Nice :) (I'm a Ruby fan) and thanks for the video.
Yanik
+1  A: 

Pychinko has been around for a while. I've never used it in production, but investigated it for possible production application a while back. It looks like it has pretty good features and a decent community of users.

http://www.mindswap.org/~katz/pychinko/

codekaizen
Thanks. Do you know of any mailing lists or irc channels for the community? It doesn't look like it is maintained any more..And have you heard of pyCLIPS (I just found out)?
Yanik
A: 

In effect, Python is a rules engine.

"The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc."

You need sensors and controllers. You write your "rules" as ordinary Python objects.

Your main "program" collects events from your sensors and sends events to your controllers.

If you can read from your sensors via ordinary USB, that's even better. The marine industry uses a couple of closely related standards like NMEA 0183 and NMEA 2000 for specifying the traffic on the bus from sensor to controller.

You don't need Yet Another Rules Language. You have Python.

S.Lott
I am unsure of what you mean, but I think you could say that any Turing complete language is in fact a rules engine.I probably should have mentioned the RETE algorithm that perform much faster than checking a fact against every rules.Since I am not a Python expert, I am not sure how you would do this. Do you have any link where it is explained?
Yanik
@Yanik: If inference is part of the problem space, then update the question to include this fact. Must rule processing does not involve inference. If you require inference, update your question, please to state this clearly.
S.Lott
If you are looking for inference on your rules then looking at Pyke [ http://pyke.sourceforge.net/ ] would be helpful
ardsrk
@ardsrk: Please post your comment as a separate answer so I can vote it up.
S.Lott
+2  A: 

You could look at CLIPS as already suggested or, if you want to pay money or need it Rete2. I've used CLIPS in the past on Unix and sucessfully embedded it into other applications.

Hope this helps.

Jackson
+5  A: 

In your search for RETE based rules engine in Python either Pyke or PyCLIPS could be the one you would want to use.

PS: I had left a comment to S.Lott's answer about Pyke. I have posted a separate answer as per his suggestion and also to let other readers readily know that the rules engine mentioned in this answer could be a probable choice if they are searching for one.

ardsrk
PyCLIPS it is. And it is really easy to translate my Jess rules to CLIPS.
Yanik
A: 

Rulecore is indeed written partly in Python. But it does not really matter. You as an user would not see any of these implementation details anyway.

The rules are purely declarative and defined using XML. The XML is sent into ruleCore CEP Server as events using a web services or JMS or other protocols.

Nick
+1  A: 

Here is a list of 13 open source rules engines in java, Drools is possibly the best of these. http://java-sources.org/open-source/rule-engines

Peter Lawrey
A: 

I know ruleCore has some parts written in Python. But the API uses XML and ActiveMQ or WebServices so it is on a higher abstraction level.

Stjoan