Thanks Wolfgang,
but i had solve already my problem.
My question was only about the duplication of /"nots/", that one has to
write in order to not duplicate facts. I handle the situation creating a
function that check if a list contains a specific element or set of
elements, without mind to the sequence.
Like for example you have a fact:
/(black-cars (id A B))/
and somewhere you have a rule that takes two cars, but then you enforce
that the cars cannot be black, like:
/(defrule ...
(car (id ?id1))
(car (id ?id2))
(not (black-black-cars (id ?id1 ?id2))/
..
now, if the matching variables get: ?id1=B, and ?id2=A, then the rule
will be fired, and the only way to avoid this is having another "/not/"
swaping the ids. This kind of solution becomes really confuse, if you
have a list of 3 or more elements. So, i implement a function that check
if a list contains a set of elements. My question in the mailing list
was only wondering if there was a more clean way to make this. It seems not.
Regards,
Joao
----------
unclassified
On 24-02-2009 09:39, Wolfgang Laun wrote:
Perhaps the discussion in
http://www.jessrules.com/jesswiki/view?PropertySet is useful for you.
-W
On Mon, Feb 23, 2009 at 6:11 PM, Wolfgang Laun
<[email protected] <mailto:[email protected]>> wrote:
On Mon, Feb 23, 2009 at 5:22 PM, Joao Antunes Mourao
<[email protected]
<mailto:[email protected]>> wrote:
Hello,
/(defrule get-black-cars
(car (id ?id1) (color "black"))
(car (id ?id2 &:(~= ?id1 ?id2)) (color "black"))
(and (not (black-cars (car-id ?id1 ?id2)) (not (black-cars
(car-id ?id2 ?id1)))
=>
(assert (black-cars (car-id ?id1 ?id2)))/
The second CE is better written as
(car (id ?id2 & ~?id1)) (color "black"))
My question is: There is a matching way of avoid this
comparison? The only thing i want to know is which are the
black cars, not the order.
You are talking of sets (in the mathematical sense). For the
general case you might consider using a java.util.Set as a
(non-multi-)slot value.
-W
------------------------------------------------------------------------------------------------------------
Disclaimer:
If you are not the intended recipient of this email, please notify the sender and delete it.
Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden.
Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s).
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------
begin:vcard
fn;quoted-printable:Jo=C3=A3o Mour=C3=A3o
n;quoted-printable;quoted-printable:Mour=C3=A3o;Jo=C3=A3o
org:Thales;Above Water Systems
adr:;;;Hengelo;;;Netherlands
email;internet:[email protected]
title:THALES NETHERLANDS B.V.
tel;work:2640
note:-unclassified mail-
version:2.1
end:vcard