Re: [rules-users] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-15 Thread Mario Fusco
Hi Josep,

as I anticipated the propName vs. getPropName() issue was only a red herring
and totally unrelated with the actual bug. Investigating in more detail your
test case I found that the problem is that in some circumstances, when using
fireUntilHalt, a single working memory action (insert/update/delete) is not
processed atomically as it should. This causes that it can make to fire a
rule even before than the consequences of such action have been completely
propagated to all the nodes of the rete network. 

Yesterday evening I finished developing a fix for this issue that also makes
your test case to pass. However I only pushed it on a branch of my personal
guthub repo (
https://github.com/mariofusco/drools/commit/6d7a849f0920e95c22aa913f0cc5b741b1ddb92b
) because there are still some outstanding details that I am discussing with
the other members of the team. 

I'll let you know when we decide that the fix is ok and merge it to the
master.

Cheers,
Mario



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029587.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-15 Thread jlprat
Hi Mario,

is there any progress? Could you find anything?

Best,
Josep



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029581.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread jlprat
Ah yeah, sorry I forgot about this Map.
If you remove it and you just print in the standard output, you have the
same behavior. I just used a map to have something to assert against, this
test code it's not the best code I ever wrote 

Josep



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029527.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread Wolfgang Laun
On 12/05/2014, jlprat  wrote:
> Hi,
> I also thing there is something buggy with salience and the planner.
> However, what puzzles me is that this behavior is changed when using the
> getter instead of the direct access to the property.
>
> Do you know if there is already a reported bug like this? If there is none,
> I will create one.
>
> BTW, when you say, "/proper syncing on the map/", what do you mean exactly?
> I don't have any map.

You have Map ruleCalls, which is updated from the
event handler from the thread running fireUntilHalt() and checked in
the thread inserting the events. The sleeps should be long enough, but
it's not comme-il-faut.

-W

>
> Best,
> Josep
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029521.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread jlprat
Anytime!
I'll keep an eye on this :)

Thanks for time!

Josep



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029524.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread Mario Fusco
Hi Josep,

probably there are 2 different issues here, but I am not sure because I
haven't run your test case yet. I'll do it asap. 

The first issue could be something similar to what has been already reported
here https://issues.jboss.org/browse/DROOLS-311

As for the different behaviour you found in using the property name vs.
accessing it with the getter the only thing I can say at the moment is that
Wolfgang is right when he wrote that it doesn't depend on mvel. At the
moment I think that you're just experiencing a weird side effect of the
problem reported in DROOLS-311, but again I cannot be sure until I haven't
given a run to your test case.

I'll keep you updated on my findings.

Thanks for having reported this,
Mario 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029523.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread jlprat
Hi,
I also thing there is something buggy with salience and the planner.
However, what puzzles me is that this behavior is changed when using the
getter instead of the direct access to the property.

Do you know if there is already a reported bug like this? If there is none,
I will create one.

BTW, when you say, "/proper syncing on the map/", what do you mean exactly?
I don't have any map.

Best,
Josep



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029521.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread Wolfgang Laun
Repeated executions show varying results: sometimes it's OK, sometimes it isn't.

I don't think it's a race condition in your code (although proper
syncing on the map would be the "clean" way to go).

I think that salience doesn't work properly )(6.0.0, OP used 6.0.1.),
if a fact is matched unconditionally by a high salience rule and the
same fact is matched using constraints in rules with lesser priority.

(Wasn't this recognized before as a bug in 6.0.x?)

-W




On 12/05/2014, jlprat  wrote:
> Hi,
> I updated my test code to use your way of creating the Knowledge Base
> (using
> KieBase) and I have the exact same results. Does anyone have an idea why
> this is still failing?
>
> Furthermore, I think the way I was initializing my rules is also supported
> by Drools 6, because it's almost copied line by line from the Official
> Drools API page:
> https://docs.jboss.org/drools/release/6.0.1.Final/kie-api-javadoc/
>
> /
> A Typical example to load a rule resource.
>
> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
> kbuilder.add( ResourceFactory.newUrlResource( url ),
>   ResourceType.DRL );
> if ( kbuilder.hasErrors() ) {
> System.err.println( builder.getErrors().toString() );
> }
>
> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
> kbase.addKnowledgePackages( builder.getKnowledgePackages() );
>
> StatefulKnowledgeSession ksession =
> knowledgeBase.newStatefulKnowledgeSession();
> ksession.insert( new Fibonacci( 10 ) );
> ksession.fireAllRules();
>
> ksession.dispose();/
>
> Best,
> Josep
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029517.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-12 Thread jlprat
Hi,
I updated my test code to use your way of creating the Knowledge Base (using
KieBase) and I have the exact same results. Does anyone have an idea why
this is still failing?

Furthermore, I think the way I was initializing my rules is also supported
by Drools 6, because it's almost copied line by line from the Official
Drools API page:
https://docs.jboss.org/drools/release/6.0.1.Final/kie-api-javadoc/

/
A Typical example to load a rule resource.

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource( url ),
  ResourceType.DRL );
