thanx, Ernest !

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 07, 2002 2:57 AM
Subject: Re: JESS: java vs jess: parsing vectors- multivariables or
deftemplates?


> I think Ina Sollinger wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> >
> > 1. getting the data in java and storing them in rete ...
> >
> >  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))))
>
> Note that you could build and assert the facts directly from Java,
> combining steps 1 and 2, in about half as many lines of code.
>
> Fact f = new Fact("information", rete);
> f.setSlotValue("name", new Value((String) x.elementAt(0), RU.ATOM));
> ...
> rete.assertFact(f);
>
>
> >
> > 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
> >
>
> Indeed, if the ONLY purpose of the family facts is so that you can
> then extract the data and pass it back to java, it would be more
> sensible to simply pass it back directly.
>
>
> > > 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..
> >
>
> This is the kind of thing we can easily work out together here.
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Distributed Systems Research        Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> Org. 8920, MS 9012                  [EMAIL PROTECTED]
> PO Box 969                  http://herzberg.ca.sandia.gov
> Livermore, CA 94550
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to