JESS: Ranking facts

2007-11-27 Thread Jan Willem Lokin
Hi, Consider the following situation. I have asserted quite a number of facts, with various values for their slots. Now I want to select a limited number of facts that are most suitable, according to some user-defined criterion. My idea was to set up a defquery and then use Java sorting to order

Re: JESS: Ranking facts

2007-11-27 Thread Wolfgang Laun
Maybe this is coming close to what you want. ; your fact template (deftemplate Fact (slot id)(slot a)(slot b)(slot c)) ; supposed to contain the rating functions for the slot values (deftemplate Func (slot fa)(slot fb)(slot fc)) ; the computed ranking for a fact (deftemplate Rank (slot r)(slot

Re: JESS: Ranking facts

2007-11-27 Thread Jason Morris
Hi Jan, Couldn't you simply write one or more rules that place matching fact bindings into an arbitrary collection class? I'm assuming that you are filtering only on one type of fact. For example: (clear) (import java.util.ArrayList) (watch all) (deftemplate somefact (slot x) (slot y)

Re: JESS: Ranking facts

2007-11-27 Thread Robert Kirby
Facts can be selected in rank order with a defquery and a Java collection. (deftemplate sample Sample facts to be ranked (declare (ordered FALSE)) (slot primary (type INTEGER) (default 0)) (slot secondary (type INTEGER)) (slot stuff) ) (defquery sample-query Query for