Re: [rules-users] Two version of hibernate in the same classpath, how to specify thecorrect version to be used in drools ?

2011-05-27 Thread Greg Stasica


  
  
hi,
I'm not sure if its possible to achieve it as you might get e.g.
missing method/missing class exception if you start mixing different
versions of hibernate artifacts.
I'm afraid that the only safe solution would be running your
workflow process in its own JVM. You might want to have a look on
drools-server and check if it does what you want. I know it can run
rules and return results back to the calling application but i'm not
sure about workflows.

good luck :)


On 26/05/2011 14:36, JAMAL Moundir (EXT) wrote:

  versions of
the hibernate in the same classpath whichs made several
problems.
  
  Maybe I can use another implementation of JPA
with drools,
but It will be difficult to change the pers


-- 
Greg Stasica

PaceMetrics Ltd.
T  +353 1 8849921

PaceMetrics Limited is registered in Ireland as a private company limited by shares, Registration  No.  298243,  Registered office:  PaceMetrics House, East Point Business Park, Dublin 3. This e-mail may contain confidential, proprietary or privileged information. If you are not the intended recipient (or have received this e-mail in error) please destroy this e-mail and notify the sender immediately by telephoning +353 1 8184000. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
  


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


Re: [rules-users] [Drools Flow 5.1] persistence + spring + localTransaction

2011-05-27 Thread Greg Stasica
hi,

sorry but i've never tried to use something else. My application uses 
spring so there was no other option for me.

On 25/05/2011 20:16, anton.litvinenko wrote:
 Greg, were you able to achieve process persistence in other configurations?
 (e.g. without spring?)

 I don't use drools-spring bean factories to instantiate KnowledgeAgent and
 KnoweldgeBase (instead i created alternative factories) + the following JPA
 definition and spring context

 persistence.xml:
 ?xml version=1.0 encoding=UTF-8 standalone=yes?
 persistence version=1.0
   xsi:schemaLocation=http://java.sun.com/xml/ns/persistence
 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
 http://java.sun.com/xml/ns/persistence/orm
 http://java.sun.com/xml/ns/persistence/orm_1_0.xsd;
   xmlns:orm=http://java.sun.com/xml/ns/persistence/orm;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns=http://java.sun.com/xml/ns/persistence;

  persistence-unit name=org.drools.persistence.jpa
  providerorg.hibernate.ejb.HibernatePersistence/provider
  classorg.drools.persistence.session.SessionInfo/class

 classorg.drools.persistence.processinstance.ProcessInstanceInfo/class

 classorg.drools.persistence.processinstance.ProcessInstanceEventInfo/class
  classorg.drools.persistence.processinstance.WorkItemInfo/class

 classorg.drools.persistence.processinstance.variabletypes.VariableInstanceInfo/class

 classorg.drools.persistence.processinstance.variabletypes.SerializablePersistedVariable/class

 classorg.drools.persistence.processinstance.variabletypes.JPAPersistedVariable/class
  properties
  property name=hibernate.dialect
 value=org.hibernate.dialect.PostgreSQLDialect/
  property name=hibernate.max_fetch_depth value=3/
  property name=hibernate.hbm2ddl.auto value=update/
  property name=hibernate.show_sql value=true/
  property name=hibernate.connection.autocommit value=false/
  /properties
  /persistence-unit
 /persistence

 ApplicationContext.xml:
  bean id=entityManagerFactory
 class=org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
  property name=dataSource ref=dataSource/
  property name=loadTimeWeaver
  bean
 class=org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver/
  /property
  /bean

  jee:jndi-lookup id=dataSource jndi-name=jdbc/flowengine/

  bean id=transactionManager
 class=org.springframework.orm.jpa.JpaTransactionManager
  constructor-arg type=javax.persistence.EntityManagerFactory
 ref=entityManagerFactory/
  /bean

  tx:annotation-driven transaction-manager=transactionManager/

 This kinda works, but I have to start transaction manually before invoking
 any method on Drools Flow. And of course if an exception happens during the
 invocation then everything is rolled back (e.g. process with 3 steps and the
 last step crashes then process state in database is not updated with 2 first
 steps).

 Is it possible to configure Drools Flow to start/commit transaction at
 before/after process step?

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Drools-Flow-5-1-persistence-spring-localTransaction-tp2875263p2985689.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


-- 
Greg Stasica

PaceMetrics Ltd.
T  +353 1 8849921

