Discussion:
Check for overlapping dates
Brian Enderle
2007-08-29 20:50:39 UTC
Permalink
I have a situation where I need to check for overlapping dates in a collection
of previous addresses. I am only performing this check after checking that
the beginDate and endDate are not null.

Currently I am using an eval to perform an outside method. Does anyone know
if and how I could perform this same check using Drools.

Curently my rules look something like this

gloabl java.lang.Boolean dateErrorExists; // starts off as false
global ValidationUtils utils;

rule "beginDate must exist"
when
Address ( beginDate != null )
then
dateMissing = true;
<display error>
end

rule "endDate must exist"
when
Address ( endDate != null )
then
dateMissing = true;
<display error>
end

rule "Previous Address dates cannot overlap"
salience -10
when
eval (dateMissing)
eval (utils.doAddressDatesOverlap())
then
<display error>
end

Our system simply runs thru the data checking the rules (no facts are changed)
so the dateMissing global is reset to false everytime we perform our
validation.

The downside to this is I am having to re-get the data from the DB within the
doAddressDatesOverlap() function. This function orders the Address objects by
their startDates and then compares the endDate of one with the startDate of
the next and returns false if they overlap.

If anyone knows of a cleaner, simpler or better way to perform this check
within Drools I would appreciate the input.

Thanks in advance,
Brian Enderle
Edson Tirelli
2007-08-29 22:55:38 UTC
Permalink
It all depends on how many simultaneous instances you have in your
working memory. If you have just a few instances, a simple and single rule
can handle your case... you don't need to check for nulls, unless you want
to explicitly handle them:

rule "Overlapping Dates"
when
$a : Address ( )
$b : Address ( this != $a, beginDate > $a.beginDate, beginDate <
$a.endDate )
then
// $a and $b overlap
end

Now, I had to do the same thing for a system that handled telecom calls
and we had hundreds of thousands of call objects at once in the working
memory. As you may be aware, rules like the one above have the potential to
generate combinatorial explosions. In my case, I created a high performance
data structure to index the dates and detect the overlaps and used the rules
only to drive the execution (of course, there were hundreds of other rules
doing other things too). This way I avoided the combinatorial explosion.

Hope it helps.

Edson
Post by Brian Enderle
I have a situation where I need to check for overlapping dates in a collection
of previous addresses. I am only performing this check after checking that
the beginDate and endDate are not null.
Currently I am using an eval to perform an outside method. Does anyone know
if and how I could perform this same check using Drools.
Curently my rules look something like this
gloabl java.lang.Boolean dateErrorExists; // starts off as false
global ValidationUtils utils;
rule "beginDate must exist"
when
Address ( beginDate != null )
then
dateMissing = true;
<display error>
end
rule "endDate must exist"
when
Address ( endDate != null )
then
dateMissing = true;
<display error>
end
rule "Previous Address dates cannot overlap"
salience -10
when
eval (dateMissing)
eval (utils.doAddressDatesOverlap())
then
<display error>
end
Our system simply runs thru the data checking the rules (no facts are changed)
so the dateMissing global is reset to false everytime we perform our
validation.
The downside to this is I am having to re-get the data from the DB within the
doAddressDatesOverlap() function. This function orders the Address objects by
their startDates and then compares the endDate of one with the startDate of
the next and returns false if they overlap.
If anyone knows of a cleaner, simpler or better way to perform this check
within Drools I would appreciate the input.
Thanks in advance,
Brian Enderle
_______________________________________________
rules-users mailing list
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
Marcos Tengelmann
2007-08-30 00:39:21 UTC
Permalink
Hi,

I am using the 29/aug snapshot of drools (4.0.1).

During the PackageBuilder.addPackgeFromDrl(Reader) I am getting the
following exception:
Caused by: java.lang.NoSuchMethodError:
org.antlr.runtime.DFA.unpackEncodedString(Ljava/lang/String;)[S

at org.drools.lang.DRLParser.<clinit>(DRLParser.java:7302)

at org.drools.compiler.DrlParser.getParser(DrlParser.java:204)

at org.drools.compiler.DrlParser.parse(DrlParser.java:60)

at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:156
)

at
br.com.auster.rules.AbstractRulesEngineProcessor.addPackages(AbstractRulesEn
gineProcessor.java:349)

at
br.com.auster.rules.AbstractRulesEngineProcessor.init(AbstractRulesEnginePro
cessor.java:254)

at
br.com.auster.rules.InvoiceRulesEngineFilter.configureEngine(InvoiceRulesEng
ineFilter.java:201)

at
br.com.auster.rules.InvoiceRulesEngineFilter.configure(InvoiceRulesEngineFil
ter.java:136)

.....

... 4 more



Any ideas of what could be happening?





<http://www.auster.com.br/> Solution <http://www.auster.com.br/> is
our Business


