Hello,
Im currently using Jess in combination with the java Petstore. The goal is to write business rules in jess wich can be applied to the petstore and this works fine, I had a couple of questions though.
I enter my rules as a String and via rete.executeCommand(rule1) they are introduced in the rete
an example of my rules is the following:
String rule1="
(defrule nofishcat( cart (OBJECT ?ca) )
=>(bind ?items (get ?ca cart))
(bind ?it (call ?items iterator))
(bind ?fishitem 0) (bind ?catitem 0)
(while (call ?it hasNext)
(bind ?item (call ?it next))
(bind ?category (call ?item getCategory))
(printout t \"category\" ?category crlf)
(if (= (str-compare \"FISH\" ?category) 0)
then (bind ?fishitem 1))
(if (= (str-compare \"CATS\" ?category) 0)
then (bind ?catitem 1) )
)
(if (and (> ?fishitem 0)(> ?catitem 0))
then (call ?*result* addAllowedReason \"no fishes and cats")
(call ?*result* setAllowed FALSE) )
(printout t \" einde nofishcat \" (call ?*result* toString) crlf)
(store RESULT ?*result*)
)";
its fired on a Cart object, this contains a collection of Items on wich i iterate to see if there are items wich have "FISH" and items wich have "CATS" as value for the categorie in the same Cart object. If there are indeed fish and cats in the same Cart object then I set the result to false.
I was wondering if there are shorter ways to write these rules, or maybe simpler ways or in an alternate form or an alternate language (?) cause in my program its the administrators who have to supply the rules and making such a jessrule is not that easy. (what im hoping for is some kinda of language and some translation to the jessrules)
secondly in case the only way to make these rules is in the Jesslanguage I was wondering if Jess has some kinda verifier or something wich can say if a rule has the right syntax or something. (Now if you have an error in your rule it just throws an exception during execution but i would like to check my rules before the execution, even entirely independent from execution, that is on syntax not on what it actually does. So i can check the rules my administrator fills in.)
And finally I was wondering if there exists some GUI in wich you can enter rules or work with jess?
Hmm enough questions in one mail :) hope to get some help,
greetings Chris, (a JessJunkie)
_________________________________________________________________ Hotmail: your free e-mail ! http://www.msn.be/hotmail
-------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
