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

JohnnyCaimbridge nbower at nycm.com
Tue Sep 27 12:55:50 EDT 2011


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.



More information about the rules-users mailing list