Removing Child Class Objects in dsl file level
by Rajesh.Sachin10
My Code has the following Hierarchy. I am facing some problem, while I try to
remove the Child level class object in .dsl file level.
Class1:
public class Class1{
private Class2 class2;
//getter & setters for class2
}
Class2:
public class Class2{
Private Class3 class3;
//getter & setters for class3
}
Class3:
public class Class3{
Object[] class4;
//getter & setters for class4
}
Class4:
public class Class4{
private String variable;
//getter & setters for variable
}
I will get only the object of Class1 in dsl level. When I try to remove the
variable in Class4, I am facing some problem. I need to iterate the variable
in Class4 and check weather all the values in the list of variable are same.
workingMemory.assertObject(class1); // in test class
I was not suppose to assert the object of Class2 or Class3 or Class4.
[when]Some English Text = Class1(cl2 : class2) //in .dsl
file
[then]Log "{message}"=System.out.println("{message}"); //in .dsl file
I tried the above code. But I can remove only the Class2 from Class1. I
can’t remove the Class3 from Class2 & Class4 from Class3 for futher
iteration.
Can some one help me on this issue?
Thanks.
--
View this message in context: http://www.nabble.com/Removing-Child-Class-Objects-in-dsl-file-level-tf37...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
using homemade Date in Drools
by Maxime Catelin
Hi,
We are using a lot of Dates in our application but we use a homemade
Date class for that. Therefore, we cannot use > and < provided by
Drools. I looked through the mailing list but could not find any
examples using Dates in Drools other than in the documentation. What
interested me in particular in the documentation was "If more control is
required, use the predicate constraint."
Could someone give some examples of using predicate constraint with dates?
Something I would like to do, for example, is the following :
If there is an obj1 of class A with field of type Date d1 and another
obj2 of class A with field Date d2, where d1 is before d2, obj2 should
be used to fire something.
rule XXX
when
obj : A( $date : mydate)
// do not know how to use constraint on date here.
then
// something
obj.doSomething();
end
Thanks for your input.
17 years, 6 months
Drools with data base
by kranthikumar dalai
Hi to all,
We are using drools with spring integration and with
semantic module as java in our project Leave application. Actually we want
to know, when we are Entering data at the user side then it has to seach the
data base and it has to give the validation. We are using Spring integration
for data access. And we know that, if we want data to be retrived through
drl file requires DAO object. But we couldn't get any example to go through.
So please can we have any real time example.
Regards:
Kranthi dalai
17 years, 6 months
Which rules are "passed" by object
by Aeternitas
Hello,
I have collection of objects. I fire all rules for then and after this I
want to know which rules were passed (or were not passed). I can't throw an
Exception in rule's body, because in this case I will know only the first
passed rule, and only for first object which passed it.
Another solution I found - to add one more field, which will show what I
need... But maybe there is better solution. Does Drools provide such kind of
information?
Thanks,
Max
--
View this message in context: http://www.nabble.com/Which-rules-are-%22passed%22-by-object-tf3788713.ht...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 6 months
Re: Query Regarding Facts Pattern
by Mark Proctor
Jagaran,
It's important that the mailing lists are used correctly, if we allow
user questions to continue on the dev list it creates noise and
confusion and will result in some devs unsubscribing - they purposefuly
subscribe to only the dev list, so they don't have to see user questions.
Btw the sarcasm is really going to make me, and other core devs, want to
help you.
Mark
jagaran_das(a)yahoo.co.in wrote:
> Thanks Mark..
> It was very nice to receive your mail.
> Regards
> Jagaran
> Mark Proctor wrote:
>
>> Thats a user question, please ask it on the user mailing list.
>>
>> Mark
>> JAGARAN wrote:
>>
>>> Hi,
>>> Suppose I want to add a business rules in JBRMS.
>>> Now I need facts pattern to be chosen.
>>> I need to select a fact type for that.
>>> But its not showing any option for that.
>>> Please let me know how to get such options.
>>> And also do I need to upload a event model for the application I am
>>> trying
>>> to implement rules.
>>> If yes how would be that.
>>> Thanks in Advance.
>>>
>>> Regards
>>> JAGARAN
>>>
>>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>>
> Quoted from:
> http://www.nabble.com/Query-Regarding-Facts-Pattern-tf3788621.html#a10724053
>
>
>
17 years, 6 months
RE: rules-users Digest, Vol 6, Issue 49
by Sikkandar Nawabjan
Hi,
I beleive rule engine is a system which is used in Business Layer,and it is meant to validate the business rules in the application. The data accessing stuff arre related to data layer.
In your situation you cann use the DAO to access the databaseand read the particular employee details and VALIDATE through drools.
connecting drl file to database creating a model problem i guess.
any suggestions Edson?
Thanks and Regs,
Basha
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Hi
I am using Drools 3.0 in our business logic. I need help in the below situation
Right now i am done with writing .drl files.but the problem is that my rules should be read from the Database.
For example i have to write rule for a leave application.I am using Drools 3.0 and writing rules.In case if i want to know the joining date of a particular employee,i should be able to read that from the database.
Not only this case but should be able to connect the .drl file to the database and also should be able to prepare a decision table.
I request u to respond to my query as early as possible.Please understand the situation and do the needful
Thanks,
mary
________________________________
From: rules-users-bounces(a)lists.jboss.org on behalf of rules-users-request(a)lists.jboss.org
Sent: Mon 5/21/2007 11:18 PM
To: rules-users(a)lists.jboss.org
Subject: rules-users Digest, Vol 6, Issue 49
Send rules-users mailing list submissions to
rules-users(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
rules-users-request(a)lists.jboss.org
You can reach the person managing the list at
rules-users-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. Re: using homemade Date in Drools (Maxime Catelin)
2. Re: using homemade Date in Drools (Mark Proctor)
3. Which rules are "passed" by object (Aeternitas)
4. (no subject) (suma latha)
----------------------------------------------------------------------
Message: 1
Date: Mon, 21 May 2007 18:10:54 +0200
From: Maxime Catelin <mcatelin(a)perinfo.com>
Subject: Re: [rules-users] using homemade Date in Drools
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID: <4651C48E.7000300(a)perinfo.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Thank you all for your insights. Your explanations are really helpful.
Regards.
>
> Yes, Shahad's suggestion shall work, but answering your first
> question, a predicate would be like:
>
> rule XXX
> when
> obj1 : A( $date1: mydate)
> obj2 : A( $date2: mydate -> ( $date1.isBefore($date2) ) )
> then
> // something
> obj1.doSomething();
> End
>
> Remember that predicates and evals use plain java code inside it.
>
> []s
> Edson
>
>
> 2007/5/21, Shahad Ahmed < shahad.ahmed2(a)gmail.com
> <mailto:shahad.ahmed2@gmail.com>>:
>
> How about a slight modification on Mike's solution:
>
> rule XXX
> when
> obj1 : A( $date1: mydate)
> obj2 : A( $date2: mydate)
> eval($date1.isBefore($date2))
> then
> // something
> obj1.doSomething();
> End
>
> I think eval allows you access to the methods in your custom Date
> class so you can call isBefore in there after binding $date1 and
> $date 2 to any custom date objects. I still new to Drools, so this
> may not be correct.
>
> Regards
> Shahad
>
>
> On 5/21/07, *Maxime Catelin* <mcatelin(a)perinfo.com
> <mailto:mcatelin@perinfo.com>> wrote:
>
> Thanks for your input. That seems to involve some
> modifications, on our
> Date class and all the classes that have Date members. That's
> not
> exactly what i thought of doing but maybe that's the only way.
>
> What I meant was to to find a way to compare those dates
> eventually
> using the date methods we have (isAfter() or isBefore() for
> exemple) and
> to "keep" only the object with the latest date. So if there
> are several
> A objects in the working memory, we will only fire the one
> with the
> latest date.
>
> rule XXX
>
> when
> obj : A( $date : mydate)
> not A( $date.isBefore(mydate)) // does not work but that
> what i was thinking
> then
> // something
> obj.doSomething();
> end
>
>
>
> Anstis, Michael (M.) a écrit :
> > The simplest way could be to have your Date expose a "Time"
> type member
> > (like java.util.Date.getTime()) that represents the number of
> > seconds\milliseconds etc since a given point in time ("your
> absolute
> > zero" for example; being day * month * year * H * M * s *
> ms). This
> > could then be used as a simple predicate condition:-
> >
> > rule XXX
> > when
> > obj1 : A( $time : myTime)
> > obj2 : A( myTime < $time )
> > then
> > // something
> > obj.doSomething();
> > End
> >
> > Thanks,
> >
> > Mike
> >
> > -----Original Message-----
> > From: rules-users-bounces(a)lists.jboss.org
> <mailto:rules-users-bounces@lists.jboss.org>
> > [mailto:rules-users-bounces@lists.jboss.org
> <mailto:rules-users-bounces@lists.jboss.org> ] On Behalf Of
> Maxime Catelin
> > Sent: 21 May 2007 14:34
> > To: Rules Users List
> > Subject: [rules-users] using homemade Date in Drools
> >
> > Hi,
> >
> > We are using a lot of Dates in our application but we use a
> homemade
> > Date class for that. Therefore, we cannot use > and <
> provided by
> > Drools. I looked through the mailing list but could not find
> any
> > examples using Dates in Drools other than in the
> documentation. What
> > interested me in particular in the documentation was "If more
> control is
> >
> > required, use the predicate constraint."
> >
> > Could someone give some examples of using predicate
> constraint with
> > dates?
> >
> > Something I would like to do, for example, is the following :
> >
> > If there is an obj1 of class A with field of type Date d1 and
> another
> > obj2 of class A with field Date d2, where d1 is before d2,
> obj2 should
> > be used to fire something.
> >
> > rule XXX
> > when
> > obj : A( $date : mydate)
> > // do not know how to use constraint on date here.
> > then
> > // something
> > obj.doSomething();
> > end
> >
> > Thanks for your input.
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
> >
> >
> >
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @ www.jboss.com <http://www.jboss.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.467 / Virus Database: 269.7.6/813 - Release Date: 20/05/2007 07:54
>
------------------------------
Message: 2
Date: Mon, 21 May 2007 17:24:34 +0100
From: Mark Proctor <mproctor(a)codehaus.org>
Subject: Re: [rules-users] using homemade Date in Drools
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID: <4651C7C2.309(a)codehaus.org>
Content-Type: text/plain; charset="iso-8859-1"
Why not just make your class implement Comparable, and then it will work
with > and <.
Mark
Edson Tirelli wrote:
>
> Yes, Shahad's suggestion shall work, but answering your first
> question, a predicate would be like:
>
> rule XXX
> when
> obj1 : A( $date1: mydate)
> obj2 : A( $date2: mydate -> ( $date1.isBefore($date2) ) )
> then
> // something
> obj1.doSomething();
> End
>
> Remember that predicates and evals use plain java code inside it.
>
> []s
> Edson
>
>
> 2007/5/21, Shahad Ahmed < shahad.ahmed2(a)gmail.com
> <mailto:shahad.ahmed2@gmail.com>>:
>
> How about a slight modification on Mike's solution:
>
> rule XXX
> when
> obj1 : A( $date1: mydate)
> obj2 : A( $date2: mydate)
> eval($date1.isBefore($date2))
> then
> // something
> obj1.doSomething();
> End
>
> I think eval allows you access to the methods in your custom Date
> class so you can call isBefore in there after binding $date1 and
> $date 2 to any custom date objects. I still new to Drools, so this
> may not be correct.
>
> Regards
> Shahad
>
>
> On 5/21/07, *Maxime Catelin* <mcatelin(a)perinfo.com
> <mailto:mcatelin@perinfo.com>> wrote:
>
> Thanks for your input. That seems to involve some
> modifications, on our
> Date class and all the classes that have Date members. That's
> not
> exactly what i thought of doing but maybe that's the only way.
>
> What I meant was to to find a way to compare those dates
> eventually
> using the date methods we have (isAfter() or isBefore() for
> exemple) and
> to "keep" only the object with the latest date. So if there
> are several
> A objects in the working memory, we will only fire the one
> with the
> latest date.
>
> rule XXX
>
> when
> obj : A( $date : mydate)
> not A( $date.isBefore(mydate)) // does not work but that
> what i was thinking
> then
> // something
> obj.doSomething();
> end
>
>
>
> Anstis, Michael (M.) a écrit :
> > The simplest way could be to have your Date expose a "Time"
> type member
> > (like java.util.Date.getTime()) that represents the number of
> > seconds\milliseconds etc since a given point in time ("your
> absolute
> > zero" for example; being day * month * year * H * M * s *
> ms). This
> > could then be used as a simple predicate condition:-
> >
> > rule XXX
> > when
> > obj1 : A( $time : myTime)
> > obj2 : A( myTime < $time )
> > then
> > // something
> > obj.doSomething();
> > End
> >
> > Thanks,
> >
> > Mike
> >
> > -----Original Message-----
> > From: rules-users-bounces(a)lists.jboss.org
> <mailto:rules-users-bounces@lists.jboss.org>
> > [mailto:rules-users-bounces@lists.jboss.org
> <mailto:rules-users-bounces@lists.jboss.org> ] On Behalf Of
> Maxime Catelin
> > Sent: 21 May 2007 14:34
> > To: Rules Users List
> > Subject: [rules-users] using homemade Date in Drools
> >
> > Hi,
> >
> > We are using a lot of Dates in our application but we use a
> homemade
> > Date class for that. Therefore, we cannot use > and <
> provided by
> > Drools. I looked through the mailing list but could not find
> any
> > examples using Dates in Drools other than in the
> documentation. What
> > interested me in particular in the documentation was "If more
> control is
> >
> > required, use the predicate constraint."
> >
> > Could someone give some examples of using predicate
> constraint with
> > dates?
> >
> > Something I would like to do, for example, is the following :
> >
> > If there is an obj1 of class A with field of type Date d1 and
> another
> > obj2 of class A with field Date d2, where d1 is before d2,
> obj2 should
> > be used to fire something.
> >
> > rule XXX
> > when
> > obj : A( $date : mydate)
> > // do not know how to use constraint on date here.
> > then
> > // something
> > obj.doSomething();
> > end
> >
> > Thanks for your input.
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> > https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
> >
> >
> >
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
> <https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> Edson Tirelli
> Software Engineer - JBoss Rules Core Developer
> Office: +55 11 3529-6000
> Mobile: +55 11 9287-5646
> JBoss, a division of Red Hat @ www.jboss.com <http://www.jboss.com>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070521/3bbb2ef...
------------------------------
Message: 3
Date: Mon, 21 May 2007 00:26:27 -0700 (PDT)
From: Aeternitas <gotischerose(a)yahoo.de>
Subject: [rules-users] Which rules are "passed" by object
To: rules-users(a)lists.jboss.org
Message-ID: <10714262.post(a)talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hello,
I have collection of objects. I fire all rules for then and after this I
want to know which rules were passed (or were not passed). I can't throw an
Exception in rule's body, because in this case I will know only the first
passed rule, and only for first object which passed it.
Another solution I found - to add one more field, which will show what I
need... But maybe there is better solution. Does Drools provide such kind of
information?
Thanks,
Max
--
View this message in context: http://www.nabble.com/Which-rules-are-%22passed%22-by-object-tf3788713.ht...
Sent from the drools - user mailing list archive at Nabble.com.
------------------------------
Message: 4
Date: Mon, 21 May 2007 20:20:33 +0530 (IST)
From: suma latha <suma_shallin(a)yahoo.co.in>
Subject: [rules-users] (no subject)
To: rules-users(a)lists.jboss.org
Message-ID: <128057.6833.qm(a)web8510.mail.in.yahoo.com>
Content-Type: text/plain; charset="us-ascii"
Hi
I am using Drools 3.0 in our business logic. I need help in the below situation
Right now i am done with writing .drl files.but the problem is that my rules should be read from the Database.
For example i have to write rule for a leave application.I am using Drools 3.0 and writing rules.In case if i want to know the joining date of a particular employee,i should be able to read that from the database.
Not only this case but should be able to connect the .drl file to the database and also should be able to prepare a decision table.
I request u to respond to my query as early as possible.Please understand the situation and do the needful
Thanks,
mary
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070521/a137665...
------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
End of rules-users Digest, Vol 6, Issue 49
******************************************
17 years, 6 months
Problem
by Krishnan
Hi All,
I am using the 4.0.M2 version of jboss rules.
public class Device() {
private Boolean isCiscoVersion;
private Boolean sysNamePresent;
private Boolean isPixVersion;
}
When I write the rule as follows :-
rule "Cisco PIX Device"
when
d : Device ( isCiscoVersion == null,
sysNamePresent == true,
isPixVersion == true )
then
System.out.println("This is a cisco pix device.");
end
The rule works. However, when I write the same rule as
rule "Cisco PIX Device"
when
d : Device ( isCiscoVersion == false,
sysNamePresent == true,
isPixVersion == true )
then
System.out.println("This is a cisco pix device.");
end
It even fails to compile and add the rule into the package. Not sure what is
going on ?.
Following is the error I keep getting :-
java.lang.NullPointerException
at org.drools.reteoo.CompositeObjectSinkAdapter$HashKey.setValue(
CompositeObjectSinkAdapter.java:501)
at org.drools.reteoo.CompositeObjectSinkAdapter$HashKey.<init>(
CompositeObjectSinkAdapter.java:441)
at org.drools.reteoo.CompositeObjectSinkAdapter.hashSinks(
CompositeObjectSinkAdapter.java:158)
at org.drools.reteoo.CompositeObjectSinkAdapter.addObjectSink(
CompositeObjectSinkAdapter.java:72)
at org.drools.reteoo.ObjectSource.addObjectSink(ObjectSource.java:104)
at org.drools.reteoo.ObjectTypeNode.addObjectSink(ObjectTypeNode.java
:313)
at org.drools.reteoo.AlphaNode.attach(AlphaNode.java:116)
at org.drools.reteoo.builder.BuildUtils.attachNode(BuildUtils.java:129)
at org.drools.reteoo.builder.PatternBuilder.attachAlphaNodes(
PatternBuilder.java:119)
at org.drools.reteoo.builder.PatternBuilder.attachPattern(
PatternBuilder.java:71)
at org.drools.reteoo.builder.PatternBuilder.build(PatternBuilder.java
:55)
at org.drools.reteoo.builder.GroupElementBuilder$AndBuilder.build(
GroupElementBuilder.java:111)
at org.drools.reteoo.builder.GroupElementBuilder.build(
GroupElementBuilder.java:69)
at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(
ReteooRuleBuilder.java:143)
at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(
ReteooRuleBuilder.java:108)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:112)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:266)
at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java
:293)
at com.sample.CfiTest.readRule(CfiTest.java:71)
at com.sample.CfiTest.main(CfiTest.java:23)
Any ideas why this is happening ?.
-Krishnan.
--
Sivaramakrishna Iyer Krishnan (Anand)
Never assume the obvious is true.
- William Safire
17 years, 6 months