I tried something else, I replaced the '(not (and ...' stuff by
(defrule dep-per-class
(Assoc-per-class (class ?class) (child-class ?child-class))
(IMObject (OBJECT ?p&:(call ?p IsClass ?class)))
(not (IMAssociation (dependent ?p) (antecedent ?c)))
(not (IMObject (OBJECT ?c&:(call ?c IsClass ?child-class))))
=>
[...]
)
which 'improves' the situation that I get now exactly one object
attached to an A, but if I have defined that there must be a B and a C
attached to an A, i.e.
All A objects always depend on exactly one B
All A objects always depend on exactly one C
I get only one of them. Which makes sense in so far that the third
constraint will not match anymore if there is an IMAssociation e.g. A ->
B. Then I'l never get A -> C.
Btw. - is it possible that the initial posting got lost?
Thanks a lot,
tge
Thomas Gentsch wrote:
>
> Today is not a good day ... :~)
>
> I want to express the following:
> All A objects always depend on exactly one B (Assoc-per-class below)
>
> So I say:
> IF (such a fact as above exists)
> (there is an A)
> (there is no dependency at A ... pointing to whereever ...)
> (there is no B where the dependency above points to)
> THEN
> create an A and a dependency A -> B
>
> The IsClass method is a little cumbersome replacement for the CLIPS
> (is-a ?class) feature. Works OK otherwise.
>
> (defrule dep-per-class
> (Assoc-per-class (class ?class) (child-class ?child-class))
> (IMObject (OBJECT ?p&:(call ?p IsClass ?class)))
> (not (and (IMAssociation (dependent ?p) (antecedent ?c))
> (IMObject (OBJECT ?c&:(call ?c IsClass ?child-class)))))
> =>
> [...]
> )
>
> Now is there a logical mistake in my rule?
>
> What happens is that this rule keeps on firing and I get lots of B's
> attached to the A (actually I have to ^C it):
>
> FIRE 3 dep-per-class f-88, f-181,,
> FIRE 7 dep-per-class f-88, f-181, f-192,
> FIRE 11 dep-per-class f-88, f-181, f-200,
> FIRE 15 dep-per-class f-88, f-181, f-208,
> FIRE 19 dep-per-class f-88, f-181, f-216,
> FIRE 23 dep-per-class f-88, f-181, f-224,
> FIRE 27 dep-per-class f-88, f-181, f-232,
> FIRE 31 dep-per-class f-88, f-181, f-240,
> FIRE 35 dep-per-class f-88, f-181, f-248,
>
> FIRE 3 is OK, I think, but the other ones?
>
> Thanks a lot in adavance,
> 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]
---------------------------------------------------------------------