if ( kbuilder.hasErrors() ) {
System.err.println( builder.getErrors().toString() );
} 

KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( builder.getKnowledgePackages() );

StatefulKnowledgeSession ksession =
knowledgeBase.newStatefulKnowledgeSession();
ksession.insert( new Fibonacci( 10 ) );
ksession.fireAllRules();

ksession.dispose();/

Best,
Josep



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029517.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-09 Thread Wolfgang Laun
You are using a class called KnowledgeBuilder. With Drools 6,
it is KieBuilder. Here is some simple code, good for testing (as I used it),
although more sophisticated build procedures are recommended
using maven and what not. - Both DRL versions (getAbxDef and abcDef) appear to
work with 6.0.0 Final.

KieServices kieServices = KieServices.Factory.get();
KieFileSystem kfs = kieServices.newKieFileSystem();
FileInputStream fis = new FileInputStream( "lostrule/lostrule.drl" );
kfs.write( "src/main/resources/lostrule.drl",
kieServices.getResources().newInputStreamResource( fis ) );
KieBuilder kieBuilder = kieServices.newKieBuilder( kfs ).buildAll();
Results results = kieBuilder.getResults();
if( results.hasMessages( Message.Level.ERROR ) ){
System.out.println( results.getMessages() );
throw new IllegalStateException( "### errors ###" );
}

KieContainer kieContainer =
kieServices.newKieContainer(
kieServices.getRepository().getDefaultReleaseId() );

KieBaseConfiguration config = kieServices.newKieBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);
KieBase kieBase = kieContainer.newKieBase( config );
kieSession = kieContainer.newKieSession();


On 09/05/2014, jlprat  wrote:
> Hi,
> I added the AnEvent class in the gist. You can check it out now:
> https://gist.github.com/jlprat/f20e6dbe976cff163d2c
>
> Best,
> Josep
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029496.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-09 Thread jlprat
Hi,
I added the AnEvent class in the gist. You can check it out now:
https://gist.github.com/jlprat/f20e6dbe976cff163d2c

Best,
Josep



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-LHS-Possible-Bug-tp4029494p4029496.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-09 Thread Wolfgang Laun
MVEL has nothing to do with the possibility of using abcXyz in a
constraint instead of the more cumbersome getAbcXyz(). Actually,
abcXyz is the "native" way of accessing a fact's attribute from within
DRL patterns.

So, if getAbcXyz() works, but abcXyz does not, I suspect that
something else is amiss, perhaps in the code of AnEvent.java, which
hasn't been posted.

-W


On 09/05/2014, jlprat  wrote:
> Hi all,
>
> I'm developing an application with Drools 6.0.1.Final and I'm encountering
> a
> really strange problem I can't understand, and which I think it's due to a
> bug in MVEL.
>
> I'm running some rules using fireUntilHalt and if I use the MVEL syntax
> withing the RHS to access some bean properties, some rules don't get
> executed when they should. However if I replace the bean property syntax
> sugar for the real getter method, everything works as it should.
>
> I've created a little gist to illustrate this problem, it contains 2 drools
> versions (one using MVEL another without) and a test to check the behavior.
> You can check it  Rule is not fired
> 
>
> Does anybody have an idea why this is happening?
>
>
> Thank you in advance.
> Josep Prat
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-RHS-Possible-Bug-tp4029494.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] Rules don't execute using MVEL syntax in RHS - Possible Bug

2014-05-09 Thread jlprat
Hi all,

I'm developing an application with Drools 6.0.1.Final and I'm encountering a
really strange problem I can't understand, and which I think it's due to a
bug in MVEL.

I'm running some rules using fireUntilHalt and if I use the MVEL syntax
withing the RHS to access some bean properties, some rules don't get
executed when they should. However if I replace the bean property syntax
sugar for the real getter method, everything works as it should.

I've created a little gist to illustrate this problem, it contains 2 drools
versions (one using MVEL another without) and a test to check the behavior.
You can check it  Rule is not fired
  

Does anybody have an idea why this is happening?


Thank you in advance.
Josep Prat



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rules-don-t-execute-using-MVEL-syntax-in-RHS-Possible-Bug-tp4029494.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