RE: [rules-users] rule using sliding window

2009-06-01 Thread Bhushan Bhangale
Thanks Edson

 

I read about "from" CE and understand that it can call any external method.
In the external method I can write the code to extract the data from
database.

 

I googled and found this, where its using hibernate session and that way
giving complete flexibility in writing rule on any data set. Do you think
it's a good idea?

 

global org.hibernate.Session hibernateSession;

 

rule "hibernate_from"

when

game:Game() from
hibernateSession.createQuery("select games from Player p where p.age >=
:age").setProperties( {"age" : 18 }).list()

then

System.out.println("The game "+game.getName() +"is
owned by "+game.getPlayers());

end

 

 

-Original Message-
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Monday, June 01, 2009 6:48 PM
To: Rules Users List
Subject: Re: [rules-users] rule using sliding window

 


   Hi

   The description you have bellow is ambiguous, so I can't give you a
definitive answer. But it seems to be that you don't need sliding windows
for that. Simple temporal operators will do.

> Secondly if the window is large and number of records coming in is high
then could there be a memory issue?
   Yes, Drools does not manages persistence by itself. So, if your design
must support more data than it would fit in your running environment memory,
you need to design a solution that comprises persistence.

> Also since every record is getting stored in database, can I not use the
database directly instead of sliding window?
   Yes, you can fetch data on demand from external sources, be it databases
or anything else. Look at the "from" CE.

[]s
Edson



2009/6/1 Bhushan Bhangale 

I am using Drools 5. I am struggling to write rule for this logic -

If a stock price changes more than 10% within an hour then report the
change.

I understand I have to use sliding window feature but unable to write the
rule.

For example I got an update for IBM stock @ 12:30 for price 100 and then
another update IBM stock @ 12:35 for price 111. Since the time difference is
within an hour and the change is also greater than 10% I want to report this
price change.

 

Stock class -

 

Public class Stock {

   Private String stock;

   Private double price;

   Private Date time;

   Private double priceChange;

   Private Boolean highlight;

}

 

 

rule "Stock Price change more than 10% within an hour"

 

when

 

then

set the priceChange attribute of Stock object

set highlight to true 

end

 

 

Secondly if the window is large and number of records coming in is high then
could there be a memory issue?

 

Also since every record is getting stored in database, can I not use the
database directly instead of sliding window?

 

Thanks

 


Mr. Bhangale Bhushan
Associate Manager
Kale Consultants Ltd.
 
bhushan_bhang...@kaleconsultants.com
tel:
 +91 (0)206 608
3777
  http://www.kaleconsultants.com 

 


 


 

 

 

Disclaimer: This email (including any attachments) is intended for the sole
use of the recipient/s and may contain material that is CONFIDENTIAL. Any
unauthorized disclosure / copying / distribution or forwarding of this
message 
or part is STRICTLY PROHIBITED. If you have erroneously received this
message,
please delete it immediately and notify the sender. No liability is assumed
for
any errors and/or omissions in the contents of this message. Information in 
this message that does not relate to the official business of this Company
shall be understood as neither given nor endorsed by it. If verification is
required please request a hard-copy version. 
 
To know more about Kale Consultants, visit www.kaleconsultants.com 
 
--
 
 

 


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




-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com




Disclaimer: This email (including any attachments) is intended for the sole
use of the recipient/s and may contain material that is CONFIDENTIAL. Any
unauthorized disclosure / copying / distribution or forwarding of this message
or part is STRICTLY PROHIBITED. If you have erroneously received this message,
please delete it immediately and notify the sender. No liability is assumed for
any errors and/or omissions in the contents of this message. Information in
this message that does not relate to the official business of this Company
shall be understood as neither given nor endorsed by it. If verification is
required please request a hard-copy version.

To know more about Kale Consultants, visit www.kaleconsultants.com

-=-=-=-=-

[rules-users] The Eclipse JDT Core jar is not in the classpath error

2009-06-01 Thread Chris Richmond
Hello,

 

I am using netbeans and ivy with Drools 5.  I have successfully named,
published the jars from drools to and could build my port of the stock
ticker application in netbeans, but when I try to run it, I get the
following error:

 

 

java.lang.NoClassDefFoundError: org/antlr/runtime/tree/TreeNodeStream

 

I have the antlr-runtime jar from the bin/lib on my classpath where I added
all the others, but it always fails at this line 

In loadRuleBase() in Broker.java of the stock ticker sample

 

builder.add( ResourceFactory.newInputStreamResource(
Broker.class.getResourceAsStream( RULES_FILE ) ),

ResourceType.DRL);.

 

 

Does anyone have any ideas what jar I might be missing if it's not the
antlr-runtime?

 

Thanks,


Chris

 

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


[rules-users] questions on guvnor and drools 5.0

2009-06-01 Thread Garner, Shawn
I was wondering if somebody can help me with some questions:

1) Is there any more detail on how to setup Guvnor with a database?
2) How do you use the test scenarios with complex object structures?
-eg Create a fact in working memory that has another Object in it which 
in turn has a list of Objects in it.
-Seems like any Fact in working memory is assumed to only have only 
primitive values like Strings or numbers.
-We would like a more depth of objects where objects have a deep 
relationship to other objects at least 2-4 levels deep.
3) Why add ruleflow-group to the rule definition instead of adding the rule to 
a ruleflow-group?  If the ruleflow-group is part of the rule then you can't use 
the same rule in multiple ruleflow-groups and leads to copy and maintaining the 
rule in two different spots.
4)  DSL seems to be very inconvenient to edit in a text box especially when it 
wraps.  Why not a table where you can add rows and each row is a translation.  
Also there are no examples how to do translation into Drools syntax that is 
multiple lines long and not just a single line.
5) Is Java 5 Type Enumerations supported?  I was assuming I'd get a list of 
values if a field was an Enumeration.
6) There seems to be a vast functionality difference between the Guvnor 
decision tables and examples that use spreadsheets.
7) Guvnor lost the ability to select variables for use in other statements.  
Functionality was in BRMS of drools 4.0.7
8) I was not able to insert a fact using a constructor that needed parameter 
values.  Seems like it assumes everything is a bean but I couldn't find this 
requirement stated in the documentation anywhere.  Examples in documentation 
show inserting facts with constructor parameters.
9) It would be nice when you upload a domain model jar that you could explore 
the objects and fields somehow.
10) When you write a rule using one particular editor it would be nice if you 
could switch to another editor. Switch between Guided, DSL, Technical, etc.
11) It seems hard to reorder the statements in a when or then block.  If I put 
them in the wrong order I have to delete them all.  Would be nice if a 
statement could be moved up or down.
12) When calling a method on an object the choices only showed me public 
methods that take in one parameter.  I had a method with two parameters and it 
wouldn't show me the method.  I had to do a DSL or custom drools statement to 
get around it.
13) Guvnor seems to limit the drools syntax.  I couldn't do a "from 
$collection" statement without a custom drools statement line.
14) It would be nice if I could declare a global dialect "java" for all the 
rules.
15) It would be nice to define an existing agenda-group as part of a 
ruleflow-group without adding the ruleflow-group on the rules in that 
agenda-group.