PaceMetrics Limited is registered in Ireland as a private company limited by 
shares, Registration  No.  298243,  Registered office:  PaceMetrics House, East 
Point Business Park, Dublin 3. This e-mail may contain confidential, 
proprietary or privileged information. If you are not the intended recipient 
(or have received this e-mail in error) please destroy this e-mail and notify 
the sender immediately by telephoning +353 1 8184000. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.


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


Re: [rules-users] [Drools Flow 5.1] Updating a process definition - Proceed updates running processes

2011-05-27 Thread Greg Stasica


  
  
hi,
it's a long shot and by far should not be treated as something
definite (i haven't checked the source code), but i suspect that
you've just found another bug in JPA/persistence implementation. 
I agree with salaboy that once process has been updated only
new processes should run with the newer version (all existing ones
should run with the old version). But, if the events sequence is
like below:
1. start process P1
2. persist session S1 (process not completed)
3. update process
4. restart server (just to reload persisted session)
5. load S1 and continue process P1

i suspect that due to the fact that persisted session persists only
process_id when the same is loaded from the store all it sees is a
new version of the process (hence your situation)

on the other hand if no persistence is being used there is no
problem at all because running process won't see any changes being
made to the process definition etc.



On 25/05/2011 20:44, anton.litvinenko wrote:

  I tried exactly that and my already running process continued with the
*updated* process version.

I have a process with 3 nodes: Action Node (writing to system.out) = Async
Work Item (makes request and then waits for async result - not blocking) =
Action Node (writing to system.out)

So, I experimented like this:
1. started the process, saw first system.out, saw making request
2. updated the process to have a different system.out at last action node,
deployed it to Guvnor, waited for KnowledgeAgent to pick it up
3. sent response to the process at Async Work Item - saw *new* system.out
at the last node.

Am i doing something wrong? Or have wrong expectations?

--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Flow-5-1-Updating-a-process-definition-Proceed-updates-running-processes-tp2928103p2985817.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Greg Stasica

PaceMetrics Ltd.
T  +353 1 8849921

PaceMetrics Limited is registered in Ireland as a private company limited by shares, Registration  No.  298243,  Registered office:  PaceMetrics House, East Point Business Park, Dublin 3. This e-mail may contain confidential, proprietary or privileged information. If you are not the intended recipient (or have received this e-mail in error) please destroy this e-mail and notify the sender immediately by telephoning +353 1 8184000. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
  


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


Re: [rules-users] Accessing globals after FireAllRules

2011-05-27 Thread sdinoo
Awesome! This worked
Thank you very much Wolfgang!!

Though, I have a architectural question
My use case is in claims processing and here are the steps that need to
happen
1) Recieve patients claim (prescription claim, like medicines)
2) Retrieve the patients Claim History (use patient ID in claim)
3) Retrieve the drug information (use RxID in claim)
4) Subject the claim to the rules in drools
5) Respond with rule results (show the contributing claims that caused the
rules to fire)

for this ,
I created a Rule flow
Step 2) and 3) are rule tasks that ONLY fetch information 
Step 4) I want to write the rules (mix of java helper classes and drl) and
subject the claim to that
Step 5) return the results (via the List option that you just gave me)

Is this the way people use the Rule Flow? 
Do you see anyting fundamentally wrong here?
Do you think I should you Stateless sessions instead of rule flow?

Do let me know




--
View this message in context: 
http://drools.46999.n3.nabble.com/Accessing-globals-after-FireAllRules-tp2989144p2992639.html
Sent from the Drools: User forum 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] Releases: Drools (Expert, Fusion, Planner) 5.2.0.CR1, Guvnor 5.2.0.CR1 and jbpm 5.1.0.CR1

2011-05-27 Thread Geoffrey De Smet
Get them while they are hot.

   http://blog.athico.com/2011/05/releases-drools-expert-fusion-planner.html

-- 
With kind regards,
Geoffrey De Smet


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


[rules-users] DSL Entry Question

2011-05-27 Thread jstroup
Hi,

The 5.2 docs list the following example DSL entry

  [when][][Tt]here is an? {entity:\w+}=${entity!lc}: ${entity!ucfirst} ()

and say the following about what follows the equals sign

The remaining part of the line after the delimiting equal sign is the
replacement text for any DSLR text matching the regular expression. It may
contain variable references, i.e., a variable name enclosed in braces.

What does the colon following the first variable do? I'm guessing it acts as
an OR? I didn't see any explanation of this and I don't *think* this is
regex. 

