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