[rules-users] Drools 5 - Is there an interactive shell for it? And can I define objects in that shell?

dc tech dctech1000 at gmail.com
Wed Jan 5 22:15:54 EST 2011


I've used Jess before and one of the things that I really found helpful was
it has an interactive shell and the fact that you can model fact definitions
 (deftemplate - equivalent to a Java class) and insert facts (via assert) in
the shell directly. That allowed for very easy experimentation without
getting into too much programming. An example is provided below and you can
see that examples like this are easy to experiment with.

Is there an equivalent interactive shell in Drools? Would it allow the
definition and creation of Facts in this fashion?
Or do most of you just cut the java code to experiment?

>> SAMPLE JESS  CODE

; This is equivalent to a Java class definition
(deftemplate day_time
    (slot time_of_day)
    (slot day_of_week)
)

; Rule 1
(defrule have_a_nice_weekend
    (day_time (time_of_day EVENING) (day_of_week FRI))
    =>
    (printout t "Good night. Have a great Weekend")
)
; Rule 2
(defrule tgif
    (day_time (time_of_day MORNING) (day_of_week FRI))
    =>
    (printout t "Good Morning. Aren't you glad its Friday?")
)

; Insert a Fact
(assert (day_time (time_of_day EVENING)(day_of_week FRI)))

; Execute whatever is on the agenda
(run)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110105/f2049267/attachment.html 


More information about the rules-users mailing list