Also, I'm used to (and actually understand) the following syntax which does
not prefix { with a $.

   [when]There is some {cheese} cheese available=Cheese(type=={cheese})

My best guess is that the $ denotes a class name that is specified
declaratively in the matching DSLR rule as opposed to a field {cheese} that
is simply a replaceable parameter that matches whatever you type between
some and cheese available and looks for Cheese objects of that type. So,
given the first DSL entry, if my rule text is

  when

there is a cheese

the rule will fire if a Cheese object has been inserted. And, conversely

  when
  
There is an Cheese

will also fire.


Am I on the right track here?

Thanks,

Jeff






--
View this message in context: 
http://drools.46999.n3.nabble.com/DSL-Entry-Question-tp2993076p2993076.html
Sent from the Drools: User forum 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] Accessing globals after FireAllRules

2011-05-27 Thread Wolfgang Laun
Although not an expert on Flow, I can say that there can hardly be anything
fundamentally wrong with this brief Flow, where a simpler solution might be
equally possible. Much depends on other circumstances, e.g., possible future
developments, deployment, workload,...

-W


On 27 May 2011 14:18, sdinoo sdi...@gmail.com wrote:

 Awesome! This worked
 Thank you very much Wolfgang!!

 Though, I have a architectural question
 My use case is in claims processing and here are the steps that need to
 happen
 1) Recieve patients claim (prescription claim, like medicines)
 2) Retrieve the patients Claim History (use patient ID in claim)
 3) Retrieve the drug information (use RxID in claim)
 4) Subject the claim to the rules in drools
 5) Respond with rule results (show the contributing claims that caused the
 rules to fire)

 for this ,
 I created a Rule flow
 Step 2) and 3) are rule tasks that ONLY fetch information
 Step 4) I want to write the rules (mix of java helper classes and drl) and
 subject the claim to that
 Step 5) return the results (via the List option that you just gave me)

 Is this the way people use the Rule Flow?
 Do you see anyting fundamentally wrong here?
 Do you think I should you Stateless sessions instead of rule flow?

 Do let me know




 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Accessing-globals-after-FireAllRules-tp2989144p2992639.html
 Sent from the Drools: User forum 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: [rules-users] DSL Entry Question

2011-05-27 Thread Wolfgang Laun
On 27 May 2011 16:24, jstroup jstr...@regenstrief.org wrote:

 Hi,

 The 5.2 docs list the following example DSL entry

  [when][][Tt]here is an? {entity:\w+}=${entity!lc}: ${entity!ucfirst} ()

 Oops, there is a spurious '$', the second one. It should be
  =${entity!lc}: {entity!ucfirst} ()


 and say the following about what follows the equals sign

 The remaining part of the line after the delimiting equal sign is the
 replacement text for any DSLR text matching the regular expression. It may
 contain variable references, i.e., a variable name enclosed in braces.

 What does the colon following the first variable do?


The colon in ...=${entity!lc}: {entity!ucfirst} () will remain a colon,
after expansion. It's the colon after a binding variable.




 Also, I'm used to (and actually understand) the following syntax which does
 not prefix { with a $.

   [when]There is some {cheese} cheese available=Cheese(type=={cheese})


 My best guess is that the $ denotes a class name that is specified
 declaratively in the matching DSLR rule as opposed to a field {cheese} that
 is simply a replaceable parameter that matches whatever you type between
 some and cheese available and looks for Cheese objects of that type.

So,
 given the first DSL entry, if my rule text is

  when

there is a cheese

 the rule will fire if a Cheese object has been inserted. And, conversely

  when

There is an Cheese

 will also fire.


Since both expand to

$cheese: Cheese ()




 Am I on the right track here?


yes, and thanks for the Q.
-W


 Thanks,

 Jeff






 --
 View this message in context:
 http://drools.46999.n3.nabble.com/DSL-Entry-Question-tp2993076p2993076.html
 Sent from the Drools: User forum 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] Thread hung while trying to addKnowledgePackages

2011-05-27 Thread nirmal
Hi,

I am trying to do some drools calls on startup of application
server(Websphere) and the server gets hung at a point and shows the
following warnings.
Any pointers or help appreciated. 


[5/26/11 17:28:02:977 EDT] 0020 ThreadMonitor W   WSVR0605W: Thread
SoapConnectorThreadPool : 1 (0028) has been active for 674145
milliseconds and may be hung.  There is/are 1 thread(s) in total in the
server that may be hung.
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:275)
at
org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(JavaDialectRuntimeData.java:576)
at
org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:259)
at
org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:242)
at
org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:89)
at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
at
org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.java:410)
at
org.drools.rule.JavaDialectRuntimeData.reload(JavaDialectRuntimeData.java:477)
at
org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(JavaDialectRuntimeData.java:237)
at
org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(DialectRuntimeRegistry.java:134)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:513)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:430)
at
org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:143)


