I think Thomas Gentsch wrote:
>
> Ummmm, no way to define the Java class in any way? Otherwise I'd have to
> touch all the rules ...
Well, if that's what you want to do, sure. You could change the String
property into a property of type jess.Value.
Let's see. The property would just look like
private Value m_val;
public Value getFoo() { return m_val; }
public void setFoo(Value val) {
Value tmp = m_val;
m_val = val;
pcs.firePropertyChange("foo", tmp,
m_val);
}
Rules that matched this property would just be normal rules. I
think modify calls would be pretty ugly, though, something like
(modify (fact-id 0)
(foo (new jess.Value "bar" (get-member jess.RU ATOM))))
>
> Thanks a lot,
> tge
>
> friedman_hill ernest j wrote:
> >
> > You can use str-cat to turn a symbol into a string:
> >
> > (defrule update-simple
> > ?f <- (The simple object ?id is ?val)
> > ?o <- (Simple (OBJECT ?s) (name ?&=(str-cat ?id)))
> > =>
> > ...
> > )
> >
> > I think Thomas Gentsch wrote:
> > >
> > > I have another one ... :~)
> > >
> > > When extending the 'Simple' example a little, I encountered a problem, I
> > > understand but have no idea yet, how to do it right.
> > >
> > > The class 'Simple' is defined as:
> > >
> > > public class Simple
> > > {
> > > private String m_name;
> > > ...
> > >
> > > Now, if I have a rule:
> > >
> > > (defrule update-simple
> > > ?f <- (The simple object ?id is ?val)
> > > ?o <- (Simple (OBJECT ?s) (name ?id))
> > > =>
> > > ...
> > > )
> > >
> > > I can only get the rule to fire if I assert a fact
> > > (The simple object \"bla\" is 100)
> > >
> > > i.e. with the id in double qoutes. Make sense, because then both are a
> > > string. But I want to match facts
> > > (The simple object bla is 100)
> > >
> > > Is there an elegant way to accomplish this? I experimented with m_name
> > > being of class jess.Value but couldn't get it to work.
> > >
> > > Many thanks,
> > > tge
> > >
> > > --
> > > Thomas Gentsch
> > >
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
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]
---------------------------------------------------------------------