On May 5, 2008, at 5:51 AM, John Chrysakis wrote:
If (Mode == "string value" && activity == 'int value) call a java
userdefined class
Can you help me of how I am supposed to write a suitable rule?
What Mode needs to be? How?
How can I declare the equality of objects (== is true?)
How can I declare the equality of int values?
I don't really understand these questions in light of the fact that
the LHS of your strawman rule, below, looks to be correct.
The LHS is surely true, but I don't know how to write the RHS
of the rule
(import owl.*)
(deftemplate Ontology (declare (from-class Ontology )))
(load-function JessCaller)
(defrule testRule
"Testing the rule."
(Ontology { Mode == "Indoor_MainRoom_AmbientPresentation" &&
mode_actice == 0 } )
=>
(printout t "Reactive Rule ReportsLock: " ?value crlf)
(calling MyUserFunction)
)
(I reformatted your rule to make it a bit easier to see; I also
removed an empty set of parentheses from the LHS -- don't know what
those were for.)
How you call a function depends on what kind of a function it is. This
section of the manual talks abot calling functions in general:
http://www.jessrules.com/jess/docs/71/basics.html#functions
This section talks about calling the methods of Java objects:
http://www.jessrules.com/jess/docs/71/java.html#reflection
This part shows how to write new Jess functions in Java, how to load
and call them from Jess:
http://www.jessrules.com/jess/docs/71/extending.html#extensions
Finally, this section describes the OBJECT slot, which you could use
to get access to your "Ontology" object from the RHS of the rule:
http://www.jessrules.com/jess/docs/71/memory.html#shadow_instances
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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]
--------------------------------------------------------------------