-1

I am wondering if it is possible to write a jess function or rules to behave findall in Prolog.

For instance, we have a KB like

(person (name jason) (school nyu))
(person (name john) (school nyu))
(person (name liz) (school cmu))
...

and the input is (school nyu), we want to collect all the names of person like [jason,john]

Any comments would be appreciated!

repeat
  • 18,496
  • 4
  • 54
  • 166
youngtackpark
  • 1,475
  • 3
  • 12
  • 14

1 Answers1

0

You can write a rule like this using the accumulate CE, or you can write it as a function using a defquery. Neither approach is using a rule engine the way it's really intended to be used, though; best to write a rule which matches one such entity and acts on it, and then let the rule fire once for each match.

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186