I wrote this rule for an expert system :
(defrule wild chicory
(attribute (name habitat) (value sea montain grassland unknown))
=>
(assert (plant "Cichorium_Intybus"))
)
However I don't want the habitat's value to match all of the values that I have given, but to only match at least one of values. I'm wondering how I should do this. I could do it so:
(defrule wild chicory
(or (attribute (name habitat) (value sea))
(attribute (name habitat) (value mountain))
(attribute (name habitat) (value grassland))
(attribute (name habitat) (value unknow))
)
=>
(assert (plant "Cichorium_Intybus"))
)
But I would like to know if there is a better solution. Thanks
If value is a single field slot, do it this way:
(defrule wild chicory
(attribute (name habitat) (value sea | mountain | grassland | unknown))
=>
(assert (plant "Cichorium_Intybus")))
If value is a multi field slot, do it this way:
(defrule wild chicory
(attribute (name habitat) (value $? sea | mountain | grassland | unknown $?))
=>
(assert (plant "Cichorium_Intybus")))