Thanks,
SG


-Message Disclaimer-

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to conn...@principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.


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


Re: [rules-users] Clarification regarding the use of Guvnor

2009-06-01 Thread Steve Ronderos
Andrew,

Looks like you are looking for drools-server to expose the rule engine via 
JSON.  I'm not an expert on the subject by any means, but try reading the 
documentation (embedded in the Guvnor documents 
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html_single/index.html#d0e1095
) and see if anyone else on the mail group knows more about it.

Good luck,

Steve Ronderos 



From:
Andrew Nguyen 
To:
rules-users@lists.jboss.org
Date:
06/01/2009 10:27 AM
Subject:
[rules-users] Clarification regarding the use of Guvnor
Sent by:
rules-users-boun...@lists.jboss.org



Hello all,

I am a very new Drools user and am trying to expose it as a web- 
service.  Due to my experience with Spring, I went ahead and 
implemented a basic rule engine and exposed it as a web service via 
Spring.  I am now looking at integrating it with Guvnor to allow non- 
computer people, who are domain experts, to modify the rules.  From 
what I have read in the v5 documentation, it sounds like Guvnor is 
intended as a complete solution to what I am trying to accomplish - 
i.e. it will handle the rule management as well as exposing the rule 
engine via JSON (or other interface).  But, when I have searched 
around the internet, Guvnor sounds like just a rule management 
component.

So, I pretty much have 3 questions:

* Is my current setup of Drools + Spring the best way to expose my 
rule engine to other applications?  (Specifically, a .NET/C# app...)
* Is Guvnor suitable for integrating into my system as only a rule 
management system?

Thanks!

--Andrew
--
Andrew Nguyen
Nguyen & Associates
Custom Software Development & IT Services
http://www.na-consulting.net
and...@na-consulting.net
858-225-7575

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


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


Re: [rules-users] String comparison question

2009-06-01 Thread Edson Tirelli
   Yes, comma in this case is cleaner, but && should work too. What error do
you see? What version of Drools are you using?

   []s
   Edson

2009/6/1 Greg Barton 

>
> Try a comma instead of &&
>
> WrapperClass( sentence matches ".*Alpha.*", sentence2 matches ".*Beta*.")
>
> --- On Mon, 6/1/09, Armaghan Mahmud  wrote:
>
> > From: Armaghan Mahmud 
> > Subject: Re: [rules-users] String comparison question
> > To: "Rules Users List" 
> > Date: Monday, June 1, 2009, 11:12 AM
> > Thanks for your reply Edson. What
> > if I want to test for multiple substrings in different
> > strings?
> >
> > For example, how can I find beta in sentence2?
> >
> > I tried to combine WrapperClass( sentence matches
> > ".*Alpha.*" && sentence2 matches
> > ".*Beta*.") but I got errors.
> >
> > Thanks,
> > Armaghan
> >
> > 2009/5/31 Edson Tirelli 
> >
> >
> >If the string you are looking for is a substring of
> > your sentence, you need to either use a regexp or an eval to
> > call for an indexOf-like method:
> >
> >
> > WrapperClass( sentence matches ".*Alpha.*" )
> >
> >[]s
> >Edson
> >
> >
> > 2009/5/31 Armaghan Mahmud 
> >
> >
> >
> >
> >
> > Hey guys,
> >
> > I read in a previous post that == in Drools 4.0.7 maps
> > to .equals() automatically. My situation required me to put
> > a String object into the working memory and do a comparison
> > on it to see if a particular word is in the passed String
> > sentence. Could anybody please guide me as to how to
> > approach this problem? Thanks in advance. Here's my
> > original code:
> >
> >
> >
> > rule "Find Alpha in a
> > sentence"
> > salience100
> > wrap: WrapperClass(Sentence == "Alpha")
> > then
> > System.out.println("Aha found
> > ya!");
> > end
> >
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> >
> >
> >
> > --
> >  Edson Tirelli
> >  JBoss Drools Core Development
> >  JBoss, a division of Red Hat @ www.jboss.com
> >
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
> >
> >
> >
> > -Inline Attachment Follows-
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] ClassCastException for Hibernate entity when rule is fired

2009-06-01 Thread Sobhana

hi, can someone please help with the below issue? Any tips or hints on what
could be causing this would be very helpful.

We are using Drools 4.0.7 and have a rule which uses a Hibernate entity
(SaleEventItem) and its related entity (Inventory). Some times, the
SaleEventItem passed as the fact has the Inventory lazy loaded and hence its
type is the Hibernate proxy - Inventory_$$_javassist_93. In this case, the
rule runs fine.
But at times, the SaleEventItem which is passed has the Inventory attribute
set explicitly and hence its type is Inventory itself. When the rule fires
in this case, it tries to assign the Inventory into
Inventory_$$_javassist_93 which causes this ClassCastException.

java.lang.ClassCastException: com.crom.data.pojo.Inventory incompatible with
com.crom.data.pojo.Inventory_$$_javassist_93
at ASMAccessorImpl_14985690421242774005070.getValue(Unknown Source)
at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
at
org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
at
org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:90)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:45)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:209)

How do we prevent this? Is it possible to somehow enforce that the type of
the variable in the rule should be Inventory and not
Inventory_$$_javassist_93? 

The rule is as follows.

dialect "java"
when
$sale:SaleEventItem(inventory != null,
$leaseInfo:inventory.leaseInformation != null,
   
$saleEventPrize:inventory.leaseInformation.residualPayAmount != null)
then

$sale.setStartPrice((Double)$sale.getInventory().getLeaseInformation().getResidualPayAmount());

Thanks,
Sobhana
-- 
View this message in context: 
http://www.nabble.com/ClassCastException-for-Hibernate-entity-when-rule-is-fired-tp23767583p23767583.html
Sent from the drools - user mailing list archive at Nabble.com.

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


Re: [rules-users] String comparison question

2009-06-01 Thread Greg Barton

Try a comma instead of &&

WrapperClass( sentence matches ".*Alpha.*", sentence2 matches ".*Beta*.")

--- On Mon, 6/1/09, Armaghan Mahmud  wrote:

