I'm sure I should know this, but I really wasn't able to figure out was it wrong with this one rule:
This rule is suppose to fire in case no reference is pointing to the fact Design::Module
(defrule RemoveUnAssignedModules
(declare (auto-focus TRUE))
?mo <- (Design::Module (source ArchE))
(not (Design::ResponsibilityToModuleRelation (parent ?mo)))
=>
(retract ?mo)
)

another rule changes the reference in slot parent of Design::ResponsibilityToModuleRelation so that nothing is pointing to Design::Module anymore. Here the output from the watch command:
FIRE 1 Patterns::CreatePatternRefinementRelation f-4674, f-198, f-224, f-4723, f-4703, f-4704
Patterns::gen153: +1+1=1+2+t
==> f-4724 (Patterns::__query-trigger-gen153 <Fact-4704>)
<== f-4724 (Patterns::__query-trigger-gen153 <Fact-4704>)
<=> f-4706 (Design::ResponsibilityToModuleRelation (id nil) (source User) (parent <Fact-1329>) (child <Fact-4704>))
==> f-4725 (MAIN::ResponsibilityRefinementRelation (id nil) (source User) (parent <Fact-1264>) (child <Fact-4701>))
==> Activation: ManageResponsibilities::CheckInvalidDependencyToParent : f-4725, f-1277,
==> Activation: ManageResponsibilities::CheckInvalidDependencyToParent : f-4725, f-1276,
==> Activation: InitialModifiabilityDesign::ResponsibilityGotDecomposed : f-4725, f-1328, f-1330
<== Focus Patterns
==> Focus InitialModifiabilityDesign
==> f-4726 (Patterns::AdjustProperties <Fact-4725> <Fact-224> <Fact-1264>)
==> Activation: Patterns::CleanupAfterPatternInstantiation3 : f-4726
In the 4th line fact 4706 gets changed. here also the output from the matches command before and after the change (I removed the uninteresting matches):
BEFORE:
>>> [NodeNot2Single ntests=1 [Test2Simple: test=EQ;tokenIdx=0;leftIdx=-1;rightIdx=2] ;usecount = 1]
*** Left Memory:
[Token: size=1;sortcode=4705;tag=ADD;negcnt=1;facts=(Design::Module (costOfChange nil) (complexity nil) (name "(M) VariantPartForNew responsibility because of localization of scenario gen240") (source ArchE));]
*** RightMemory:
[Token: size=1;sortcode=4706;tag=ADD;negcnt=0;facts=(Design::ResponsibilityToModuleRelation (id nil) (source ArchE) (parent <Fact-4705>) (child <Fact-4704>));]
AFTER
>>> [NodeNot2Single ntests=1 [Test2Simple: test=EQ;tokenIdx=0;leftIdx=-1;rightIdx=2] ;usecount = 1]
*** Left Memory:
[Token: size=1;sortcode=4705;tag=ADD;negcnt=1;facts=(Design::Module (costOfChange nil) (complexity nil) (name "(M) VariantPartForNew responsibility because of localization of scenario gen240") (source ArchE));]
*** RightMemory:
[Token: size=1;sortcode=4706;tag=ADD;negcnt=0;facts=(Design::ResponsibilityToModuleRelation (id nil) (source User) (parent <Fact-1329>) (child <Fact-4704>));]

I attached the full output of the matches command. So, what is wrong?
Felix

Attachment: matches.rtf
Description: MS-Word document



Reply via email to