[rules-users] Partial Unification / Derivation of Facts?

Wolfgang Laun wolfgang.laun at gmail.com
Tue Sep 27 14:12:11 EDT 2011


You insert some A(), and you can't match an A unless it has been
inserted and is in working memory.

I can't follow you here any more - sometimes things appear to depend
on the rule alone; sometimes (as below) an inserted A is a function of
a matched Param1(). It's impossible to understand things if they
aren't fully put on the table.

-W


On 27 September 2011 18:55, JohnnyCaimbridge <nbower at nycm.com> wrote:
> How would I go about implementing the first part to your solution? (where you
> say "if it is the 'matching' rule that defines the parameter set you can
> define the parameters literally in that rule")
>
> I am not aware of any syntax that would permit this type of behavior--that
> would allow me to (in the matching rule's condition) literally define the
> values the rules deriving "A" should use, instead of the deriving rule
> matching it against working memory (ie to indicate from the matching rule
> that the derivation rule should always use a certain value as a condition
> rather than matching against working memory).
>
> Given:
> rule "derivation rule"
> when
>   $prm1 : Param1()
> then
>  insert( new A($prm1) );
> end
>
> , the following indicates that working memory should be pattern matched for
> an "A" with getParam1() == new Param1("val").  Of course, this is not my
> desired functionality:
> rule "matching rule 1"
> when
>   A( param1 == new Param1("val") )
> then
>   // do w/e
> end
>
> What I would like to see is--given the "derivation rule" above--something
> like this:
> rule "matching rule 2"
> when
>   $a : A( param1 := new Param1("val") )
> then
>  // do something with $a
> end
>
> ^ Ideally this would tell the rule "derivation rule" to attempt to derive
> A(), but under the assumption that param1 should be initialized with "new
> Param1("val")" as opposed to strictly matching for it in WM.  However, the
> more I look at this, more it seems like backward chaining is necessary...
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/Partial-Unification-Derivation-of-Facts-tp3372546p3373242.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list