First you'll need a function/static method that calculates distance. I would then determine this for ever cross product combination - make sure this distance fact references both objects.

Once you have determined all distances and inserted the facts representing this you can "not" method a custom accumulator or possible collect to keep retracting distance facts until you only have 10 left - the banking example shows how to restrict on number ranges.

Hopefully that should give you enough hints, when you are finished maybe you could post the solution to the mailing list and also the wiki.

Mark
thomas kukofka wrote:
Hello,

I have 1 Object of Type "A"
with a position (x,y) and n Objects of type "B" with postions (x,y) respectively.

I want to write a rule which gets 1 Object type "A" and more than 10 Objects of Type "B" as input facts. The rule should determine 10 of the Objects of type "B" which are nearest to the Object of type "B".

I would appreciate any help!

Regards
Thomas

_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users