Thanks,
Nirmal

--
View this message in context: 
http://drools.46999.n3.nabble.com/Thread-hung-while-trying-to-addKnowledgePackages-tp2993222p2993222.html
Sent from the Drools: User forum 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 Flow and Stateless Session

2011-05-27 Thread John Peterson
I'm having some difficulty getting a rule flow with a stateless session to 
work.  Essentially, it is just executing the first task and then stops.  I'm 
using Drools 5.1.1 and I just built the sample Drools by creating a new Drools 
Project.

My rule flow is simple: Start-RuleGroup1-RuleGroup2-End

I use the 2 rules from example, putting the Hello World in RuleGroup1 and 
Goodbye in RuleGroup2.

Here's my code to run it:

// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
KnowledgeRuntimeLogger logger = 
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, test);

// start a new process instance
Message message = new Message();
message.setMessage(Hello World);
message.setStatus(Message.HELLO);

ArrayList cmds = new ArrayList();
ArrayList dataList = new ArrayList();
dataList.add(message);
cmds.add(CommandFactory.newInsertElements(dataList));

cmds.add(CommandFactory.newStartProcess(com.sample.ruleflow));
ksession.execute(CommandFactory.newBatchExecution(cmds));
logger.close();

When I run the rules, all I get is Hello World (no Goodbye cruel world).  
It does work with a Stateful Session using insert, startProcess, and 
fireAllRules, but this is a test using the rule flows with CommandFactory 
functionality, something we need for an application we are developing.

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


Re: [rules-users] [Drools Flow 5.1] Updating a process definition - Proceed updates running processes

2011-05-27 Thread anton.litvinenko
Greg, your guess is correct! The process instance is in fact persisted in db
for the period waiting for response  in node 2.

Guys from dev-team, do you agree that this is a bug and should be filled in
Jira?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Flow-5-1-Updating-a-process-definition-Proceed-updates-running-processes-tp2928103p2993612.html
Sent from the Drools: User forum 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] Catch 22 ANTLR DSL matching issue

2011-05-27 Thread jstroup
Hi Droolers,

Regarding this blurb from the 5.2 DSL reference:

It is important to note that the compiler transforms DSL rule files line by
line. In the above example, all the text after Something is  to the end of
the line is captured as the replacement   value for {colour}, and this is
used for interpolating the target string. This may not be exactly what you
want. For instance, when you intend to merge different DSL expressions to
generate a composite DRL pattern, you need to transform a DSLR line in
several independent operations. The best way to achieve this is to ensure
that the captures are surrounded by characteristic text - words or even
single characters. As a result, the matching operation done by the parser
plucks out a substring from somewhere within the line. In the example below,
quotes are used as distinctive characters. Note that the characters that
surround the capture are not included during interpolation, just the
contents between them.

Given this DSL (test_expander.dsl)

  [when](C|c)heese is {type}=Cheese(type=={type})
  [when](is|hails|comes) from {country}=Cheese(country=={country})
  [then]Add the message {message}=System.out.println({message});

And this DSLR

  package com.sample
  import com.sample.DroolsTest.Cheese;
  expander test_expander.dsl

  rule rule_1 
when 
   Cheese is cheddar and is from Italy
then 
Add the message Cheddar IS from Italy
  end 

  rule rule_2 
when 
   cheese is cheddar and comes from Italy
then 
Add the message Cheddar COMES from Italy
  end

I know that rule_2 fails because I removed the “distinctive characters” so
ANTLR is confused on what to capture. It just seems so unnatural for a rule
author to have to somehow magically know to add quotes in order to merge
different DSL expressions to generate a composite DRL pattern. The
documentation suggests also surrounding it with distinctive words so I sneak
an “and” into the DSL entry.

  [when](C|c)heese is {type} and=Cheese(type=={type})

This allows me to write my rules more naturally.

  rule rule_1 
when 
   Cheese is cheddar and is from Italy
then 
Add the message Cheddar IS from Italy
  end 

  rule rule_2 
when 
   cheese is cheddar and comes from Italy
then 
Add the message Cheddar COMES from Italy
  end

In the first example the “and” in 

  Cheese is cheddar and is from Italy