> From: Armaghan Mahmud 
> Subject: Re: [rules-users] String comparison question
> To: "Rules Users List" 
> Date: Monday, June 1, 2009, 11:12 AM
> Thanks for your reply Edson. What
> if I want to test for multiple substrings in different
> strings?
>  
> For example, how can I find beta in sentence2?
> 
> I tried to combine WrapperClass( sentence matches
> ".*Alpha.*" && sentence2 matches
> ".*Beta*.") but I got errors. 
> 
> Thanks,
> Armaghan
>  
> 2009/5/31 Edson Tirelli 
> 
> 
>    If the string you are looking for is a substring of
> your sentence, you need to either use a regexp or an eval to
> call for an indexOf-like method:
> 
> 
> WrapperClass( sentence matches ".*Alpha.*" )
> 
>    []s
>    Edson
> 
> 
> 2009/5/31 Armaghan Mahmud 
> 
> 
> 
> 
> 
> Hey guys,
>  
> I read in a previous post that == in Drools 4.0.7 maps
> to .equals() automatically. My situation required me to put
> a String object into the working memory and do a comparison
> on it to see if a particular word is in the passed String
> sentence. Could anybody please guide me as to how to
> approach this problem? Thanks in advance. Here's my
> original code:
> 
>  
> 
> rule "Find Alpha in a
> sentence"
> salience100 
> wrap: WrapperClass(Sentence == "Alpha")
> then 
> System.out.println("Aha found
> ya!");
> end
>  
>  
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
> 
> 
> -- 
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
> 
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
> 
> 
> -Inline Attachment Follows-
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


  

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


Re: [rules-users] String comparison question

2009-06-01 Thread Armaghan Mahmud
Thanks for your reply Edson. What if I want to test for multiple substrings
in different strings?

For example, how can I find beta in sentence2?
I tried to combine WrapperClass( sentence matches ".*Alpha.*" && sentence2
matches ".*Beta*.") but I got errors.
Thanks,
Armaghan

2009/5/31 Edson Tirelli 

>
>If the string you are looking for is a substring of your sentence, you
> need to either use a regexp or an eval to call for an indexOf-like method:
>
> WrapperClass( sentence matches ".*Alpha.*" )
>
>[]s
>Edson
>
> 2009/5/31 Armaghan Mahmud 
>
>>   Hey guys,
>>
>> I read in a previous post that == in Drools 4.0.7 maps to .equals()
>> automatically. My situation required me to put a String object into the
>> working memory and do a comparison on it to see if a particular word is in
>> the passed String sentence. Could anybody please guide me as to how to
>> approach this problem? Thanks in advance. Here's my original code:
>>
>>
>> rule "Find Alpha in a sentence"
>> *
>>
>> salience
>> *100
>>
>> wrap: WrapperClass(Sentence == "Alpha")
>>
>> then
>>
>> System.out.*println*("Aha found ya!");
>>
>> end
>>
>>
>>
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: Re: Re: [rules-users] Re: Drools performance issue

2009-06-01 Thread Greg Barton

It's happening because the problem is hard. :)  It's quadratic on the average 
number of assignments per driver.  i.e. for each driver, you compare all of the 
assignments to each other, and you must do that for all drivers.  So you have ( 
(num drivers) * (average num assignments)^2 ) firings in the BEST case. (The 
rule you originally presented was pretty much the worst case, as you were 
matching ( (num drivers)^2 *(num trips)^2 ) )

That's also why the processing happens when you insert the second set: before 
that the rule doesn't trigger.

Now, if you don't need to compare trip assignments between drivers, you could 
just insert one driver plus their trips and fire the rules.  

But if you do want to throw everything in WM at once, you may be able to use 
this trick: to detect overlap, you can cut the number of conditions you've got 
in half, making things slightly better.  You only need to detect that the start 
or end of one of the trips is contained in another.  Also, is it possible to 
have a driverId attribute in your trip object?  That would eliminate the need 
to match on the driver object.  Using both you'd have this:

rule "Assignment Check"
when
  $ta1: TripVO();
  $ta2: TripVO(
ta1.driverId == driverId, 
ta1.startDtmUtc < startDtmUtc, 
ta1.endDtmUtc >= startDtmUtc
  );
then

Note the "ta1.startDtmUtc < startDtmUtc" instead of ta1.startDtmUtc <= 
startDtmUtc".  This ensures that you don't test the same two TripVOs twice.

Give this a try.  

--- On Mon, 6/1/09, jayadeva...@gmail.com  wrote:

> From: jayadeva...@gmail.com 
> Subject: Re: Re: Re: [rules-users] Re: Drools performance issue
> To: "Wolfgang Laun" 
> Cc: rules-users@lists.jboss.org
> Date: Monday, June 1, 2009, 8:34 AM
> Hi,
> 
> 
> 
> I noticed something interesting. The issue with
> memory is happening always while inserting the second set of
> objects into working memory! 
> 
> Earlier, I was insering the DriverVO's into WM
> and then inserting the AssignmentsVO, and the system was
> hanging while inserting the AssignmentsVO. Then I reversed
> the order of insertion and then the machine was hit while
> inserting the DriverVO's.
> 
> 
> 
> Does anyone know why this issue might be happening
> and how to overcome this?
> 
> 
> 
> Thanks in advance,
> 
> Jayadevan.
> 
> 
> 
> On Jun 1, 2009 6:51pm, jayadeva...@gmail.com wrote:
> 
> > Thanks W, 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > I tried it out ,But didn't get any
> performance improvement :( 
> 
> > 
> 
> > 
> 
> > The issue might be that I am inserting too many
> objects into working memory 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > jayadevan 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > On Jun 1, 2009 3:36pm, Wolfgang Laun
> wolfgang.l...@gmail.com> wrote:
> 
> > 
> 
> > 
> 
> > > The first two patterns pair each driver
> assignment with each trip -
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > which is quite a lot of work to do. (The
> infix "and" between the 2nd
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > and 3rd pattern doesn't change this.)
> Also, the field restriction
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > "tripId in ($tid)" is not the
> most efficient way.
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > Try this:
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > rule "Assignment Check"
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > when
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >   $creVo: DriverAssignVO($drId: driverId,
>   $tid1: tripId)
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >   $creVo: DriverAssignVO(driverId ==
> $drId, $tid2: tripId != $tid1)
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >   $trAsgn1: TripVO( tripId == $tid1,
> $startDtmUtc: startDtmUtc,
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > $endDtmUtc: endDtmUtc)
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >   $trAsgn2: TripVO( tripId == $tid2,
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >                  ((startDtmUtc
> >= $startDtmUtc && startDtmUtc  
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >                   (endDtmUtc >=
> $startDtmUtc && endDtmUtc  
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > then
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > >   System.out.println("TRIP ID: "
> + $crvo.getTripId());
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > end
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 

[rules-users] Web services integration for Drools Flow

2009-06-01 Thread Ajay.Gautam
Hello,

I am evaluating a few workflow engines for an up coming project. Drools flow is 
the first one I am looking at.

Question: Is there any existing web services integration with Drools Flow? 
Specifically:

1. ability to call a service (Similar to "Email" work item)
2. ability to trigger a flow based on web services input (listener)

I could write a web services wrapper around Drools Flow, but am wondering if 
there is an existing solution for it. A quick Google search did not reveal 
anything much.

PS: Not looking at jBPM - don't want to get into deploying and maintaining a 
J2EE container. For our (simple) purposes, something like tomcat would suffice.

Any pointers in the right direction would be greatly appreciated.

Thanks

Ajay
*Please note that my email address may have changed. For all
future correspondence, please use this address*


This
message (including any attachments) is confidential and/or
privileged. It is to be used by the intended recipients only. If
you have received it by mistake please notify the sender by return
e-mail and delete this message from your system. Any unauthorized
use or dissemination of this message in whole or in part is
strictly prohibited. Please note that e-mails are inherently
insecure and susceptible to change. The Royal Bank of Scotland
Group, plc ("RBS") and its US subsidiaries, and affiliates and
subsidiary undertakings, including but not limited to, RBS plc New
York and Connecticut Branches, RBS Securities Inc., ABN AMRO Bank
N.V. New York and Chicago Branches and, ABN AMRO Incorporated,
Citizens Financial Group, Inc. and RBS Citizens, N.A., shall not be
liable for the improper or incomplete transmission of the
information contained in this communication or Attachment nor for
any delay in its receipt or damage to your system. RBS does not
guarantee that the integrity of this communication has been
maintained nor that this communication is free of viruses,
interceptions or interference. RBS and its subsidiaries and
affiliates do not guarantee the accuracy of any email or
attachment, that an email will be received or that RBS or its
affiliates and subsidiaries will respond to an email.

RBS makes no representations that any information contained in this
message (including any attachments) are appropriate for use in all
locations or that transactions, securities, products, instruments
or services discussed herein are available or appropriate for sale
or use in all jurisdictions, or by all investors or counterparties.
Those who utilize this information do so on their own initiative
and are responsible for compliance with applicable local laws or
regulations.

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


[rules-users] Clarification regarding the use of Guvnor

2009-06-01 Thread Andrew Nguyen

Hello all,

I am a very new Drools user and am trying to expose it as a web- 
service.  Due to my experience with Spring, I went ahead and  
implemented a basic rule engine and exposed it as a web service via  
Spring.  I am now looking at integrating it with Guvnor to allow non- 
computer people, who are domain experts, to modify the rules.  From  
what I have read in the v5 documentation, it sounds like Guvnor is  
intended as a complete solution to what I am trying to accomplish -  
i.e. it will handle the rule management as well as exposing the rule  
engine via JSON (or other interface).  But, when I have searched  
around the internet, Guvnor sounds like just a rule management  
component.


So, I pretty much have 3 questions:

* Is my current setup of Drools + Spring the best way to expose my  
rule engine to other applications?  (Specifically, a .NET/C# app...)
* Is Guvnor suitable for integrating into my system as only a rule  
management system?


Thanks!

--Andrew
--
Andrew Nguyen
Nguyen & Associates
Custom Software Development & IT Services
http://www.na-consulting.net
and...@na-consulting.net
858-225-7575

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


Re: re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread Earnest Dyke
Wolfgang makes a good point. However, given the requirement that the value 
changes and is not truly static, I would recommend something like the following 
which, if your SearchParm loads the data from a persisted source you could 
change it's value without any code change.

Earnie!

package com.sample

rule "Test Rule"
   
when
SearchParam($searchName : searchName)
$person : Person(name == $searchName)
then
System.out.println(drools.getRule().getName() + " [" + $searchName + "] 
[" + $person.getName() + "]");
$person.setActivation(true);  
end

package com.sample;

public class Person {
private String name;
private Boolean activation;

public Person(String name, Boolean activation) {
this.name = name;
this.activation = activation;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Boolean getActivation() {
return activation;
}

public void setActivation(Boolean activation) {
this.activation = activation;
}

}
package com.sample;

public class SearchParam {
private String searchName;

public SearchParam(String searchName) {
super();
this.searchName = searchName;
}

public String getSearchName() {
return searchName;
}

public void setSearchName(String searchName) {
this.searchName = searchName;
}

}


package com.sample;

import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Properties;

import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
import org.drools.rule.Package;
import org.drools.rule.builder.dialect.java.JavaDialectConfiguration;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;


public class GlobalTest {
private RuleBase ruleBase;

@Test
public void testWithGlobal() {
StatefulSession ss = ruleBase.newStatefulSession();
Person p = new Person("John",false);
ss.insert(p);
SearchParam sp = new SearchParam("John");
ss.insert(sp);
ss.fireAllRules();
assertTrue(p.getActivation().equals(true));
}
@Before
public void buildRules() throws Exception {
Reader source = new InputStreamReader(this.getClass()
.getResourceAsStream("/test.drl"));

Properties props = new Properties();
props.setProperty("drools.dialect.java.compiler", "JANINO");
PackageBuilderConfiguration cfg = new 
PackageBuilderConfiguration(props);
JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg
.getDialectConfiguration("java");
javaConf.setCompiler(JavaDialectConfiguration.JANINO);
PackageBuilder builder = new PackageBuilder(cfg);

builder.addPackageFromDrl(source);

Package pkg = builder.getPackage();

ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
}
}




From: Wolfgang Laun 
To: Rules Users List 
Sent: Monday, June 1, 2009 7:57:36 AM
Subject: Re: re[rules-users] move hardcoded values in DRL or have constants  
inside drl

But assigning a value to a global isn't straightforward - you can't do
it in the declaration. You'll have to do it from the application (or
use some dirty hack, in a start-up rule); either way it's separate
from the declaration.

IMHO, using a Java class with public static final is definitely cleaner.

-W


2009/6/1 Earnest Dyke :
> How about adding them as Globals and referencing them that way? You should
> be able to put them in a map as well in a Global and reference them.
>
> Earnie!
>
> 
> From: karthizap 
> To: rules-users@lists.jboss.org
> Sent: Monday, June 1, 2009 7:14:56 AM
> Subject: re[rules-users] move hardcoded values in DRL or have constants
> inside drl
>
> Is there is anyway i can remove hardcoded values in the DRL file? Can I have
> the constants file(like data dictionary) inside drl/functions. I don't want
> to refer java constants class directly in drl file and would like to declare
> and refer those constants inside drl file.
> 
> View this message in context: remove hardcoded values in DRL or have
> constants inside drl
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: Re: Re: [rules-users] Re: Drools performance issue

2009-06-01 Thread jayadevan . m

Hi,

I noticed something interesting. The issue with memory is happening always  
while inserting the second set of objects into working memory!
Earlier, I was insering the DriverVO's into WM and then inserting the  
AssignmentsVO, and the system was hanging while inserting the  
AssignmentsVO. Then I reversed the order of insertion and then the machine  
was hit while inserting the DriverVO's.


Does anyone know why this issue might be happening and how to overcome this?

Thanks in advance,
Jayadevan.

On Jun 1, 2009 6:51pm, jayadeva...@gmail.com wrote:

Thanks W,







I tried it out ,But didn't get any performance improvement :(



The issue might be that I am inserting too many objects into working  
memory







jayadevan







On Jun 1, 2009 3:36pm, Wolfgang Laun wolfgang.l...@gmail.com> wrote:




> The first two patterns pair each driver assignment with each trip -




>




>




> which is quite a lot of work to do. (The infix "and" between the 2nd




>




>




> and 3rd pattern doesn't change this.) Also, the field restriction




>




>




> "tripId in ($tid)" is not the most efficient way.




>




>




>




>




>




> Try this:




>




>




>




>




>




> rule "Assignment Check"




>




>




> when




>




>




> $creVo: DriverAssignVO($drId: driverId, $tid1: tripId)




>




>




> $creVo: DriverAssignVO(driverId == $drId, $tid2: tripId != $tid1)




>




>




> $trAsgn1: TripVO( tripId == $tid1, $startDtmUtc: startDtmUtc,




>




>




> $endDtmUtc: endDtmUtc)




>




>




> $trAsgn2: TripVO( tripId == $tid2,




>




>




> ((startDtmUtc >= $startDtmUtc && startDtmUtc




>




> (endDtmUtc >= $startDtmUtc && endDtmUtc




>




> then




>




>




> System.out.println("TRIP ID: " + $crvo.getTripId());




>




>




> end




>




>




>




>




>




> Here the first two patterns produce all pairs of assignments of a




>




>




> single driver, and the remainder checks for overlaps.




>




>




>




>




>




> You'll also find that this produces two symmetric firings for each




>




>




> overlap. It might be possible to avoid this by using "$tid2: tripId >




>




>




> $tid1" in the second pattern, the id's data type permitting.




>




>




>




>




>




> -W




>




>




>




>




>




>




>




>




> 2009/6/1 Mark Proctor mproc...@redhat.com>:




>




>



> > Please send these emails to the user list (in cc) so everyone can  
help, not




>




>




> > directly to me.




>




>




> >




>




>




> > Mark




>




>




> > jayadevan m wrote:




>




>




> >




>




>




> > Hi




>




>




> >




>




>




> > We have one performance(memory) issue in drools-5




>




>




> >




>




>




> > Our Scenario




>




>




> >




>




>




> > We have 3 entities




>




>




> >




>




>




> > Trip - Entity representing details about trip




>




>




> >




>




>




> > Driver - Entity for driver , it contain details about driver




>




>




> >




>




>



> > Assignments - details about each assignments (one driver may assigned  
to




>




>




> > many trip)




>




>




> >




>




>




> > The rule is to find ,"Find overlapping between trip assignments"




>




>




> >




>




>



> > For Implementing this we take the Trip ,Driver And Assignments  
entities




>




>




> > from Data base and put it into working memory




>




>




> >




>




>




> > For Small number of records this rule work well ,




>




>




> >




>




>



> > But we want to check it against 15000 driver ,331176 assignments and  
12745




>




>




> > trips




>




>




> >




>




>




> > In that case it take huge amount of time for execution (rule firing )




>




>




> >




>




>




> >




>




>




> >




>




>




> > Rule is




>




>




> >




>




>




> > rule "Assignment Check"




>




>




> >




>




>




> > when




>




>




> >




>




>




> > $creVo: DriverAssignVO($drId: driverId ,$tid: tripId);




>




>




> >




>




>




> > $tripAssignment: TripVO(




>




>




> >




>




>




> > $tpid: tripId,




>




>




> >




>




>




> > $startDtmUtc: startDtmUtc,




>




>




> >




>




>




> > $endDtmUtc: endDtmUtc)




>




>




> >




>




>




> > and




>




>




> >




>




>




> > $trvo: TripVO(




>




>




> >




>




>




> > tripId != $tpid,




>




>




> >




>




>




> > tripId in ($tid),




>




>




> >




>




>




> > ((startDtmUtc >= $startDtmUtc && startDtmUtc




>




> > $endDtmUtc) ||




>




>




> >




>




>




> > (endDtmUtc >= $startDtmUtc && endDtmUtc




>




> > $endDtmUtc)));




>




>




> >




>




>




> > $crvo: DriverAssignVO($drvrId: driverId , driverId == $drId ,




>




>




> > tripId != $tid, tripId == $tpid)




>




>




> >




>




>




> > then




>

Re: Re: [rules-users] Re: Drools performance issue

2009-06-01 Thread jayadevan . m

Thanks W,

I tried it out ,But didn't get any performance improvement :(
The issue might be that I am inserting too many objects into working memory

jayadevan

On Jun 1, 2009 3:36pm, Wolfgang Laun  wrote:

The first two patterns pair each driver assignment with each trip -




which is quite a lot of work to do. (The infix "and" between the 2nd




and 3rd pattern doesn't change this.) Also, the field restriction




"tripId in ($tid)" is not the most efficient way.







Try this:







rule "Assignment Check"




when




$creVo: DriverAssignVO($drId: driverId, $tid1: tripId)




$creVo: DriverAssignVO(driverId == $drId, $tid2: tripId != $tid1)




$trAsgn1: TripVO( tripId == $tid1, $startDtmUtc: startDtmUtc,




$endDtmUtc: endDtmUtc)




$trAsgn2: TripVO( tripId == $tid2,




((startDtmUtc >= $startDtmUtc && startDtmUtc



(endDtmUtc >= $startDtmUtc && endDtmUtc



then




System.out.println("TRIP ID: " + $crvo.getTripId());




end







Here the first two patterns produce all pairs of assignments of a




single driver, and the remainder checks for overlaps.







You'll also find that this produces two symmetric firings for each




overlap. It might be possible to avoid this by using "$tid2: tripId >




$tid1" in the second pattern, the id's data type permitting.







-W










2009/6/1 Mark Proctor mproc...@redhat.com>:



> Please send these emails to the user list (in cc) so everyone can help,  
not




> directly to me.




>




> Mark




> jayadevan m wrote:




>




> Hi




>




> We have one performance(memory) issue in drools-5




>




> Our Scenario




>




> We have 3 entities




>




> Trip - Entity representing details about trip




>




> Driver - Entity for driver , it contain details about driver




>




> Assignments - details about each assignments (one driver may assigned to




> many trip)




>




> The rule is to find ,"Find overlapping between trip assignments"




>




> For Implementing this we take the Trip ,Driver And Assignments entities




> from Data base and put it into working memory




>




> For Small number of records this rule work well ,




>



> But we want to check it against 15000 driver ,331176 assignments and  
12745




> trips




>




> In that case it take huge amount of time for execution (rule firing )




>




>




>




> Rule is




>




> rule "Assignment Check"




>




> when




>




> $creVo: DriverAssignVO($drId: driverId ,$tid: tripId);




>




> $tripAssignment: TripVO(




>




> $tpid: tripId,




>




> $startDtmUtc: startDtmUtc,




>




> $endDtmUtc: endDtmUtc)




>




> and




>




> $trvo: TripVO(




>




> tripId != $tpid,




>




> tripId in ($tid),




>




> ((startDtmUtc >= $startDtmUtc && startDtmUtc



> $endDtmUtc) ||




>




> (endDtmUtc >= $startDtmUtc && endDtmUtc



> $endDtmUtc)));




>




> $crvo: DriverAssignVO($drvrId: driverId , driverId == $drId ,




> tripId != $tid, tripId == $tpid)




>




> then




>




> System.out.println("TRIP ID: " + $crvo.getTripId());




>




> end




>




>




>




> thanks and regards




>




> ___




> rules-users mailing list




> rules-users@lists.jboss.org




> https://lists.jboss.org/mailman/listinfo/rules-users




>




>







___




rules-users mailing list




rules-users@lists.jboss.org




https://lists.jboss.org/mailman/listinfo/rules-users




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


Re: [rules-users] rule using sliding window

2009-06-01 Thread Edson Tirelli
   Hi

   The description you have bellow is ambiguous, so I can't give you a
definitive answer. But it seems to be that you don't need sliding windows
for that. Simple temporal operators will do.

> Secondly if the window is large and number of records coming in is high
then could there be a memory issue?
   Yes, Drools does not manages persistence by itself. So, if your design
must support more data than it would fit in your running environment memory,
you need to design a solution that comprises persistence.

> Also since every record is getting stored in database, can I not use the
database directly instead of sliding window?
   Yes, you can fetch data on demand from external sources, be it databases
or anything else. Look at the "from" CE.

[]s
Edson


2009/6/1 Bhushan Bhangale 

>  I am using Drools 5. I am struggling to write rule for this logic -
>
> If a stock price changes more than 10% within an hour then report the
> change.
>
> I understand I have to use sliding window feature but unable to write the
> rule.
>
> For example I got an update for IBM stock @ 12:30 for price 100 and then
> another update IBM stock @ 12:35 for price 111. Since the time difference
> is within an hour and the change is also greater than 10% I want to report
> this price change.
>
>
>
> Stock class -
>
>
>
> Public class Stock {
>
>Private String stock;
>
>Private double price;
>
>Private Date time;
>
>Private double priceChange;
>
>Private Boolean highlight;
>
> }
>
>
>
>
>
> rule "Stock Price change more than 10% within an hour"
>
>
>
> when
>
>
>
> then
>
> set the priceChange attribute of Stock object
>
> set highlight to true
>
> end
>
>
>
>
>
> Secondly if the window is large and number of records coming in is high
> then could there be a memory issue?
>
>
>
> Also since every record is getting stored in database, can I not use the
> database directly instead of sliding window?
>
>
>
> Thanks
>
>
>
> *Mr. Bhangale Bhushan*
> *Associate Manager*
> *Kale Consultants Ltd.*
> bhushan_bhang...@kaleconsultants.com
> tel: +91 (0)206 608 
> 3777
> http://www.kaleconsultants.com
>
>
>
>
>
>
>
>
>
> Disclaimer: This email (including any attachments) is intended for the sole
> use of the recipient/s and may contain material that is CONFIDENTIAL. Any
> unauthorized disclosure / copying / distribution or forwarding of this message
> or part is STRICTLY PROHIBITED. If you have erroneously received this message,
> please delete it immediately and notify the sender. No liability is assumed 
> for
> any errors and/or omissions in the contents of this message. Information in
> this message that does not relate to the official business of this Company
> shall be understood as neither given nor endorsed by it. If verification is
> required please request a hard-copy version.
>
> To know more about Kale Consultants, visit www.kaleconsultants.com
>
> --
>
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread Edson Tirelli
   Karthizap,

   The only thing I could think of for you is to use a function in the DRL
to store your "name" value, but any solution where you change your DRL will
require you to redeploy the DRL file (obviously).

   Since your "name" changes quite often, can't you make it a fact of your
reasoning process? Just to keep with the "Person" theme, make a helper class
called AssignedName or something like that and do:

when
AssignedName( $an : name )
Person( name == $an )
then
end

   This will even prevent re-deployments of the DRL itself. Also, a join
like the above has cost O(1), so extremely good perf also (better than a
function call).

   Drools does not support constants declaration in the DRL file, as you
know, but maybe this is something we could add. Do you want to open a JIRA
with a feature request for that? (That would still require DRL redeployment
discussed above, obviously).

   Edson



2009/6/1 karthizap 

>
> Thanks for your reply Earnie. In the following example, don't want to
> hardcode Person Name value like "John" in the DRL file. I want to refer it
> from some other sources(If i refer it from java class file, name value is
> getting changed quiet often, have to recompile the java source and deploy).
> My main requirement is, if the name value is getting changed, don't want to
> redeploy/restart the application. i would like to do the changes in the drl
> file only without hard coding.
>
>
> rule "Test Rule"
>
>when
>$person : Person( name == "John")
>then
>$person.setActivation(true)
>
> end
>
> Karthikeyan
>
> Please explain, how i can refer global object in LHS?
>
>
> Earnie D wrote:
> >
> > How about adding them as Globals and referencing them that way? You
> should
> > be able to put them in a map as well in a Global and reference them.
> >
> > Earnie!
> >
> >
> >
> >
> > 
> > From: karthizap 
> > To: rules-users@lists.jboss.org
> > Sent: Monday, June 1, 2009 7:14:56 AM
> > Subject: re[rules-users] move hardcoded values in DRL or have constants
> > inside drl
> >
> > Is there is anyway i can remove hardcoded values in the DRL file? Can I
> > have the constants file(like data dictionary) inside drl/functions.  I
> > don't want to refer java constants class directly in drl file and would
> > like to declare and refer those constants inside drl file.
> > 
> >  View this message in context: remove hardcoded values in DRL or have
> > constants inside drl
> > Sent from the drools - user mailing list archive at Nabble.com.
> >
> > ___
> > rules-users mailing list
> > rules-users@lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/remove-hardcoded-values-in-DRL-or-have-constants-inside-drl-tp23813412p23814041.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] DRL - Accessors that take arguments

2009-06-01 Thread Edson Tirelli
   For arbitrary method calls, the only way is to use an eval:

VO( eval( computePrice("key") < 10 ) )

   Although, if you have a method that returns a map, you can use simplified
Map syntax:

class VO {
   ...
   public Map getComputeMap() {...}
}

   Then:

VO( computeMap["key"] < 10 )


   []s
   Edson

2009/6/1 Vidya Chandrasekaran 

>
> Hi,
>
> I am fairly new to Drools and am just getting my feet wet with writing
> rules.
>
> In my work, I have to integrate drools with classes that do not expose all
> properties via getXXX/ isXXX accessor methods but require a call of the form
> someMethod("keyvalue"). I have been using the MVEL dialect and do not see a
> way to call a function with arguments on the LHS side of a rule either in
> the documentation or the mailing list.
>
>
> In fact, I have been trying something like
>
> rule "rulename"
> agenda-group "evaluation"
> when
> $d: VO( computePrice("key") < 10) from entry-point "Inventory
> stream"
> then
> #
> end
>
> This fails with a 'no viable alternative at input '"key"' in rule. Is there
> a way this can be accomplished?
>
> Thanks,
> Vidya
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Resend: A Question about roadmap on integration between Drools and Apache ODE

2009-06-01 Thread 노종극
Title: Samsung Enterprise Portal mySingle
Hi.
 
I'm working for Samsung SDS in Korea as a project leader and in contemplation 
using Apache ODE and Drools.
When I was googling I saw your mail as below (Plz see bold) then I have a question about 
integration between Apache ODE and Drools.
 
I'd like to use Apache ODE as a business flow and Drools as a business rules 
on my project because I think BPEL is a  standard tools representing 
business flow. 
In details I'd like to implement in the way some node in BPEL flow can call Drools 
business rules. 
 
Would you give me the information about whether and when you're planned to integrate 
apache ODE into Drools?
 
Thank you in advance 
 
JongGeuk
 
 
 Umesh Wankhede wrote:


Mark Proctor wrote:

Umesh Wankhede wrote:



Mark Proctor wrote:

Umesh Wankhede wrote:

Hi

I am trying to evaluate various features (rules and workflow) of 
Drools 5.0. What I understand from docs (drools-docs-flow.pdf - 
page 5) is that the Drools flow engine is based on generic process 
engine that allows the execution of different process languages 
like RuleFlow, BPEL, OSWorkflow, etc. Although I am able to do PoC 
(Proof of Concept) with RuleFlow, there isn't any 
documentation/samples available for using BPEL as process 
language. Also I don't find any more information on blogs, etc. 
If anyone has done something similar, please let me know, or any 
pointers would help. There is no BPEL product, 
Drools COULD do BPEL, but we haven't made it do so yet. It is more 
likely we would look to integrate an existing BPEL product like ODE, as 
the execution engine is the easy bit, it's all the xml manipulations 
that are time consuming. So that means I would have to go 
with jBPM for BPEL support (and losing the advantage of tight rule 
engine integration provided in Drools). How far would be the BPEL 
support in Drools in the roadmap? If you are going to use 
BPEL I would recommend ODE, jBPM BPEL is not BPEL 2.0, but 1.0, which 
is very limited. ODE is likely to be the BPEL engine we integrated into 
Drools. 
More importantly though, have a good think on why it is you are using 
BPEL, as in reality it's generally too low level for end users to use 
effectively. The primary language would be 
RuleFlow or jPDL, but we are also looking at BPEL support (product 
requirements driven). So we have to make a choice between jBPM or 
Drools 5.0. The latter option looks more suitable for our requirement 
which provides tightly integrated rule support, but lack of BPEL 
support currently is making the decision tougher. 
If you are going to choose a BPEL product, make sure you 
choose one that supports BPEL 2.0, or you'll be shooting yourself in 
the foot, Apache ODE is the more complete BPEL 2.0 engine. 





Thanks
Umesh


Legal Notice: This transmission, including any attachments, is 
confidential, proprietary, and may be privileged. It is intended 
solely for the intended recipient. If you are not the intended 
recipient, you have received this transmission in error and you are 
hereby advised that any review, disclosure, copying, 
distribution, or use of this transmission, or any of the information 
included therein, is unauthorized and strictly prohibited. If 
you have received this transmission in error, please immediately notify 
the sender by reply and permanently delete all copies of this transmission and its attachments





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




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




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




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


Re: re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread karthizap

Thanks for your reply Earnie. In the following example, don't want to
hardcode Person Name value like "John" in the DRL file. I want to refer it
from some other sources(If i refer it from java class file, name value is
getting changed quiet often, have to recompile the java source and deploy).
My main requirement is, if the name value is getting changed, don't want to
redeploy/restart the application. i would like to do the changes in the drl
file only without hard coding.


rule "Test Rule"

when
$person : Person( name == "John") 
then 
$person.setActivation(true)

end

Karthikeyan

Please explain, how i can refer global object in LHS?


Earnie D wrote:
> 
> How about adding them as Globals and referencing them that way? You should
> be able to put them in a map as well in a Global and reference them.
> 
> Earnie!
> 
> 
> 
> 
> 
> From: karthizap 
> To: rules-users@lists.jboss.org
> Sent: Monday, June 1, 2009 7:14:56 AM
> Subject: re[rules-users] move hardcoded values in DRL or have constants
> inside drl
> 
> Is there is anyway i can remove hardcoded values in the DRL file? Can I
> have the constants file(like data dictionary) inside drl/functions.  I
> don't want to refer java constants class directly in drl file and would
> like to declare and refer those constants inside drl file. 
> 
>  View this message in context: remove hardcoded values in DRL or have
> constants inside drl
> Sent from the drools - user mailing list archive at Nabble.com.
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/remove-hardcoded-values-in-DRL-or-have-constants-inside-drl-tp23813412p23814041.html
Sent from the drools - user mailing list archive at Nabble.com.

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


Re: re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread Wolfgang Laun
But assigning a value to a global isn't straightforward - you can't do
it in the declaration. You'll have to do it from the application (or
use some dirty hack, in a start-up rule); either way it's separate
from the declaration.

IMHO, using a Java class with public static final is definitely cleaner.

-W


2009/6/1 Earnest Dyke :
> How about adding them as Globals and referencing them that way? You should
> be able to put them in a map as well in a Global and reference them.
>
> Earnie!
>
> 
> From: karthizap 
> To: rules-users@lists.jboss.org
> Sent: Monday, June 1, 2009 7:14:56 AM
> Subject: re[rules-users] move hardcoded values in DRL or have constants
> inside drl
>
> Is there is anyway i can remove hardcoded values in the DRL file? Can I have
> the constants file(like data dictionary) inside drl/functions. I don't want
> to refer java constants class directly in drl file and would like to declare
> and refer those constants inside drl file.
> 
> View this message in context: remove hardcoded values in DRL or have
> constants inside drl
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread Earnest Dyke
How about adding them as Globals and referencing them that way? You should be 
able to put them in a map as well in a Global and reference them.

Earnie!





From: karthizap 
To: rules-users@lists.jboss.org
Sent: Monday, June 1, 2009 7:14:56 AM
Subject: re[rules-users] move hardcoded values in DRL or have constants inside 
drl

Is there is anyway i can remove hardcoded values in the DRL file? Can I have 
the constants file(like data dictionary) inside drl/functions.  I don't want to 
refer java constants class directly in drl file and would like to declare and 
refer those constants inside drl file. 

 View this message in context: remove hardcoded values in DRL or have constants 
inside drl
Sent from the drools - user mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


re[rules-users] move hardcoded values in DRL or have constants inside drl

2009-06-01 Thread karthizap

Is there is anyway i can remove hardcoded values in the DRL file? Can I have
the constants file(like data dictionary) inside drl/functions.  I don't want
to refer java constants class directly in drl file and would like to declare
and refer those constants inside drl file.
-- 
View this message in context: 
http://www.nabble.com/remove-hardcoded-values-in-DRL-or-have-constants-inside-drl-tp23813412p23813412.html
Sent from the drools - user mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] rule using sliding window

2009-06-01 Thread Bhushan Bhangale
I am using Drools 5. I am struggling to write rule for this logic -

If a stock price changes more than 10% within an hour then report the
change.

I understand I have to use sliding window feature but unable to write the
rule.

For example I got an update for IBM stock @ 12:30 for price 100 and then
another update IBM stock @ 12:35 for price 111. Since the time difference is
within an hour and the change is also greater than 10% I want to report this
price change.

 

Stock class -

 

Public class Stock {

   Private String stock;

   Private double price;

   Private Date time;

   Private double priceChange;

   Private Boolean highlight;

}

 

 

rule "Stock Price change more than 10% within an hour"

 

when

 

then

set the priceChange attribute of Stock object

set highlight to true 

end

 

 

Secondly if the window is large and number of records coming in is high then
could there be a memory issue?

 

Also since every record is getting stored in database, can I not use the
database directly instead of sliding window?

 

Thanks

 


Mr. Bhangale Bhushan
Associate Manager
Kale Consultants Ltd.
 
bhushan_bhang...@kaleconsultants.com
tel:
 +91 (0)206 608
3777
  http://www.kaleconsultants.com 

 


 


 

 




Disclaimer: This email (including any attachments) is intended for the sole
use of the recipient/s and may contain material that is CONFIDENTIAL. Any
unauthorized disclosure / copying / distribution or forwarding of this message
or part is STRICTLY PROHIBITED. If you have erroneously received this message,
please delete it immediately and notify the sender. No liability is assumed for
any errors and/or omissions in the contents of this message. Information in
this message that does not relate to the official business of this Company
shall be understood as neither given nor endorsed by it. If verification is
required please request a hard-copy version.

To know more about Kale Consultants, visit www.kaleconsultants.com

-=-=-=-=-=-=-=-=-=-


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


[rules-users] DRL - Accessors that take arguments

2009-06-01 Thread Vidya Chandrasekaran
Hi,

I am fairly new to Drools and am just getting my feet wet with writing
rules.

In my work, I have to integrate drools with classes that do not expose all
properties via getXXX/ isXXX accessor methods but require a call of the form
someMethod("keyvalue"). I have been using the MVEL dialect and do not see a
way to call a function with arguments on the LHS side of a rule either in
the documentation or the mailing list.


In fact, I have been trying something like

rule "rulename"
agenda-group "evaluation"
when
$d: VO( computePrice("key") < 10) from entry-point "Inventory
stream"
then
#
end

This fails with a 'no viable alternative at input '"key"' in rule. Is there
a way this can be accomplished?

Thanks,
Vidya
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Drools performance issue

2009-06-01 Thread Wolfgang Laun
The first two patterns pair each driver assignment with each trip -
which is quite a lot of work to do. (The infix "and" between the 2nd
and 3rd pattern doesn't change this.) Also, the field restriction
"tripId in ($tid)" is not the most efficient way.

Try this:

rule "Assignment Check"
when
  $creVo: DriverAssignVO($drId: driverId,   $tid1: tripId)
  $creVo: DriverAssignVO(driverId == $drId, $tid2: tripId != $tid1)
  $trAsgn1: TripVO( tripId == $tid1, $startDtmUtc: startDtmUtc,
$endDtmUtc: endDtmUtc)
  $trAsgn2: TripVO( tripId == $tid2,
 ((startDtmUtc >= $startDtmUtc && startDtmUtc <= $endDtmUtc) ||
  (endDtmUtc >= $startDtmUtc && endDtmUtc <= $endDtmUtc)));
then
  System.out.println("TRIP ID: " + $crvo.getTripId());
end

Here the first two patterns produce all pairs of assignments of a
single driver, and the remainder checks for overlaps.

You'll also find that this produces two symmetric firings for each
overlap. It might be possible to avoid this by using  "$tid2: tripId >
$tid1" in the second pattern, the id's data type permitting.

-W


2009/6/1 Mark Proctor :
> Please send these emails to the user list (in cc) so everyone can help, not
> directly to me.
>
> Mark
> jayadevan m wrote:
>
> Hi
>
>  We have one performance(memory) issue in drools-5
>
>  Our Scenario
>
>  We have 3 entities
>
>   Trip - Entity representing details about trip
>
>  Driver - Entity for driver , it contain details about driver
>
>  Assignments - details about each assignments (one driver may assigned to
> many trip)
>
>  The rule is to find ,"Find overlapping between trip assignments"
>
>  For Implementing this we take the Trip ,Driver And Assignments entities
> from Data base and put it into working memory
>
>  For Small number of records this rule work well ,
>
> But we want to check it against 15000 driver ,331176 assignments and 12745
> trips
>
>  In that case it take huge amount of time for execution (rule firing )
>
>
>
> Rule is
>
>  rule "Assignment Check"
>
> when
>
>  $creVo: DriverAssignVO($drId: driverId ,$tid: tripId);
>
>   $tripAssignment: TripVO(
>
>     $tpid: tripId,
>
>     $startDtmUtc: startDtmUtc,
>
>     $endDtmUtc: endDtmUtc)
>
>     and
>
>     $trvo: TripVO(
>
>     tripId != $tpid,
>
>     tripId in ($tid),
>
>     ((startDtmUtc >= $startDtmUtc && startDtmUtc <=
> $endDtmUtc) ||
>
>     (endDtmUtc >= $startDtmUtc && endDtmUtc <=
> $endDtmUtc)));
>
>   $crvo: DriverAssignVO($drvrId: driverId , driverId == $drId ,
> tripId != $tid, tripId == $tpid)
>
> then
>
>   System.out.println("TRIP ID: " + $crvo.getTripId());
>
> end
>
>
>
> thanks and regards
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>

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


[rules-users] Re: Drools performance issue

2009-06-01 Thread Mark Proctor
Please send these emails to the user list (in cc) so everyone can help, 
not directly to me.


Mark
jayadevan m wrote:


Hi

 We have one performance(memory) issue in drools-5

 Our Scenario

 We have 3 entities

  Trip - Entity representing details about trip

 Driver - Entity for driver , it contain details about driver

 Assignments - details about each assignments (one driver may assigned 
to many trip)


 The rule is to find ,"Find overlapping between trip assignments"

 For Implementing this we take the Trip ,Driver And Assignments 
entities from Data base and put it into working memory


 For Small number of records this rule work well ,

But we want to check it against 15000 driver ,331176 assignments and 
12745 trips


 In that case it take huge amount of time for execution (rule firing )

 


Rule is

 rule "Assignment Check"

when

 $creVo: DriverAssignVO($drId: driverId ,$tid: tripId);

  $tripAssignment: TripVO(

$tpid: tripId,

$startDtmUtc: startDtmUtc,

$endDtmUtc: endDtmUtc)

and

$trvo: TripVO(

tripId != $tpid,

tripId in ($tid),

((startDtmUtc >= $startDtmUtc && 
startDtmUtc <= $endDtmUtc) ||


(endDtmUtc >= $startDtmUtc && endDtmUtc <= 
$endDtmUtc)));


  $crvo: DriverAssignVO($drvrId: driverId , driverId == 
$drId , tripId != $tid, tripId == $tpid)


then

  System.out.println("TRIP ID: " + $crvo.getTripId());

end

 


thanks and regards



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