Rather than examples, you might have posted the requirement itself,
i.e., whatever was in your mind when you composed the example and
the data. Is the number of matching attributes a, b, c, d the deciding
factor? What happens if the inserted fact matches a and b of list#1 and
c and d of list#2? And so on.
This *seems* to be a variation of what I call "classification problem", see
but it's hard to tell from the example.
-W
On 04/01/2014, merry0900 <m1e1r1r1y(a)163.com> wrote:
hello,here is my java code
main(){
MyPojo myPojo=new MyPojo();
myPojo.setA("aaa")
myPojo.setB("bbb")...
.
.
.
List<MyPojo> myPojos=getAllFromDb()// get all object by mybatis form
database ,and each one is different from another.
ksession.setGlobal("myPojos", myPojos);
ksession.insert(myPojo);
}
class MyPojo {
private Long id;
private String a;
private String b;
private String c;
private String d;
//getters;
//setters;
}
i want to write a drl file whitch can find a List<MyPojo> myPojoSub that
Each MyPojo From myPojoSub is come from myPojos and limited by some rules。
for example:
myPojos={{id:1,a:"kkk",b:"iii",c:"ppp"},{id:2,a:"kkk",b:"iii"},{id:3,a:"kkk"},{id:4,a:"kkk",b:"iii",c:"ooo"},{id:5,a:"mmm",b:"fff",c:"ttt"}}
and if there is a myPojo{a:kkk,b:"iii",c:"ppp"} then
{id:1,a:"kkk",b:"iii",c:"ppp"} from myPojos is a member of
myPojoSub
if there is a myPojo{a:kkk,b:"iii",c:"ttt"} then
{id:2,a:"kkk",b:"iii",}from myPojos is a member of myPojoSub
if there is a myPojo{a:kkk,b:"fff",c:"ttt"} then
{id:3,a:"kkk"}from myPojos
is a member of myPojoSub
if there is a myPojo{a:"lll",b:"fff",c:"ttt"} then
{id:5,a:"mmm",b:"fff",c:"ttt"}from myPojos is a member of
myPojoSub
if there is a myPojo{a:"ppp",b:"jjj",c:"zzz"} then no any
MyPojo from
myPojos is a member of myPojoSub
how do i write my drl rules? any one can help me or give some
suggestions? thank you
here is a rule file templet:
package com.test.tules;
import com.test.MyPojo;
import java.util.List;
globle List<com.test.MyPojo> myPojos;
rule "aaaaa"
salience 65523
when
then
--
View this message in context:
http://drools.46999.n3.nabble.com/write-a-rule-file-longest-matching-tp40...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users