Read all of section 5.3 in the Jess manual, especially sections 5.3.3
and 5.3.4 . This is covered in detail.
http://www.jessrules.com/jess/docs/71/memory.html#shadow_facts
On Apr 3, 2011, at 11:44 AM, chownikhil wrote:
Hello All,
I have an object called Request in java. I am trying to modify the
object by
firing a jess rule but i don't find any changes in the object
Request class:
package proto;
import java.io.*;
public class Request implements Serializable
{
public String destination;
public int passengerAge;
public void setDestination(String dest)
{
destination }
public void setPassengerAge(int personAge)
{
passengerAge }
public String getDestination()
{
return destination;
}
public int getPassengerAge()
{
return passengerAge;
}
}
Java code for accessing the jess rules :
final Rete engine
engine.eval("(deftemplate Request (declare
(from-class proto.Request)))");
engine.eval("(deftemplate Proposal (declare
(from-class proto.Proposal)))");
FileReader fp FileReader("C:\\Users\\Venkat\
\workspace\\nnayuni_contract-net_p5\\src\\SellerRules.clp");
final Context context
final Jesp parser
Object result while(!
result.equals(Funcall.EOF))
{
try
{
result
System.out.println(result);
}
catch (JessException e)
{
e.printStackTrace();
}
}
try
{
Request req Proposal temp Fact f
f.setSlotValue("passengerAge", new Value(req.getPassengerAge()));
f.setSlotValue("destination",
new Value(req.getDestination()));
engine.assertFact(f);
engine.reset();
engine.run();
System.out.println(req.getPassengerAge());
}
catch (JessException e)
{
e.printStackTrace();
}
catch (UnreadableException e)
{
e.printStackTrace();
}
jess rule :
(defrule welcome-toddlers
"Give a special greeting to young children"
?fact <- (Request {passengerAge > 3})
(modify ?fact (passengerAge 14)))
--
View this message in context:
http://old.nabble.com/Problem-in-Modfying-a-java-Object-tp31306294p31306294.html
Sent from the Jess mailing list archive at Nabble.com.
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users
y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov
.
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012 ejfr...@sandia.gov
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------