is actually a logical AND - not a matching character – which is nice because
we can use it to logically connect the 2 expressions or just match the first
DSL expression by itself as in

  Cheese is cheddar

And since the second expression is not present we can drop the quotes. (But
how on earth will a rule author know this?). But if we add the “and” as part
of the first DSL expression 

  1) It is no  longer a connecting logical character but is part of the
expression to match (yuk)
  2) We can no longer just write “Cheese is cheddar” by itself but are
forced to write “Cheese is cheddar and” if we want to match only the first
expression. You might as well just combined the two expressions into one
since there is no real advantage now to having two expressions!

One nice thing would be for the Guvnor DSL editor to 

  1)try the capture greedily first, 
  2)get the annoying “no viable alternative error”, 
  3)CATCH the error instead of just giving up, 
  4)capture non-greedily and match only the first word, 
  5)then search for matching DSL expressions beyond that.

Or something like that. The only time you should have to add quotes is if
the text you are matching actually contains multiple words. Anything else is
counter-intuitive. Please tell me the planned replacement for DSL addresses
this!

Jeff

--
View this message in context: 
http://drools.46999.n3.nabble.com/Catch-22-ANTLR-DSL-matching-issue-tp2993923p2993923.html
Sent from the Drools: User forum 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] Rule Flow and Stateless Session

2011-05-27 Thread Tihomir Surdilovic
Hi John, this is a known issue 
https://issues.jboss.org/browse/JBRULES-2718. The fix is in 5.2.0.CR1 
which you can get from http://www.jboss.org/drools/downloads.html.


Thanks.
On 5/27/11 12:14 PM, John Peterson wrote:
I'm having some difficulty getting a rule flow with a stateless 
session to work.  Essentially, it is just executing the first task and 
then stops.  I'm using Drools 5.1.1 and I just built the sample Drools 
by creating a new Drools Project.

My rule flow is simple: Start-RuleGroup1-RuleGroup2-End
I use the 2 rules from example, putting the Hello World in 
RuleGroup1 and Goodbye in RuleGroup2.

Here's my code to run it:
// load up the knowledge base
KnowledgeBase kbase = /readKnowledgeBase/();
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
KnowledgeRuntimeLogger logger = 
KnowledgeRuntimeLoggerFactory./newFileLogger/(ksession, test);

// start a new process instance
Message message = *new* Message();
message.setMessage(Hello World);
message.setStatus(Message./HELLO/);
ArrayList cmds = *new* ArrayList();
ArrayList dataList = *new* ArrayList();
dataList.add(message);
cmds.add(CommandFactory./newInsertElements/(dataList));
cmds.add(CommandFactory./newStartProcess/(com.sample.ruleflow));
ksession.execute(CommandFactory./newBatchExecution/(cmds));
logger.close();
When I run the rules, all I get is Hello World (no Goodbye cruel 
world).  It does work with a Stateful Session using insert, 
startProcess, and fireAllRules, but this is a test using the rule 
flows with CommandFactory functionality, something we need for an 
application we are developing.



___
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] Catch 22 ANTLR DSL matching issue

2011-05-27 Thread jstroup
Correction: I meant the DSL Parser - Not the Guvnor DSL Editor. But the UI
could politely ask the user what alternative IS viable since it has access
to all of them.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Catch-22-ANTLR-DSL-matching-issue-tp2993923p2993959.html
Sent from the Drools: User forum 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] drools date compare not working as documented

2011-05-27 Thread magaram
hi -

  i am using drools-distribution-5.2.0.M2. Here is the drl i am using -

--
dialect mvel

import com.deltadental.drools.sample.*

rule Rule 01
when
$underageCustomer : Customer(dob15-May-1993)
$order : Order(customerId == $underageCustomer.customerId)
eval($order.discountPercentage == 0)
then
$order.discountPercentage = 25;
System.out.println(Rule 01 fired. Applied discount
+$order.discountPercentage);
end
--


I get a RuntimeDroolsException: Exception executing predicate dob 
15-May-1993
Caused by: java.lang.RuntimeException: uncomparable values Mon May 01
00:00:00 EDT 2000 and 15-May-1993

caused by a class cast exception - String cannot be converted to a Date.

I get the same exception with 5.1.1. I tried the same setting Locale and
drools.dateformat properties - no luck so far..

  Am I missing something here?

Thanks
Muk

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-date-compare-not-working-as-documented-tp2994330p2994330.html
Sent from the Drools: User forum 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] Decision Tables with Business Rule Tasks?

