hi,
your very quick answer helps me indeed! thank you.
> > iam thinking that using a multivariable for my problem is more
convenient
> > when it comes to parse values from java to jess and from jess to java
(for
> > instance not calling fact-slot-value or store/ fetch several times).
> Here you might do better showing us code to criticize.
here are pieces of my code while using deftemplates. iam quite sure, you4ll
find some things to criticize... ;-)
1. getting the data in java and storing them in rete ...
(this way seems for me to be more complicated than it should be - i was
thinking about calling "getInfo()" in Jess, however i had troubles with
"call"- i just didnt managed it to get it work)
Vector x = CustomerA.getInfo("familyStatus");
rete.store("name_x", new Value ((String)x.elementAt(0), RU.Atom));
rete.store("value_x", new Value ((String)x.elementAt(1), RU.Atom));
rete.store("scope_x", new Value ((String)x.elementAt(2), RU.Atom));
Vector y = CustomerA.getInfo("sizeOfHousehold");
rete.store("name_y", new Value ((String)y.elementAt(0), RU.Atom));
...
2. fetching the values in Jess and put them to the knowledge base...
(defmodule FAMILYSTATUS)
(assert (information (name (fetch name_x)) (value (fetch value_x)) (scope
(fetch scope_x))))
(defmodule HOUSEHOLDSIZE)
(assert (information (name (fetch name_y)) (value (fetch value_y)) (scope
(fetch scope_y))))
3. rules are basically like:
(defrule family1 (information (name ?A&:(eq ?A familyStatus)) (value
?B&:(=?B 1)) (scope ?C&:(<= ?C 0.5))) => (bind ?id (assert (family (low 20)
(middle 10) (high 5))))
4. to get the values back i was going to use fact-slot-value for each slot
and each "result vector" (i dont need the low/middle/high- but
family-20-10-5):
(bind ?fact-value (fact-slot-value ?id "low"))
(store "fact-value" ?fact-value)
5. in java i fetch "fact-value" and use toString().
- alternativly, iam going to try to realize the "dynamically storing
results"-method which you suggested earlier in this forum
> If you're writing Java code anyway, they create a function
> "sendValuesFromJess()" which Jess can call to drop off all three
> values at once, and a function "getValuesFromJava" that Jess can call
> to retrieve three values at once -- whatever is convenient.
this sounds really convenient to me - however, as i said before i had
problems using the call-function earlier- and iam not confident in using
java (unfortunatly). but i4ll give it a try and i can have a look again in
the forum. i think you already explained some important aspect how call
works..
regards,
Ina
--------------------------------------------------------------------
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]
--------------------------------------------------------------------