Dear all,

I wonder what would be the best design for a Java class to allow for some
sort of `queries' from JESS rules rather than the usual pattern matching of
facts.


For example, I have a class, say User, but it doesn't have pre-specified
member variables.

I 'd like, if possible, the class to have a method that I could call with a
String parameter and return an appropriate value (say boolean or integer).


I am not sure how to achieve that, or even if that is a good design.


So I now have:


(defclass UserModel um.UserModel)

(bind ?userModel (fetch USER-MODEL))

(definstance UserModel ?userModel dynamic)

and then was hoping that

(test (> (call userModel getExpertise "command") 2))

would be appropriate. But apart from the fact that I get a "variable used
before definition" error, I also realize that even if this works in some
appropriate syntax, I will have problems with JESS recognizing changes in
the class automatically as there is nothing to make a Bean of or notify in
relation to this particular rule.

Not sure what's the best way to go about this. Is there an example that
could show me how to do that?

Thanks,
Manolis

Reply via email to