2011-05-27 Thread Michael Anstis
You can add the ruleflow-group Attribute to the XLS form, or in Guvnor
using the guided editor.

Decision Tables compile to a common form that KnowledgeBuilder uses to
create your engine; so AFAIK using them in a flow should not be a problem.

With kind regards,

Mike

On 26 May 2011 22:03, mmcintosh michael.g.mcint...@citi.com wrote:

 Is it possible to use a decision table to specify the rule for a business
 rule task? How is the ruleFlowGroup specified?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Decision-Tables-with-Business-Rule-Tasks-tp2990517p2990517.html
 Sent from the Drools: User forum 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: [rules-users] drools date compare not working as documented

2011-05-27 Thread magaram
I got this test case to work with Drools 5.1.1 - but I think the latest 5.2
distribution has an issue with date comparision.

--
View this message in context: 
http://drools.46999.n3.nabble.com/drools-date-compare-not-working-as-documented-tp2994330p2994394.html
Sent from the Drools: User forum 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] Decision Tables with Business Rule Tasks?

2011-05-27 Thread mmcintosh
Thanks for your response. I have not seen any example of this. Where does the
ruleFlow-group attribute go on the spreadsheet?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Decision-Tables-with-Business-Rule-Tasks-tp2990517p2994420.html
Sent from the Drools: User forum 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] Decision Tables with Business Rule Tasks?

2011-05-27 Thread Michael Anstis
The same place as any attribute, like Salience, Agenda-Group etc

Section 5.1.4.2. Keywords in Drools Expert 5.1.1's documents talks about
it a bit.

Cheers,

Mike

On 27 May 2011 22:02, mmcintosh michael.g.mcint...@citi.com wrote:

 Thanks for your response. I have not seen any example of this. Where does
 the
 ruleFlow-group attribute go on the spreadsheet?

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Decision-Tables-with-Business-Rule-Tasks-tp2990517p2994420.html
 Sent from the Drools: User forum 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: [rules-users] Catch 22 ANTLR DSL matching issue

2011-05-27 Thread Wolfgang Laun
See inline.

On 27 May 2011 20:19, jstroup jstr...@regenstrief.org wrote:

 Hi Droolers,

 Regarding this blurb from the 5.2 DSL reference:


 [snip]


 Given this DSL (test_expander.dsl)

  [when](C|c)heese is {type}=Cheese(type=={type})
  [when](is|hails|comes) from {country}=Cheese(country=={country})
  [then]Add the message {message}=System.out.println({message});

 And this DSLR

  package com.sample
  import com.sample.DroolsTest.Cheese;
  expander test_expander.dsl

  rule rule_1
when
   Cheese is cheddar and is from Italy
then
Add the message Cheddar IS from Italy
  end


This will not do what the text implies because the expansion is
   Cheese(type==cheddar) Cheese(country===Italy)
and there is nothing that links these Cheese facts, which could
be one and the same but also any other pair matching the
individual constraints.



 I know that rule_2 fails because I removed the “distinctive characters” so
 ANTLR is confused on what to capture.


ANTLR has nothing to do with DSL expansion, which is entirely based on
regular expressions.


 It just seems so unnatural for a rule
 author to have to somehow magically know to add quotes in order to merge
 different DSL expressions to generate a composite DRL pattern.


The DSL designer has a range of options (characters, buzz words,...) but at
the
end of the day (s)he will have to document it for the rule authors. There's
no
way they'll know what to write, out of the blue.


  2) We can no longer just write “Cheese is cheddar” by itself but are
 forced to write “Cheese is cheddar and” if we want to match only the first
 expression. You might as well just combined the two expressions into one
 since there is no real advantage now to having two expressions!


There is a feature for adding arbitrary constraints into a preceding
pattern.



 One nice thing would be for the Guvnor DSL editor to

  1)try the capture greedily first,
  2)get the annoying “no viable alternative error”,
  3)CATCH the error instead of just giving up,
  4)capture non-greedily and match only the first word,
  5)then search for matching DSL expressions beyond that.

 Or something like that.


Exactly. There is the fundamental problem of different levels of grammars
for DRL and natural languages, and this can't be overcome easily.



 The only time you should have to add quotes is if
 the text you are matching actually contains multiple words. Anything else
 is
 counter-intuitive.


The DSL designer can avoid this, at the cost of slightly more verbose
phrases.



 Please tell me the planned replacement for DSL addresses
 this!


Feel free to contribute proposals (but not something like that, please).
Wolfgang



 Jeff


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