Marcos Tengelmann
Relações Comerciais Auster Solutions do Brasil
Avenida Ibirapuera 2120, cj 224
***@auster.com.br
tel:
fax:
mobile:
Skype ID: 5052-8535
<http://www.plaxo.com/click_to_call?src=jj_signature&To=5052-8535&Email=marc
***@auster.com.br>
5052-6711
9139.7983
<http://www.plaxo.com/click_to_call?src=jj_signature&To=9139.7983&Email=marc
***@auster.com.br>
mtengelmann


Want to always have my latest info?
<https://www.plaxo.com/add_me?u=21475157331&v0=620798&k0=16779217&v1=620799&
k1=1001594622&src=client_sig_212_1_banner_join&invite=1> Want a
signature like
<http://www.plaxo.com/signature?src=client_sig_212_1_banner_sig> this?
Edson Tirelli
2007-08-30 12:10:25 UTC
Permalink
A wrong version of antlr-runtime jar, maybe?

[]s
Edson
Post by Marcos Tengelmann
Hi,
I am using the 29/aug snapshot of drools (4.0.1).
During the PackageBuilder.addPackgeFromDrl(Reader) I am getting the
org.antlr.runtime.DFA.unpackEncodedString(Ljava/lang/String;)[S
at org.drools.lang.DRLParser.<clinit>(
*DRLParser.java:7302*)
at org.drools.compiler.DrlParser.getParser(
*DrlParser.java:204*)
at org.drools.compiler.DrlParser.parse(
*DrlParser.java:60*)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(
*PackageBuilder.java:156*)
at br.com.auster.rules.AbstractRulesEngineProcessor.addPackages(
*AbstractRulesEngineProcessor.java:349*)
at br.com.auster.rules.AbstractRulesEngineProcessor.init(
*AbstractRulesEngineProcessor.java:254*)
at br.com.auster.rules.InvoiceRulesEngineFilter.configureEngine(
*InvoiceRulesEngineFilter.java:201*)
at br.com.auster.rules.InvoiceRulesEngineFilter.configure(
*InvoiceRulesEngineFilter.java:136*)
.....
... 4 more
Any ideas of what could be happening?
<http://www.auster.com.br/> Solution is our Business<http://www.auster.com.br/>
*Marcos Tengelmann*
*Relações Comerciais* *Auster Solutions do Brasil*
Skype ID: 5052-8535
5052-6711
9139.7983
mtengelmann
Want to always have my latest info?<https://www.plaxo.com/add_me?u=21475157331&v0=620798&k0=16779217&v1=620799&k1=1001594622&src=client_sig_212_1_banner_join&invite=1> Want
a signature like this?<http://www.plaxo.com/signature?src=client_sig_212_1_banner_sig>
_______________________________________________
rules-users mailing list
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
Marcos Tengelmann
2007-08-30 23:06:34 UTC
Permalink
Edson.

As usual....You are right.

The God and Evil maven transitivy dependency...




<http://www.auster.com.br/> Solution <http://www.auster.com.br/> is
our Business


Marcos Tengelmann
Relações Comerciais Auster Solutions do Brasil
Avenida Ibirapuera 2120, cj 224
***@auster.com.br
tel:
fax:
mobile:
Skype ID: 5052-8535
<http://www.plaxo.com/click_to_call?src=jj_signature&To=5052-8535&Email=marc
***@auster.com.br>
5052-6711
9139.7983
<http://www.plaxo.com/click_to_call?src=jj_signature&To=9139.7983&Email=marc
***@auster.com.br>
mtengelmann


Want to always have my latest info?
<https://www.plaxo.com/add_me?u=21475157331&v0=620798&k0=16779217&v1=620799&
k1=1001594622&src=client_sig_212_1_banner_join&invite=1> Want a
signature like
<http://www.plaxo.com/signature?src=client_sig_212_1_banner_sig> this?


_____

From: rules-users-***@lists.jboss.org
[mailto:rules-users-***@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: quinta-feira, 30 de agosto de 2007 09:10
To: Rules Users List
Subject: Re: [rules-users] Problems During addPackageFromDrl



A wrong version of antlr-runtime jar, maybe?

[]s
Edson


2007/8/29, Marcos Tengelmann <***@auster.com.br
<mailto:***@auster.com.br> >:

Hi,

I am using the 29/aug snapshot of drools (4.0.1).

During the PackageBuilder.addPackgeFromDrl(Reader) I am getting the
following exception:
Caused by: java.lang.NoSuchMethodError:
org.antlr.runtime.DFA.unpackEncodedString(Ljava/lang/String;)[S

at org.drools.lang.DRLParser.<clinit>(

DRLParser.java:7302)

at org.drools.compiler.DrlParser.getParser(

DrlParser.java:204)

at org.drools.compiler.DrlParser.parse(

DrlParser.java:60)

at org.drools.compiler.PackageBuilder.addPackageFromDrl(

PackageBuilder.java:156)

at br.com.auster.rules.AbstractRulesEngineProcessor.addPackages(

AbstractRulesEngineProcessor.java:349 )

at br.com.auster.rules.AbstractRulesEngineProcessor.init(

AbstractRulesEngineProcessor.java:254 )

at br.com.auster.rules.InvoiceRulesEngineFilter.configureEngine(

InvoiceRulesEngineFilter.java:201 )

at br.com.auster.rules.InvoiceRulesEngineFilter.configure(

InvoiceRulesEngineFilter.java:136 )

.....

... 4 more



Any ideas of what could be happening?





<http://www.auster.com.br/> Solution is our
<http://www.auster.com.br/> Business



Marcos Tengelmann
Relações Comerciais Auster Solutions do Brasil
Avenida Ibirapuera 2120, cj 224
***@auster.com.br <mailto:***@auster.com.br>

tel:
fax:
mobile:
Skype ID: 5052-8535
<http://www.plaxo.com/click_to_call?src=jj_signature&To=5052-8535&Email=marc
***@auster.com.br>
5052-6711
9139.7983
<http://www.plaxo.com/click_to_call?src=jj_signature&To=9139.7983&Email=marc
***@auster.com.br>
mtengelmann



Want to always have my latest info?
<https://www.plaxo.com/add_me?u=21475157331&v0=620798&k0=16779217&v1=620799&
k1=1001594622&src=client_sig_212_1_banner_join&invite=1> Want a
signature like
<http://www.plaxo.com/signature?src=client_sig_212_1_banner_sig> this?



_______________________________________________
rules-users mailing list
rules-***@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
Manukyan, Sergey
2007-08-30 12:38:14 UTC
Permalink
Folk,



How can I get a nightly build of 4.0.1...? Or are you still on track to
make a release this week?



Thanks,



-Sergey







**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
Mark Proctor
2007-08-30 13:07:44 UTC
Permalink
we have only two issues left, related to IDE, code completion and break
points for MVEL. We really want to get those fixed today, so we can
release, but it's proving hard to nail those down, fix one thing and it
breaks another. I have IDE development :(

But you can get a snapshot release from here:
http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules

Mark
Post by Manukyan, Sergey
Folk,
How can I get a nightly build of 4.0.1...? Or are you still on track
to make a release this week?
Thanks,
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
https://lists.jboss.org/mailman/listinfo/rules-users
T***@expeditors.com
2007-08-30 15:48:40 UTC
Permalink
Mark,

Is there any change in the 4.01 snapshot eclipse plug-in in this release?
More specifically, is it compatible with eclipse 3.3? Thanks,


Best Regards,
Tim Nguyen




Mark Proctor
<***@codehau
s.org> To
Sent by: Rules Users List
rules-users-bounc <rules-***@lists.jboss.org>
***@lists.jboss.or cc
g
Subject
Re: [rules-users] release 4.0.1
08/30/2007 06:07
AM


Please respond to
Rules Users List
<rules-***@list
s.jboss.org>






we have only two issues left, related to IDE, code completion and break
points for MVEL. We really want to get those fixed today, so we can
release, but it's proving hard to nail those down, fix one thing and it
breaks another. I have IDE development :(

But you can get a snapshot release from here:
http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules

Mark
Manukyan, Sergey wrote:
Folk,

How can I get a nightly build of 4.0.1…? Or are you still on track to
make a release this week?

Thanks,

-Sergey





**********************
** LEGAL DISCLAIMER **
**********************

This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.





_______________________________________________
rules-users mailing list
rules-***@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Mark Proctor
2007-08-30 16:11:19 UTC
Permalink
no as I said 4.0.1 will not work with eclipse 3.3.
Post by T***@expeditors.com
Mark,
Is there any change in the 4.01 snapshot eclipse plug-in in this release?
More specifically, is it compatible with eclipse 3.3? Thanks,
Best Regards,
Tim Nguyen
Mark Proctor
s.org> To
Sent by: Rules Users List
g
Subject
Re: [rules-users] release 4.0.1
08/30/2007 06:07
AM
Please respond to
Rules Users List
s.jboss.org>
we have only two issues left, related to IDE, code completion and break
points for MVEL. We really want to get those fixed today, so we can
release, but it's proving hard to nail those down, fix one thing and it
breaks another. I have IDE development :(
http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules
Mark
Folk,
How can I get a nightly build of 4.0.1…? Or are you still on track to
make a release this week?
Thanks,
-Sergey
**********************
** LEGAL DISCLAIMER **
**********************
This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.
_______________________________________________
rules-users mailing list
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
https://lists.jboss.org/mailman/listinfo/rules-users
Loading...