Drools does not have an interactive shell, although as you know, 5
or 6 lines of code allow you to execute your rules.
Deftemplate in Jess maps to "declare" in Drools. There are
differences (like behind the scenes Drools is bytecode generating
actual javabeans for that) but the use cases are kind of the same.
declare Person
name : String
age : int
end
Check the manual for the syntax of declare, rules, etc.
Edson
2011/1/5 dc tech <dctech1000(a)gmail.com>:
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)
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @
www.jboss.com