Re: [rules-users] Annotation @PropertyReactive not works

2014-08-09 Thread Davide Sottara
Regarding the @Pr issue: yes, afaik newer versions are fixed. If not,
they are more likely to be fixable.
Thanks
Davide

On 08/09/2014 12:34 PM, Michael Anstis wrote:
>
> Regarding the Guvnor question; we don't support the time element of
> dates at the moment. 
> It should however be a simple change and I am happy to support you
> submitting a pull request to fix in a later version. Unfortunately we
> simply do not have the time to fix ourselves at present.
>
> Sent on the move
>
> On 9 Aug 2014 16:20, "David Moros Claramunt"  <mailto:davidmo...@gmail.com>> wrote:
>
> Do you know if the issue is solved in some later version?
>
> Also, I have another problem with Guvnor, in scenarios test I
> can´t set a date with time in Date field, is possible set it?I
> have changed the format Date and DateTime in .properties but fail
>     the conversion too
>
> thanks,
>
>
> 2014-08-08 15:26 GMT+02:00 Davide Sottara  <mailto:dso...@gmail.com>>:
>
> If I remember correctly this is a known issue. Unfortunately
> drools 5.6 is final and can't be patched. Downloading the
> source drl rather than the compiled pkg could be a workaround.
> Please let me know if it works
>
> Sent via the ASUS PadFone X, an AT&T 4G LTE smartphone
>
>
>  Original Message 
> From:davidmoros  <mailto:davidmo...@gmail.com>>
> Sent:Fri, 08 Aug 2014 05:03:29 -0500
> To:rules-users@lists.jboss.org
> <mailto:to%3arules-us...@lists.jboss.org>
> Subject:[rules-users] Annotation @PropertyReactive not works
>
> I'm developing a system rules with drools, how any novice I
> found the problem
> of infinite loops, in unitary test I resolved with annotation
> @PropertyReactive and all works fine, until I uploaded my
> model and rules to
> Guvnor.
> Now I have developed a webservice that download the PKG from
> Guvnor, with
> change-set and seems that the annotation @PropertyReactive not
> works because
> of the same rule is reevaluated constantly although the
> consecuences the
> rule not change the value of attributes of LHS of rule, and
> infinite loops
> appears
> The error only occurs when I download the PKG from Guvnor, if
> I refer the
> file DRL directly all woks fine
>
> Can anybody help me?
>
> I use 5.6.0.Final Version for Drools and Guvnor, Guvnor and my
> webservice
> are deployed in Tomcat
>
> Thanks in advance
>
>
>
> --
> View this message in context:
> 
> http://drools.46999.n3.nabble.com/Annotation-PropertyReactive-not-works-tp4030602.html
> Sent from the Drools: User forum mailing list archive at
> Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto: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] Annotation @PropertyReactive not works

2014-08-08 Thread Davide Sottara
If I remember correctly this is a known issue. Unfortunately drools 5.6 is 
final and can't be patched. Downloading the source drl rather than the compiled 
pkg could be a workaround.
Please let me know if it works

Sent via the ASUS PadFone X, an AT&T 4G LTE smartphone

 Original Message 
From:davidmoros 
Sent:Fri, 08 Aug 2014 05:03:29 -0500
To:rules-users@lists.jboss.org
Subject:[rules-users] Annotation @PropertyReactive not works

>I'm developing a system rules with drools, how any novice I found the problem
>of infinite loops, in unitary test I resolved with annotation
>@PropertyReactive and all works fine, until I uploaded my model and rules to
>Guvnor.
>Now I have developed a webservice that download the PKG from Guvnor, with
>change-set and seems that the annotation @PropertyReactive not works because
>of the same rule is reevaluated constantly although the consecuences the
>rule not change the value of attributes of LHS of rule, and infinite loops
>appears
>The error only occurs when I download the PKG from Guvnor, if I refer the
>file DRL directly all woks fine
>
>Can anybody help me? 
>
>I use 5.6.0.Final Version for Drools and Guvnor, Guvnor and my webservice
>are deployed in Tomcat 
>
>Thanks in advance
>
>
>
>--
>View this message in context: 
>http://drools.46999.n3.nabble.com/Annotation-PropertyReactive-not-works-tp4030602.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] NPE in LeftTupleSetsImpl.removeUpdate

2014-07-30 Thread Davide Sottara
It has almost certainly been fixed in 6.1
Davide

On 07/31/2014 03:40 AM, David Zeigler wrote:
> Hi,
> I'm using drools 6.0.1.Final.  I received a NPE in
> the org.drools.core.common.LeftTupleSetsImpl.removeUpdate() method on
> line 172, which corresponds to this line for 6.0.1.Final:
> previous.setStagedNext( next );
>
> I see 2 commits in 6.1.0 to address NPEs in this class but I'm not
> sure if either of those cover this particular NPE.  I'm unable
> to reproduce this issue with my code after the first occurrence.  Does
> anyone know if this has been fixed in 6.1.0? Please let me know if I
> can provide additional info or if I should open a defect in Jira.
>
> Thanks,
> David
>
> Here is the stack trace:
> java.lang.NullPointerException
> at
> org.drools.core.common.LeftTupleSetsImpl.removeUpdate(LeftTupleSetsImpl.java:172)
> at
> org.drools.core.common.LeftTupleSetsImpl.addDelete(LeftTupleSetsImpl.java:84)
> at
> org.drools.core.common.SynchronizedLeftTupleSets.addDelete(SynchronizedLeftTupleSets.java:20)
> at
> org.drools.core.reteoo.LeftInputAdapterNode.doDeleteSegmentMemory(LeftInputAdapterNode.java:339)
> at
> org.drools.core.reteoo.LeftInputAdapterNode.doDeleteObject(LeftInputAdapterNode.java:301)
> at
> org.drools.core.reteoo.LeftInputAdapterNode.retractLeftTuple(LeftInputAdapterNode.java:417)
> at
> org.drools.core.reteoo.ObjectTypeNode.doRetractObject(ObjectTypeNode.java:352)
> at
> org.drools.core.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:335)
> at
> org.drools.core.reteoo.EntryPointNode.retractObject(EntryPointNode.java:395)
> at
> org.drools.core.common.NamedEntryPoint.delete(NamedEntryPoint.java:605)
> at
> org.drools.core.common.AbstractWorkingMemory.delete(AbstractWorkingMemory.java:1184)
> at
> org.drools.core.common.AbstractWorkingMemory.delete(AbstractWorkingMemory.java:1176)
> at
> org.drools.core.impl.StatefulKnowledgeSessionImpl.delete(StatefulKnowledgeSessionImpl.java:316)
>
>
> ___
> 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] Defeasible: NPE: with multiple @Defeasible

2014-07-25 Thread Davide Sottara
Fixed, in PR status. It was indeed another bug.
https://github.com/sotty/drools/commit/7941a0c8d7e66c6c7719c14ca58d798337d067d8

Thanks for reporting, we really appreciate the feedback
Davide

On 07/23/2014 10:58 PM, Borris wrote:
> On 22/07/2014 22:44, Mark Proctor wrote:
>> Stack trace shows the error:
>> org.drools.core.beliefsystem.defeasible.DefeasibleBeliefSet.removeUndefeated(DefeasibleBeliefSet.java:295)
>> https://github.com/sotty/drools/blob/master/drools-core/src/main/java/org/drools/core/beliefsystem/defeasible/DefeasibleBeliefSet.java
>>
>> Maybe have a go fixing it yourself? And submit the fix with a unit test, as 
>> a pull request?
>> http://docs.jboss.org/drools/release/5.6.0.Final/droolsjbpm-introduction-docs/html/gettingstarted.html
>>
> I might well have a go, but there's a whole bunch of learning I need to 
> do before I can submit my first candidate patch. So don't expect 
> something too quickly.
>
> Borris
>
> ___
> 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] Are globals not permitted with queries?

2014-07-25 Thread Davide Sottara
Confirmed, the NPE is a bug.. The use case was not covered.
A tentative fix is here, we'll discuss it next week

https://issues.jboss.org/browse/DROOLS-564
https://github.com/sotty/drools/commit/9db38d098e67560839b36661bdf24a5f5cdae1df

Davide

On 07/23/2014 10:56 PM, Borris wrote:
> I want to pass strings around between rules and queries to control their 
> actions and provide control values. I know I can just use "literals" but 
> I know from past experience that that leads to small typos not being 
> detected (either at compile time or run time) and leads to nasty subtle 
> errors down the line.
>
> For rules, you can over come this with a bunch of public static final 
> String in a class (I call mine Consts) - and then any spelling mistakes 
> become compile time issues as you are matching against a 
> variable/constant name and if you spell this right then you know you get 
> the right control string.
>
> But does anyone have a technique that works with queries? I know lots of 
> the docn talks about queries being things you can invoke from Java. But 
> I use queries in my rules (they have a private stack and support 
> recursion that rules don't quite do in the same way). Does anyone have a 
> clever technique they've used in the past?
>
> Thanks
>
> Borris
>
>
> On 22/07/2014 17:16, Davide Sottara wrote:
>> The case may not be supported, but even then, it should be reported as
>> a compilation error, not as a NPE
>> I'll investigate and report back later
>> Thanks
>> Davide
>>
>> On 07/22/2014 05:48 PM, Borris wrote:
>>> I was experimenting with ways of avoiding having to put literal strings
>>> into my rules (it is very fragile and bugs can be silent for a long
>>> time). I tried declaring a global and then tried supplying it to a
>>> query. This generates a backtrace during the newKieSession. A simple
>>> example to provoke the problem:
>>>
>>>
>>>   KieServices ks = KieServices.Factory.get();
>>>   KieContainer kContainer = ks.getKieClasspathContainer();
>>>   KieSession kSession =
>>> kContainer.newKieSession("ksession-rules");
>>>
>>>   kSession.setGlobal("AString", "Hello World");
>>>
>>>   kSession.fireAllRules();
>>>
>>>
>>>
>>> package com.sample
>>>
>>> global java.lang.String AString;
>>>
>>> declare Thing
>>>   name: String @key
>>> end
>>>
>>> rule init
>>>   when
>>>   then
>>>   insert( new Thing( AString ) );
>>> end
>>>
>>> query test(String $in)
>>>   Thing( $in; )
>>> end
>>>
>>> rule spot
>>>   when
>>>   test( "Hello World"; )
>>>   Thing( "Hello World"; )
>>>   test( AString; )
>>>   Thing( AString; )
>>>   then
>>>   System.out.println("found msg\n");
>>> end
>>>
>>>
>>> java.lang.NullPointerException
>>>   at
>>> org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:243)
>>>   at
>>> org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:263)
>>>   at
>>> org.drools.core.rule.LogicTransformer.fixClonedDeclarations(LogicTransformer.java:134)
>>>   at
>>> org.drools.core.rule.LogicTransformer.transform(LogicTransformer.java:99)
>>>   at
>>> org.drools.core.definitions.rule.impl.RuleImpl.getTransformedLhs(RuleImpl.java:560)
>>>   at
>>> org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:105)
>>>   at 
>>> org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:100)
>>>   at
>>> org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1455)
>>>   at
>>> org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1435)
>>>   at
>>> org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:838)
>>>   at
>>> org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:266)
>>>   at
>>> org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:412)
>>>   at
>>> org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:346)
>>>   at

Re: [rules-users] [optaplanner] creating dynamic fact classes(planning entity and planning variables) in Optaplanner

2014-07-24 Thread Davide Sottara
Declared types support annotations. You'll have to import it

package my.drl;
import my.SomeAnnotation;

declare Foo
@SomeAnnotation
bar : String
end

When the declare is processed, the class builder will try to resolve the
annotation
and, if found, will wire it to the class being generated.
If this does not work, it's a bug, so please report it as such.
Davide

On 07/24/2014 11:19 AM, colorful.world wrote:
> Hi Geoffrey,
>
> Thanks for reply.
> What we use for declaring fact type is just to have class declaration in drl
> file. Since this drl string is loaded at runtime, we are able to have
> dynamic class structures and drools rules from DB.
> So, I am wondering if we can have dynamic Planning Entity and Variables in
> Optaplanner. 
> Please share, if you have another similar ideas to achieve this.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/optaplanner-creating-dynamic-fact-classes-planning-entity-and-planning-variables-in-Optaplanner-tp4030473p4030476.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-516 - Continued Memory Leak problem Drools 6.1.0.

2014-07-22 Thread Davide Sottara
Ack'd and queued.

On 07/22/2014 11:46 PM, Kent Anderson wrote:
> It appears there is another condition where Drools holds onto memory
> indefinitely. (See https://issues.jboss.org/browse/DROOLS-516)
>
> Use case: We have a set of rules designed to detect a heartbeat, then
> report when/if the heartbeat stops.
>
> Problem: In the normal case of a constant heartbeat, memory is
> retained in the JVM, even though the fact count in working memory is 1.
>
> The following rules produce this problem.  I have attached a test
> project that demonstrates this problem.  600K events are inserted into
> the stream, then the test driver waits.  After 10 seconds, the
> "absence detected" rule fires.  Requesting a GC via JMC has no effect.
>  If you hit a key while the test driver is waiting, a new event will
> be added, which will cause the "clear absence alarm" rule to fire.  At
> this point some memory is freed automatically.  Requesting another GC
> removes all memory and the JVM is back in its (nearly) new condition.
>
> We consider this a memory leak since the events are gone from working
> memory and will no longer be considered in any rule evaluations, but
> they are still active somewhere in the JVM.
>
> packageorg.drools.example.api.kiemodulemodel 
>
> import demo.Event 
>
> declareEvent
> @role( event )
> @timestamp( timestamp )
> end
>
> declare Heartbeat
> @role( event )
> @timestamp( event.timestamp )
> event   : Event
> end
>
> declare AbsenceDetected
> name: String
> end
>
> /*
>  * This rule matches the first event
>  *
>  * NOTE: This stream requires the heartbeat event
>  * to occur at least once before absence will be detected.
>  */
> rule"detect first heartbeat"
> when
> $event : Event()
> not ( Heartbeat() )
> then
> delete($event);
> insert(new Heartbeat($event));
> System.out.println("[DFH] Got event: " + $event.getEventId());
> end
>
>
> /*
>  * This rule matches every event and stores only the most recent
>  * as the heartbeat.
>  */
> rule"keep latest heartbeat"
> when
> $heartbeat : Heartbeat()
> $event : Event()
> then
> delete($heartbeat);
> insert(new Heartbeat($event));
> System.out.println("[KLH] Got event: " + $event.getEventId());
> delete($event);
> end
>
>
> /*
>  * This rule detects when a heartbeat stops for 10s
>  */
> rule"detect absence"
> duration(10s)
> when
> $heartbeat : Heartbeat()
> not ( Event() )
> not (AbsenceDetected() )
> then
> delete($heartbeat);
> insert(new AbsenceDetected("Absence"));
> System.out.println("[DA] Absence detected");
> end
>
> /*
>  * This rule detects when the heartbeat starts again after 
>  * absence has been detected.
>  */
> rule"clear absence alarm"
> when
> $heartbeat : Heartbeat()
> $absence : AbsenceDetected ()
> then
> delete($absence);
> System.out.println("[CAA] Heartbeat restored");
> end
>
>
>
>
>
>
>
>
>
> ___
> 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] Are globals not permitted with queries?

2014-07-22 Thread Davide Sottara
The case may not be supported, but even then, it should be reported as
a compilation error, not as a NPE
I'll investigate and report back later
Thanks
Davide

On 07/22/2014 05:48 PM, Borris wrote:
> I was experimenting with ways of avoiding having to put literal strings 
> into my rules (it is very fragile and bugs can be silent for a long 
> time). I tried declaring a global and then tried supplying it to a 
> query. This generates a backtrace during the newKieSession. A simple 
> example to provoke the problem:
>
>
>  KieServices ks = KieServices.Factory.get();
>  KieContainer kContainer = ks.getKieClasspathContainer();
>  KieSession kSession = 
> kContainer.newKieSession("ksession-rules");
>
>  kSession.setGlobal("AString", "Hello World");
>
>  kSession.fireAllRules();
>
>
>
> package com.sample
>
> global java.lang.String AString;
>
> declare Thing
>  name: String @key
> end
>
> rule init
>  when
>  then
>  insert( new Thing( AString ) );
> end
>
> query test(String $in)
>  Thing( $in; )
> end
>
> rule spot
>  when
>  test( "Hello World"; )
>  Thing( "Hello World"; )
>  test( AString; )
>  Thing( AString; )
>  then
>  System.out.println("found msg\n");
> end
>
>
> java.lang.NullPointerException
>  at 
> org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:243)
>  at 
> org.drools.core.rule.LogicTransformer.processElement(LogicTransformer.java:263)
>  at 
> org.drools.core.rule.LogicTransformer.fixClonedDeclarations(LogicTransformer.java:134)
>  at 
> org.drools.core.rule.LogicTransformer.transform(LogicTransformer.java:99)
>  at 
> org.drools.core.definitions.rule.impl.RuleImpl.getTransformedLhs(RuleImpl.java:560)
>  at 
> org.drools.core.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:105)
>  at org.drools.core.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:100)
>  at 
> org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1455)
>  at 
> org.drools.core.impl.KnowledgeBaseImpl.addRule(KnowledgeBaseImpl.java:1435)
>  at 
> org.drools.core.impl.KnowledgeBaseImpl.addPackages(KnowledgeBaseImpl.java:838)
>  at 
> org.drools.core.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:266)
>  at 
> org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:412)
>  at 
> org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:346)
>  at 
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:498)
>  at 
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:469)
>  at com.sample.DroolsTest.main(DroolsTest.java:17)
>
>
> The 3rd action in the spot rule causes the null exception during 
> initialise, if it is present. Comment out just that line and no 
> exceptions happen and behaviour is as expected.
>
> Are globals permitted in the way I am trying to use them, as a parameter 
> to a query?
>
> Borris
>
>
>
>
> ___
> 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] Dynamically loading rules in KieBase

2014-07-22 Thread Davide Sottara
You can add rules programmatically to an existing KieBase, but you have to:

1) add/replace the resource in the KieFileSystem
2) Cast the KieBuilder to InternalKieBuilder and use the
incrementalBuild() method
3) Enjoy and report problems as this is a newer feature

See the test suite here
https://github.com/droolsjbpm/drools/blob/184765346e998430064a4935fbb358930946d82c/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java

the latest tests show the use of the incremental builder
Davide

On 07/22/2014 04:20 PM, marianbuenosayres wrote:
> I'm bumping this question for general interest on other possible solutions,
> and to give my two cents. 
>
> The closest I was to getting this feature in Drools 6 from the public APIs,
> is to use a persistent session. Then, when I loaded an existing session, I
> would pass a newly created KieBase, like this
>
> KieStoreServices kstore = KieServices.Factory.get().getStoreServices();
>
> KieBase kbase = ...; //create a Kie Base
> Environment env = ...; //create an environment
> KieSession ksession = kstore.newKieSession(kbase, null, env);
> Integer sessionId = ksession.getId();
>
> KieBase kbase2 = ...; //updated Kie base
> KieSession ksessionReloaded = ks.loadKieSession(kbase2, null, env);
>
> ksession and ksessionReloaded would be the same working memory and agenda,
> but the kie base they work with would change. 
>
> Hope this helps, but I hope more for an alternative
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Dynamically-loading-rules-in-KieBase-tp4030351p4030425.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] Question about getObjects() on workspace with defeasible belief system

2014-07-21 Thread Davide Sottara
getObjects() will return all the objects. However, an object's HANDLE
will be in the default x-or in the "neg" entry-point, depending on whether
the object was asserted in the positive or negative form, and depending
on the conflict resolution by defeasibility.
In my snippet, "myNegatedObject" was supposedly an object in "negative"
form.

If you are trying to build a pretty printer, you may just want to iterate
the fact handles directly. Methods such as
session.getEntryPoints()
session.getEntryPoint( entryPointName ).getFactHandles();
will help

On 07/22/2014 12:41 AM, Borris wrote:
> And thanks for the response!
>
> A quick question on your example code before I try it:
>
> On 21/07/2014 21:24, Davide Sottara wrote:
>> Notice that "negatively" asserted facts end up in a "negative" entry
>> point, so you have to look them
>> up explicitly:
>> InternalFactHandle negHandle = (InternalFactHandle)
>> session.getEntryPoint( "neg" ).getFactHandle( myNegatedObject );
>>
> Is myNegatedObject just the set that getObjects() returned or is there 
> another enumeration method I should use? Ie do I Iook for a neg entry 
> point object for each object I get back from ksession.getObjects() or do 
> I need to acquire a collection from another place (as well) if I want to 
> enumerate everything in the workspace for my dumpWorkspace() pretty printer?
>
> Thanks
>
> Borris
>
> ___
> 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] Question about getObjects() on workspace with defeasible belief system

2014-07-21 Thread Davide Sottara
Thanks for the feedback! The defeasible subsystem is still very
experimental,
and it's good to know that people are using it.

This said, as for your question. It is possible, but takes a little
effort since we
don't have a public API for that. You can do:

// get the handle for the object
InternalFactHandle handle = (InternalFactHandle) session.getFactHandle(
myObject );
// lookup the belief set, where all justifiers (pos and neg) are stored
and linked
DefeasibleBeliefSet dbs = (DefeasibleBeliefSet)
posHandle.getEqualityKey().getBeliefSet();
DefeasibilityStatus status = dbs.getStatus();

status now has 4 values:
DEFINITELY (strict), DEFEASIBLY, DEFEATEDLY (defeated), UNDECIDEDLY
(unresolved conflict)

Notice that "negatively" asserted facts end up in a "negative" entry
point, so you have to look them
up explicitly:
InternalFactHandle negHandle = (InternalFactHandle)
session.getEntryPoint( "neg" ).getFactHandle( myNegatedObject );

Again, we are currently working on this specific system even now, so
things may change in 6.2,
but this should work in 6.1.
Please report any issue that you might find.
Best
Davide

On 07/21/2014 08:57 PM, Borris wrote:
> I am trying the Defeasible belief system (it ties in pretty well with 
> some of how I want
> to structure my project).
>
> After fixing many typos, the rule behaviour seems to be what it should 
> for a defeasible
> rule being correctly defeated (my clash spotter doesn't fire, which it 
> does if any
> part of the defeasible chain is broken). Which is all jolly fun and good 
> and exciting.
>
> But, my question.
>
> I have a simple workspace dump based upon getting all objects (via 
> ksession.getObjects() )
> and then doing my own tidy presentation. This still shows the defeated 
> fact as present.
>
> So I know there is still record somewhere of the defeated fact, because 
> if the workspace
> changed such that my defeater was retracted, then it needs to make the 
> fact visible again.
>
> But I wasn't expecting to see it via getObjects(). Is that the intended 
> behaviour? If so,
> is there a way to enquire whether a fact is in the "defeated state" or 
> not that I could
> add to my tidy workspace dumper?
>
> Thanks!
>
> Borris
>
> ___
> 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] Problem when I cleaning the production memory.

2014-07-16 Thread Davide Sottara
Oops, it's !., not .!
On Jul 16, 2014 5:39 AM, "braveheart85" 
wrote:

> I have tried your hint and i got:
>
> query "dis"
> $result : PersonData( businessActivity.!status == "CLOSED")
> end
>
> [48,38]: [ERR 101] Line 48:38 no viable alternative at input '.' in query
> [0,0]: Parser returned a null Package
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030369.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] Problem when I cleaning the production memory.

2014-07-16 Thread Davide Sottara
Not checking for nulls is a debatable behavior :)
In 5.6 you should be able to use the null safe accessor
Business activity.!status == ...
Which will be rewritten to do the check for you
On Jul 16, 2014 4:33 AM, "braveheart85" 
wrote:

> Yesterday I tried version 5.6. I have had a problem with the MVEL syntax.
>
> rule "RULE1"
>   $result: PersonData( businessActivity.status == "CLOSED" )
> end
>
> This rule that works in the version 5.5, now have a problem in version 5.6:
>
> unable to invoke method:
> org.titan.registry.filter.BusinessActivityData.getStatus: target of method
> is null
>
> The problem is that not all Person facts inside the working memory have a
> business activity. NullPointer would be quite correct but in version 5.5
> the
> behaviour was different...
>
> Maybe I'm abusing of your kindness.
> Andrea
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030367.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] Problem when I cleaning the production memory.

2014-07-15 Thread Davide Sottara
Conceptually you are right, but in practice, when you add a rule/query
to the KBase all the available facts are propagated through the newly
built piece of RETE. Since you clear all the rules first (which has some
cost)
and then you build a new set of rules, the effect is very similar - only,
the engine will implicitly re-insert the objects for you.
Now, a clean insertion has some costs (like the creation of the handles),
so it would be interesting to benchmark the two alternatives.

>From a developer's perspective, moving the objects from a session into
another is as simple as this:

for ( Object o : oldSession.getObjects() ) {
newSession.insert( o );
}

and if you can't (re)compile the source code, there is little that can be
done to solve your problem. Unless there is a multi-threading issue,
that is, you have different threads adding facts, removing rules/queries
and adding the new ones. If that was the case, I would not be surprised
since 5.5 was not thread safe.

Davide







On 07/15/2014 02:29 PM, braveheart85 wrote:
> My users can apply a filter (query in Drools) and the result facts are tagged
> to be shown. 
> Filters can be from a filter library or also directly written by users.
> I need to clear the production memory and set new knowledge (filter) each
> time in order to get filter result.
>
> First solution you propose is a bit problematic for me because i'd have to
> reinsert all facts inside the working memory but I don't keep these objects
> outside Drools. In my context facts are fixed while rules/queries are
> variables. I'd have to query Drools for all facts, then instantiate a new
> KnowledgeBase and finally reinsert all facts...
>
> What do you think?
>
> Thanks
> Andrea
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030361.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] Problem when I cleaning the production memory.

2014-07-15 Thread Davide Sottara
What are you trying to do exactly when you "clear" the knowledge base?

If you need to replace all the rules, I'd just create a new KB altogether..
facts would be reasserted into the new rules anyway.

If you need to update some of the rules, Drools 5.x had the KnowledgeAgent
for this purpose. To be fair, however, in 5.5 it still had some issues
that were
fixed in 5.6.

I may be missing some of the requirements, though.
Davide


On 07/15/2014 10:19 AM, braveheart85 wrote:
> I suppose the problematic query is:
>
> query "Get Fixed BusinessEntities"
>   $result : BusinessEntityData( queryable == true )
> end
>
> What you means with increase and decrease node sharing?
> Sorry, maybe I didn't study very well the reteeo part of the documentation.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030355.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] Workaround: EventFactHandle retained in memory after FactCount reaches 0 for temporal-based rule

2014-07-14 Thread Davide Sottara
Thanks, we'll look at it tomorrow
Davide

On 07/15/2014 02:09 AM, Kent Anderson wrote:
> https://github.com/droolsjbpm/drools/pull/358
>
> Per your advice, this pull request sets up the memory leak, but it
> cannot verify that it exists without diving into internal drools
> structures. 
>
> Please let me know what else we can do to facilitate fixing this issue.
>
>
> On Jul 14, 2014, at 2:09 PM, Davide Sottara  wrote:
>
>> I'd need to check, but if you can put together the basics of the test
>> case - the combination of rules and facts that causes the leak,
>> we'll add the checks to ensure it's solved. Mark should have given
>> you enough pointers to the style we use for test cases.
>> We really appreciate your collaboration, and since this is a critical
>> bug we'll fix it asap
>> Thanks!!
>> Davide
>>
>> On 07/14/2014 08:33 PM, Kent Anderson wrote:
>>> Is there a reliable way to find an EventFactHandle instance buried
>>> within the TupleEntryQueue's and the PhreakPropagationContext's?
>>>
>>> The multiple containers of interface/impl's makes it nearly
>>> impossible to write a "good" test that can peak under the hood where
>>> this memory leak is being held.  If there is a recommended way to do
>>> it, I'd be happy to do so.
>>>
>>>
>>> 
>>>
>>>
>>> On Jul 13, 2014, at 7:31 PM, Mark Proctor >> <mailto:mproc...@codehaus.org>> wrote:
>>>
>>>> Could you submit a unit test as a pull request?
>>>> http://docs.jboss.org/drools/release/5.5.0.Final/droolsjbpm-introduction-docs/html/gettingstarted.html
>>>>
>>>> Add it to here, and follow existing conventions:
>>>> https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/CepEspTest.java
>>>>
>>>> Mark
>>>> On 11 Jul 2014, at 20:38, Kent Anderson >>> <mailto:kent.ander...@psware.com>> wrote:
>>>>
>>>>> We have found a workaround that eliminates the leftover event
>>>>> (gone from Working Memory, but not from the JVM memory): 
>>>>>
>>>>> The rule "forget it ever happened" (seen below) causes the
>>>>> problem.  Re-writing it to remove the check for RAISE in the LHS
>>>>> eliminated the memory leak.  Of course, our application requires
>>>>> the check for RAISE, so it can be accomplished by manually
>>>>> querying working memory from the RHS.  It's ugly, but it resolved
>>>>> the issue.
>>>>>
>>>>> query existsRaise($id)
>>>>> $raise : MyEvent( eventState == EventState.RAISE, eventId == $id )
>>>>> end
>>>>>
>>>>> rule "process clear"
>>>>> no-loop
>>>>> when
>>>>> $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId)
>>>>> then
>>>>> QueryResults results =
>>>>> kcontext.getKieRuntime().getQueryResults( "existsRaise", $clearId );
>>>>> if (results.size() == 0) { 
>>>>> System.out.println( "Forwarding CLEAR(" + $clearId + ")" ); 
>>>>> } else {
>>>>> System.out.println("Forgetting RAISE/CLEAR(" + $clearId
>>>>> + ")");
>>>>> for (QueryResultsRow row : results){
>>>>> MyEvent raise = (MyEvent) row.get ("$raise");
>>>>> delete(raise);
>>>>> }
>>>>> }
>>>>> delete($clear);
>>>>> end
>>>>>
>>>>> This appears to be a similar situation
>>>>> to https://issues.jboss.org/browse/DROOLS-498.
>>>>>
>>>>>
>>>>>
>>>>> On Jul 10, 2014, at 3:54 PM, Kent Anderson
>>>>> mailto:kent.ander...@psware.com>> wrote:
>>>>>
>>>>>> Correction:  The original post did not include another rule that
>>>>>> exists in the stream.  The memory leak does not appear unless
>>>>>> both rules are active in the stream.
>>>>>>
>>>>>> declare MyEvent 
>>>>>>   @role(event) 
>>>>>>   @timestamp(timestamp) 
>>>>>> end 
>>>>>>
>>>>>> /* If a RAISE is buffered for N seconds, send it out */
>>>>>&

Re: [rules-users] Problem when I cleaning the production memory.

2014-07-14 Thread Davide Sottara
I assume you can't recompile the source code of 5.5 either...
If not, the only workaround is 1) try to identify which rule or rules cause
the problem, 2) rewrite them to increase (or reduce) the node sharing
On Jul 14, 2014 2:13 PM, "braveheart85" 
wrote:

> Hi Davide,
>
> Thanks for the reply.
> Unfortunately I cannot migrate to version 5.6 or newer.
> Today I have inspected that part of code, but it is quite huge and complex
> in the Reeteo part.
> I have seen the NullPointer is due to the "nodes" retrieved from the
> "rules"
> Map (line 250).
> Moreover, this non-deterministic behaviour complicates everything.
>
> 65 private Map   rules;
>
> 244public synchronized void More ...removeRule(final Rule rule) {
> 245// reset working memories for potential propagation
> 246InternalWorkingMemory[] workingMemories =
> this.ruleBase.getWorkingMemories();
> 247
> 248final Object object = this.rules.remove( rule );
> 249
> 250final BaseNode[] nodes = (BaseNode[]) object;
> 251final RuleRemovalContext context = new RuleRemovalContext( rule
> );
> 252for (final BaseNode node : nodes) {
> 253node.remove( context,
> 254 this,
> 255 null,
> 256 workingMemories );
> 257}
> 258
> 259resetMasks(context);
> 260}
>
> I don't know if you can help me in some way...
> Thanks in all cases.
> Andrea
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030344.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] Problem when I cleaning the production memory.

2014-07-14 Thread Davide Sottara
Can you try 5.6 or a later version?
That part of logic was improved in 5.6, and rewritten in 6.x
Davide

On 07/14/2014 04:54 PM, braveheart85 wrote:
> I forgot to say what version I'm using. The version of Drools is 5.5.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Problem-when-I-cleaning-the-production-memory-tp4030341p4030342.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] Workaround: EventFactHandle retained in memory after FactCount reaches 0 for temporal-based rule

2014-07-12 Thread Davide Sottara
Thanks for reporting, we'll investigate both this and 498
Davide

On 07/11/2014 08:38 PM, Kent Anderson wrote:
> We have found a workaround that eliminates the leftover event (gone
> from Working Memory, but not from the JVM memory): 
>
> The rule "forget it ever happened" (seen below) causes the problem.
>  Re-writing it to remove the check for RAISE in the LHS eliminated the
> memory leak.  Of course, our application requires the check for RAISE,
> so it can be accomplished by manually querying working memory from the
> RHS.  It's ugly, but it resolved the issue.
>
> query existsRaise($id)
> $raise : MyEvent( eventState == EventState.RAISE, eventId == $id )
> end
>
> rule"process clear"
> no-loop
> when
> $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId)
> then
> QueryResults results = kcontext.getKieRuntime().getQueryResults(
> "existsRaise", $clearId );
> if (results.size() == 0) { 
> System.out.println( "Forwarding CLEAR(" + $clearId + ")" ); 
> } else {
> System.out.println("Forgetting RAISE/CLEAR(" + $clearId + ")");
> for (QueryResultsRow row : results){
> MyEvent raise = (MyEvent) row.get ("$raise");
> delete(raise);
> }
> }
> delete($clear);
> end
>
> This appears to be a similar situation
> to https://issues.jboss.org/browse/DROOLS-498.
>
>
>
> On Jul 10, 2014, at 3:54 PM, Kent Anderson  > wrote:
>
>> Correction:  The original post did not include another rule that
>> exists in the stream.  The memory leak does not appear unless both
>> rules are active in the stream.
>>
>> declare MyEvent 
>>   @role(event) 
>>   @timestamp(timestamp) 
>> end 
>>
>> /* If a RAISE is buffered for N seconds, send it out */
>> rule"forward raise"
>> no-loop
>> duration(3s)
>> when
>> $raise : MyEvent(eventState == EventState.RAISE, $raiseId : eventId)
>> then
>> System.out.println("Forwarding RAISE(" + $raiseId + ")");
>> delete($raise);
>> end
>>
>> /* When CLEAR, and buffered, clear them both out */
>> rule"forget it ever happened"
>> no-loop
>> when
>> $clear : MyEvent(eventState == EventState.CLEAR, $clearId : eventId)
>> $raise : MyEvent(eventState == EventState.RAISE, eventId == $clearId)
>> then
>> System.out.println("Forgetting RAISE/CLEAR(" + $clearId + ")");
>> delete($clear);
>> delete($raise);
>> end
>>
>>
>> On Jul 10, 2014, at 2:50 PM, Kent Anderson > > wrote:
>>
>>> The following rule produces a memory leak in Drools 6.1.0-SNAPSHOT:
>>>
>>> (Stream mode)
>>>
>>> declare MyEvent 
>>>   @role(event) 
>>>   @timestamp(timestamp) 
>>> end 
>>>
>>> /* If a RAISE is buffered for N seconds, send it out */
>>> rule"forward raise"
>>> no-loop
>>> duration(3s)
>>> when
>>> $raise : MyEvent(eventState == EventState.RAISE, $raiseId : eventId)
>>> then
>>> System.out.println("Forwarding RAISE(" + $raiseId + ")");
>>> delete($raise);
>>> end
>>>
>>>
>>> I see the rule fire as expected, printing out the message 3 seconds
>>> after the event is added into the session.  While the event is
>>> waiting, I see a FactCount of 1 in the session.  After the rule
>>> fires, the fact count goes to 0.  However, using JVisualVm, querying
>>> the heap dump shows 1 instance of MyEvent, referenced by an
>>> EventFactHandle and several other Drools objects.
>>>
>>> Is this a bug, or is there a better way to write this rule so
>>> Drools' internals let go of the object after it is no longer a fact?
>>>
>>> 
>>>
>>> 
>>> ___
>>> 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: [rules-users] unexpected/spurious ClassCastException

2014-07-09 Thread Davide Sottara
Ok, so there is indeed a problem in the way the query is invoked

The input arguments are of type ContextFoodItem, while the formal
arguments of the query are FoodItem.
The compiler should do a type check (which is probably missing) and
report an error at compile time.
This throws an exception in the query body, and this is the exception I
see when I run your test case.

java.lang.RuntimeException:
com.sample.Rule_isExampleOf0Eval0Invoker@152d453a :
java.lang.ClassCastException: com.sample.ContextFoodItem cannot be cast
to com.sample.FoodItem
at org.drools.core.rule.EvalCondition.isAllowed(EvalCondition.java:123)
at
org.drools.core.phreak.PhreakEvalNode.doLeftInserts(PhreakEvalNode.java:55)


Actually, the exception you reported initially was

Exception in thread "main" java.lang.ClassCastException: 
com.tastiereasier.rulez.ContextFoodItem cannot be cast to 
com.tastiereasier.domain.FoodItem
 at 
ConditionEvaluator3754d879fb5b46a3b2cfbe61326ba9f5.evaluate(Unknown Source)
 at 
org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:216)
 at 
org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:185)
 at 

but it probably happens if the second part of the query - the join with
the recursive call - is triggered.

As for the "enabled" flag, it does not prevent the evaluation of the
LHS. It only disables the actual
execution of the RHS.

Let me investigate some more
Davide



On 07/09/2014 11:49 AM, Borris wrote:
> On Wednesday 09/07/2014 14:41, Davide Sottara wrote:
>> Sorry for not being able to get back to you again earlier.
>> Yes, the rule / query you are showing makes sense - I would have asked
>> you for something similar :) It is definitely a bug in the resolution of
>> the class that defines an attribute, we could really use the reproducer
>> to fix it quickly.
>>
>> I'll check the "enabled" attribute's behavior in 6.x
>> Thanks
>> Davide
> I'll tidy up the the test case I've generated and email it to you.
>
> Just to be clear, the cast exception was caused by a mistake on my part 
> in the when part of a rule, but in a rule with an "enabled false" 
> attribute. I had done the standard thing of gradually disabling bits 
> until the error went away, but had not allowed for the exception being 
> triggered with enabled false, so had assumed (not unreasonably I argue 
> :) ) that the initially supplied rules must be the cause of the problem.
>
> At least, that's my conclusion - but the test case will let you decide 
> independently.
>
> Borris
>
> ___
> 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] unexpected/spurious ClassCastException

2014-07-09 Thread Davide Sottara
Sorry for not being able to get back to you again earlier.
Yes, the rule / query you are showing makes sense - I would have asked
you for something similar :) It is definitely a bug in the resolution of
the class that defines an attribute, we could really use the reproducer
to fix it quickly.

I'll check the "enabled" attribute's behavior in 6.x
Thanks
Davide


On 07/07/2014 06:11 PM, Borris wrote:
> On Monday 07/07/2014 23:26, Davide Sottara wrote:
>> I'll try to reproduce the exception with the rule and the data model.
>> Meanwhile, could you share a self-contained unit test that reproduces
>> the problem?
>> That would speed up the fix process
>> Thanks!
>> Davide
> Hmm. Worked out what is happening. The exception is triggered by these:
>
> rule handleComplexFoodItemClash
>  enabled false
>  when
>  $first: ContextFoodItem( $item, true; )
>  $second: ContextFoodItem( this != $item, avoid == false )
>  isExampleOf( $second, $first; )
>  then
>  retract($second);
> end
>
> query isExampleOf (FoodItem $subject, FoodItem $category)
>  (
>  eval($subject == $category)
>  )
>  or
>  (
>  BroaderNarrower($broader, $subject;)
>  and
>  ?isExampleOf($broader, $category;)
>  )
> end
>
> This is the last thing I was playing with, so maybe not surprising 
> there's an error (the exception arises because of the isExampleOf query 
> and is a simple bug for me to fix).
>
> BUT BUT BUT I have "enabled false" as a rule attribute. Am I missing 
> something - I expected this to mean that the when part is never 
> evaluated, but it looks more like the when part is evaluated but 
> consequences are not added to the agenda. The documentation is 
> sufficiently terse that both viewpoints could be argued :(
>
> Borris
>
> ___
> 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] unexpected/spurious ClassCastException

2014-07-07 Thread Davide Sottara
I'll try to reproduce the exception with the rule and the data model.
Meanwhile, could you share a self-contained unit test that reproduces
the problem?
That would speed up the fix process
Thanks!
Davide

On 07/07/2014 04:24 PM, Borris wrote:
> On Monday 07/07/2014 23:09, Borris wrote:
>> Hi,
>>
>> Thanks for the response.
>>
>> Version is now 6.1.0.201407061813 (snapshot from last night). Previous
>> version was 6.1.0.201406070605 (snapshot from about a month ago). I was
>> on a snapshot because I wanted the fix for this:
>> https://github.com/droolsjbpm/droolsjbpm-tools/commit/6bc54748e
> Slight "my bad" - I'd forgoten to do a new runtime and use that. Fixed. 
> Still get the same issue, but some of the line numbers are slightly 
> different, in case that's relevant.
>
> Exception in thread "main" java.lang.ClassCastException: 
> com.tastiereasier.rulez.ContextFoodItem cannot be cast to 
> com.tastiereasier.domain.FoodItem
>  at 
> ConditionEvaluator3754d879fb5b46a3b2cfbe61326ba9f5.evaluate(Unknown Source)
>  at 
> org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:216)
>  at 
> org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:185)
>  at 
> org.drools.core.common.SingleNonIndexSkipBetaConstraints.isAllowedCachedLeft(SingleNonIndexSkipBetaConstraints.java:141)
>  at 
> org.drools.core.phreak.PhreakJoinNode.doLeftInserts(PhreakJoinNode.java:98)
>  at org.drools.core.phreak.PhreakJoinNode.doNode(PhreakJoinNode.java:60)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:547)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:533)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:334)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.evalStackEntry(RuleNetworkEvaluator.java:224)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
>  at 
> org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:216)
>  at 
> org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:91)
>  at 
> org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
>  at 
> org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
>  at 
> org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
>  at 
> org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1212)
>  at com.tastiereasier.rulez.Rulez.insertAndFire(Rulez.java:168)
>  at com.tastiereasier.rulez.Rulez.addDinerToContext(Rulez.java:310)
>  at com.tastiereasier.rulez.Rulez.(Rulez.java:101)
>  at com.tastiereasier.rulez.Rulez.main(Rulez.java:44)
>
> ___
> 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] unexpected/spurious ClassCastException

2014-07-07 Thread Davide Sottara
What is the relationship (extends/implements) between the classes/interfaces
in your model - ContextFoodItem, FoodItem, ContextDiner, etc.. ?
Could you also please specify the version of Drools you are using?
Thanks!
Davide

On 07/07/2014 03:04 PM, Borris wrote:
> I am getting an unexpected cast exception. The backtrace looks like
>
> Exception in thread "main" java.lang.ClassCastException: 
> com.tastiereasier.rulez.ContextFoodItem cannot be cast to 
> com.tastiereasier.domain.FoodItem
>  at 
> ConditionEvaluatorb792d1e4169f4ac98945e49e1412d793.evaluate(Unknown Source)
>  at 
> org.drools.core.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:216)
>  at 
> org.drools.core.rule.constraint.MvelConstraint.isAllowedCachedLeft(MvelConstraint.java:185)
>  at 
> org.drools.core.common.SingleNonIndexSkipBetaConstraints.isAllowedCachedLeft(SingleNonIndexSkipBetaConstraints.java:141)
>  at 
> org.drools.core.phreak.PhreakJoinNode.doLeftInserts(PhreakJoinNode.java:98)
>  at org.drools.core.phreak.PhreakJoinNode.doNode(PhreakJoinNode.java:60)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.switchOnDoBetaNode(RuleNetworkEvaluator.java:547)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.evalBetaNode(RuleNetworkEvaluator.java:533)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:334)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.evalStackEntry(RuleNetworkEvaluator.java:224)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166)
>  at 
> org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:116)
>  at 
> org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:193)
>  at 
> org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:68)
>  at 
> org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:928)
>  at 
> org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1193)
>  at 
> org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1202)
>  at 
> org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1175)
>  at com.tastiereasier.rulez.Rulez.insertAndFire(Rulez.java:168)
>  at com.tastiereasier.rulez.Rulez.addDinerToContext(Rulez.java:310)
>  at com.tastiereasier.rulez.Rulez.(Rulez.java:101)
>  at com.tastiereasier.rulez.Rulez.main(Rulez.java:44)
>
> The rules that are triggering this are:
>
> rule contextDinerDislike
>  enabled true
>  when
>  ContextDiner( $diner; )
>  DatumPreference
>  (
>  datumPreferenceType == DatumPreference.Type.PREFERENCE,
>  belief.factor < 0.0,
>  $datum: datum
>  )
>  from $diner.getDatumPreferences()
>  then
>  insert( new ContextFoodItem( (FoodItem) $datum, true ) );
> end
>
> rule spotNewContextDinerLike
>  enabled true
>  when
>  ContextDiner( $diner; )
>  DatumPreference
>  (
>  datumPreferenceType == DatumPreference.Type.PREFERENCE,
>  belief.factor > 0.0,
>  $datum: datum
>  )
>  from $diner.getDatumPreferences()
>  then
>  insert( new ContextFoodItem( (FoodItem) $datum, false ) );
> end
>
> If I disable either rule, then the other proceeds fine and no cast 
> exception happens.
>
> I can't see why the cast should ever be asked for - it doesn't make sense.
>
> If I changed the boolean parameter in the new in the insert - so both 
> are either true or both
> are either false, there are no cast exceptions (there must be a clue here).
>
> If I put a debug after the insertion, the backtrace actually happens 
> after return from the
> insert() method - implying it's something on the agenda?
>
> I tried using the Audit stuff to see if it gave any clues - but I've 
> never used that before
> and simply got a heap exhaustion from Eclipse after 1/2 hour trying to 
> ingest something like 200
> meg of trace data - I've got a lot of data being initialised into the 
> workspace before these rules
> get a chance to do anything.
>
> It's feeling remarkably like a bug to me, but I don't know how to 
> interpret the backtrace usefully,
> so it's possible I've got something messed up elsewhere - although I've 
> disabled massive amounts
> of rules that I can.
>
> I grabbed a snapshot last night and it didn't change anything. (I was on 
> a snapshot from early June to fix being able to have Drools editor 
> reference my external jars.)
>
> Does this look like a bug or user error? It's going to take some effort 
> to try and extract a test case
> so I really don't want to spend the effort on that unless it looks the 
> only way.
>
> Sage observations most appreciated.
>
> Borris
>
>
>
> ___
> rules-users

Re: [rules-users] Unable to resolve class error , drools 5.5 in concurrent execution. JSR94Support and Spring

2014-07-02 Thread Davide Sottara
5.5 was not thread-safe and some of these concurrency issues have been
fixed in later versions.
Could you try 5.6 or 6.x?

On 07/02/2014 08:19 AM, maruthi_s wrote:
> Hi ,
>
> We use Drools 5.5 and drool implementation is done through Spring
> JSR94Support API>
> The Rule engine is called in concurrent mode,
> i.e , JSR94Support.executeStateless(name,list) is executed through multiple
> threads.
>
> And when the rules are executed  we randomly get the following exception
>
> org.drools.RuntimeDroolsException: Unable to resolve class 'someclass(this
> is sample)here actual class is printed>'
> at
> org.drools.base.ClassFieldAccessorCache.getClass(ClassFieldAccessorCache.java:126)
> at
> org.drools.base.ClassFieldAccessorCache.getClassObjectType(ClassFieldAccessorCache.java:48)
> at
> org.drools.reteoo.ClassObjectTypeConf.(ClassObjectTypeConf.java:83)
> at
> org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:71)
> at
> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:159)
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
> at
> org.drools.reteoo.ReteooStatelessSession.executeWithResults(ReteooStatelessSession.java:273)
>
> The rules are registered every 15 minutes through
> RuleAdministrator.registerRuleExecutionset ,
> so whenever we refresh the rules and the subsequent thread even after the
> registration is completed, fails with the above message. This happens only
> when the rules are invoked concurrently.
>
> Please advise. 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Unable-to-resolve-class-error-drools-5-5-in-concurrent-execution-JSR94Support-and-Spring-tp4030226.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] accumulate function not registered

2014-06-18 Thread Davide Sottara
can you please open a jira ticket and possibly add a reproducer?
It seems a serious regression, but it would have to be reproduced
and fixed in the next few days for this to make it to the final release
Thanks!
Davide

On 06/18/2014 03:26 PM, rogerL wrote:
> After upgrade to 6.1.0.CR1 rule compilation is generating a pluggable
> accumulate function registration error.
>
> Partial stack dump:
> Caused by: java.lang.RuntimeException: Error while creating KieBase[Message
> [id=1, level=ERROR,
> path=com/s/c/manager/rules/campaign/priority/prioritize.drl, line=31,
> column=0
>text=Unknown accumulate function: 'topPriority' on rule 'Insert highest
> priority campaign'. All accumulate functions must be registered before
> building a resource.], Message [id=2, level=ERROR,
> path=com/s/c/manager/rules/campaign/priority/prioritize.drl, line=31,
> column=0
>text=Rule Compilation error $tc cannot be resolved to a variable]]
>
> The associated rule and accumulate import are:
>
> import accumulate com.s.c.util.HighestPriorityCampaignAccumulateFunction
> topPriority;
>
> rule "Insert highest priority campaign"
> when
> not TopCampaign()
> accumulate(TargetCampaigns($list : list, list.size >0), $tc :
> topPriority( $list ) )
> then
> insert(new TopCampaign($tc));
> end
>
> Is this syntax no longer correct?
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/accumulate-function-not-registered-tp4030102.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] Adding eval on rule cause it to run in infinite loop

2014-06-11 Thread Davide Sottara
I think I know what is happening here.
I assume your supportFT class is @propertyReactive.
(btw, you should follow bean conventions and capitalize class names)
Looking at Rule 1, you don't set the value directly, but you do it through
a modify. Your rule 2, which checks for the value, uses the function
"containsAny"
rather than the field direclty as in "value IN (..)".
At the moment, the engine has no way to realize that the function
involves the field "value" - I'm not even sure it is possible in general -
Property reactivity will ignore the update since, from its perspective, none
of the fields relevant to the rule has been affected, hence rule 2 will
not hit.
If you use eval in the constraint, property reactivity is disabled, so
the rule
WILL fire the first time, but now you are vulnerable to infinite loops,
as if
you did not have propertyreactive.
You may have to use the @watch() annotation explicitly to control which
modifies will cause reevaluations and which ones won't (see the manual
for this)
Adding "eval" everywhere is not a good idea.
Best,
Davide
 




On 06/11/2014 01:53 PM, brachi wrote:
> example of rule that doesn't work without eval:
>
> /*rule "1"
> salience -1
> agenda-group "agenda1"
> when
> $conclusion: supportFT()
> then
>   if($conclusion.getValue()==null){
>   modify($conclusion) { setValue(new ArrayList())};
>   }
>   $conclusion.getValue().add("supportedValue");
> modify($conclusion) { setValue($conclusion.getValue()) };
>  end
>
>
> rule "2"
> salience -2
> agenda-group "agenda2"
> when
> supportFT(Operators.containsAny(value,new
> String[]{"supportedValue","otherValue"}))  
>   $conclusion: ConclusionFt()
> then
>   modify($conclusion){setValue("success")};
> end*/
>
> rule "2" doesn't hit, works only with eval in rule "2".
> in this example I can add eval, because the Fact Types model is different,
> so the rule doesn't reevaluated.
> because I had this case, I decided to add eval for all constraints, but
> unfortunately I had an infinite loop. 
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-infinite-loop-tp4029966p4029984.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] Adding eval on rule cause it to run in infinite loop

2014-06-11 Thread Davide Sottara
Could you please show the conditions for which you need the eval?
And which version are you using? As far as I know, eval is rewritten and
removed internally in latest versions, so there shouldn't be a difference.


On 06/11/2014 12:34 PM, brachi wrote:
> I need the eval. 
> I have some rules that doesn't hit correctly, just if I put eval around the
> condition.
> but eval makes the rules to run in an infinite loop.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-infinite-loop-tp4029966p4029979.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] Adding eval on rule cause it to run in infinite loop

2014-06-11 Thread Davide Sottara
The whole point of @propertyReactive is to avoid no-loop where possible.
What Wolfgang was trying to say is that there is no need to use the eval:
just write
DvFacts0( condIsNUMERIC == null )
and the @propertyReactivity will work
Davide

On 06/11/2014 10:40 AM, brachi wrote:
> so, will "no-loop" help?
> is eval also override this attribute?
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Adding-eval-on-rule-cause-it-to-run-in-infinite-loop-tp4029966p4029971.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] Are there second-rate fact types?

2014-06-10 Thread Davide Sottara
In fact what we have now is *NOT* graceful
I'll open a JIRA and try to provide a fix


On 06/10/2014 01:52 PM, Wolfgang Laun wrote:
> On 10/06/2014, Davide Sottara  wrote:
>> java.util.Collections (and descendants) are not @typesafe by default,
>> I'll check the reason for that.
> OK.
>
>> More generally, if a fact is declared as not @typesafe, the runtime
>> failure should be more graceful.
> But (according to you)  java.util.Collections is *not* @typesafe, and
> this runtime failure cannot be called "graceful".
>
> Can a java.util.X be declared as @typesafe? If so, how? Is any of this
> documented anywhere?
>
> -W
>
>> Davide
>>
>> On 06/10/2014 01:26 PM, Wolfgang Laun wrote:
>>> Consider:
>>>
>>>class Foo { /*...*/ }
>>>
>>>rule checkFoo
>>>when
>>>   Foo( noSuchField > 0 )
>>>then ... end
>>>
>>> DRL compilation reports an error (Error: unable to resolve method ...)
>>> and identifies rule, line and column, which is fine.
>>>
>>> Now let's look at:
>>>
>>>import java.util.ArrayList;
>>>rule checkArrayList
>>>when
>>>   ArrayList( noSuchField > 0 )
>>>then ... end
>>>
>>> The same DRL compiler (checked with 5.5.0 and 6.0.0) accepts this, and
>>> there is a nasty exception thrown at runtime. This is inconvenient,
>>> since the exception can be thrown by any code inserting an ArrayList
>>> object, and the faulty rule isn't identified.
>>>
>>> Why are certain classes second-rate?
>>>
>>> -W
>>> ___
>>> 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: [rules-users] Are there second-rate fact types?

2014-06-10 Thread Davide Sottara
java.util.Collections (and descendants) are not @typesafe by default,
I'll check the reason for that.
More generally, if a fact is declared as not @typesafe, the runtime
failure should be more graceful.
Davide

On 06/10/2014 01:26 PM, Wolfgang Laun wrote:
> Consider:
>
>class Foo { /*...*/ }
>
>rule checkFoo
>when
>   Foo( noSuchField > 0 )
>then ... end
>
> DRL compilation reports an error (Error: unable to resolve method ...)
> and identifies rule, line and column, which is fine.
>
> Now let's look at:
>
>import java.util.ArrayList;
>rule checkArrayList
>when
>   ArrayList( noSuchField > 0 )
>then ... end
>
> The same DRL compiler (checked with 5.5.0 and 6.0.0) accepts this, and
> there is a nasty exception thrown at runtime. This is inconvenient,
> since the exception can be thrown by any code inserting an ArrayList
> object, and the faulty rule isn't identified.
>
> Why are certain classes second-rate?
>
> -W
> ___
> 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] Abstraction between rules and data model?

2014-06-02 Thread Davide Sottara
I can't guarantee a public date.. as a community member, I work on a
"best effort" basis...
I'll try to do it before the end of the month, though.
For now, as a workaround, I would create derived getter/setter pairs
that expose the desired
computations. A concrete example of what you are trying to do exactly
would also be helpful,
feel free to contact me privately if you can't share your code here
Best
Davide

On 05/28/2014 10:08 AM, Péter Gergely, Horváth wrote:
> Thanks for the explanation, I was a bit confused because of the
> terminology; "virtual" is not mentioned in the docs. ;)
>
> Is there any plan for the public release of Trait property binding to
> a nested path? We would definitely need something like that in our
> environment. Or do you see any way we could hook into the property
> look-up mechanism? Based on what I know, I don't see any official
> extension point for that.
>
> My only idea would be using some Java proxy voodoo-magic to wrap
> objects before they are inserted to the session, but my gut feeling is
> that it would be a way to debug hell... 
>
> What do you think?
>
> Cheers,
> Peter
>
>
>
> 2014-05-27 19:42 GMT+02:00 Davide Sottara  <mailto:dso...@gmail.com>>:
>
> Consider that a trait is an interface applied to some class. In
> the context of the pair:
> A "hard" field is a property (get/set) exposed by the interface
> AND the underlying class
> A "soft" (or "virtual") field is a property exposed by the
> interface BUT NOT by the underlying class
> A "hidden" field is a field of the underlying class NOT exposed by
> the interface
>
> Hard and Soft fields can be accessed using the interface, hidden
> fields are accessible using the map-like
> construct fields[ "fieldName" ].
>
> This said,
> the mapping is by default done using the property name and (then)
> the property type.
> However, this mapping can be decoupled using the annotation
> @Alias() on either the class OR the trait.
> E.g.
> declare Core
>   name : String @Alias( "any-Id-or-even-an-IRI-here" )
> end
>
> declare trait SomeTrait
> label : String @Alias( "..." )  // if two "aliases" match,
> this will be considered a hard field
> end
>
> The "accessor", i.e. the ability to bind a trait property to a
> (possibly deeply) nested path is what I'm working
> on these days, I have the same requirement from another urgent use
> case
>
> For the time being, you can probably create a "shortcut" accessor
> pair in your implementation class,
> to execute the complex expression, and @Alias it to the trait field.
>
> Please let me know if you find any issue/bugs and any feature
> request you may have!
> Best
> Davide
>
>
>
> On 05/27/2014 07:57 AM, Horváth Péter Gergely wrote:
>> Hi Davide,
>>
>> Drools trait functionality is one of the powerful concepts which
>> makes Drools a good candidate for the project. So keep up the
>> good work! :) However I'm not sure if its current level of
>> flexibility would be sufficient for our use case. I've checked
>> the documentation, but haven't really found the term virtual
>> field -- could you please elaborate on this?
>>
>> Do you think we could somehow hook into the evaluation of the
>> aliases or the "fields" Map? Sometimes you would need slightly
>> more than merely aliasing fields to something else; e.g.
>> calculating values for the purpose of rule processing or
>> extracting a value from a more complex object tree etc. Citing
>> the example -- GoldenCustomer( fields[ "age" ] > 18 ) -- being
>> able to get a reference to the target object and the field map
>> expression "age" would be quite close to what I imagined. Our
>> custom code could then perform the appropriate translation and
>> return the requested value, hiding the fact whether "age" is an
>> actual field in the Customer object itself/retrieved from an
>> encapsulated complex object e.g. replacing expression
>> "customer.personalInformation.birthData.age"/calculated on the
>> flight.  
>>
>> What do you think?
>>
>> Cheers,
>> Peter
>>
>>
>>
>> 2014-05-26 17:58 GMT+02:00 Davide Sottara > <mailto:dso...@gmail.com>>:
>>
>> We are work

Re: [rules-users] Not and forall operator behaviour

2014-05-29 Thread Davide Sottara
Both should fire when there is no message.

This said, the two are not equivalent.
The negation of
Message( sent == true, status != INITIALIZED )
is:
Message( sent == false *||* status == INITIALIZED )
That is, by deMorgan's laws, you need to negate
the operators AND flip the and/or connectives.

In case something still seems weird, could you
please specify the drools version you're using,
as well as which facts you are inserting exactly?

Thanks
Davide


On 05/29/2014 09:33 PM, rogerL wrote:
> Are the two following statements not equivalent?
>
> forall($msg:Message()
> Message(this==$msg, sent==true, status!=State._INITIALIZED)
> )
>
>
> not( Message(sent==false, status==State._INITIALIZED) )
>
> My understanding is that they both ensure that there are no Message objects
> in WM with property 'sent' set to false and property 'status' set to
> State._INITIALIZED.
>
> In my situation, the 'forall' approach is working as expected, the 'not'
> approach fires once (when there are no Message objects in WM) and never
> again.
>
> Appreciate if anyone could shed light on this.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Not-and-forall-operator-behaviour-tp4029761.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] Abstraction between rules and data model?

2014-05-27 Thread Davide Sottara
Consider that a trait is an interface applied to some class. In the
context of the pair:
A "hard" field is a property (get/set) exposed by the interface AND the
underlying class
A "soft" (or "virtual") field is a property exposed by the interface BUT
NOT by the underlying class
A "hidden" field is a field of the underlying class NOT exposed by the
interface

Hard and Soft fields can be accessed using the interface, hidden fields
are accessible using the map-like
construct fields[ "fieldName" ].

This said,
the mapping is by default done using the property name and (then) the
property type.
However, this mapping can be decoupled using the annotation @Alias() on
either the class OR the trait.
E.g.
declare Core
  name : String @Alias( "any-Id-or-even-an-IRI-here" )
end

declare trait SomeTrait
label : String @Alias( "..." )  // if two "aliases" match, this will
be considered a hard field
end

The "accessor", i.e. the ability to bind a trait property to a (possibly
deeply) nested path is what I'm working
on these days, I have the same requirement from another urgent use case

For the time being, you can probably create a "shortcut" accessor pair
in your implementation class,
to execute the complex expression, and @Alias it to the trait field.

Please let me know if you find any issue/bugs and any feature request
you may have!
Best
Davide


On 05/27/2014 07:57 AM, Horváth Péter Gergely wrote:
> Hi Davide,
>
> Drools trait functionality is one of the powerful concepts which makes
> Drools a good candidate for the project. So keep up the good work! :)
> However I'm not sure if its current level of flexibility would be
> sufficient for our use case. I've checked the documentation, but
> haven't really found the term virtual field -- could you please
> elaborate on this?
>
> Do you think we could somehow hook into the evaluation of the aliases
> or the "fields" Map? Sometimes you would need slightly more than
> merely aliasing fields to something else; e.g. calculating values for
> the purpose of rule processing or extracting a value from a more
> complex object tree etc. Citing the example -- GoldenCustomer( fields[
> "age" ] > 18 ) -- being able to get a reference to the target object
> and the field map expression "age" would be quite close to what I
> imagined. Our custom code could then perform the appropriate
> translation and return the requested value, hiding the fact whether
> "age" is an actual field in the Customer object itself/retrieved from
> an encapsulated complex object e.g. replacing expression
> "customer.personalInformation.birthData.age"/calculated on the flight.
>  
>
> What do you think?
>
> Cheers,
> Peter
>
>
>
> 2014-05-26 17:58 GMT+02:00 Davide Sottara  <mailto:dso...@gmail.com>>:
>
> We are working on the trait framework for cases like this.
> Essentially,
> it allows to use
> interfaces when writing rules AND to inject the interfaces dynamically
> at runtime,
> at the instance level. It relies on transparent proxies which wrap the
> data classes
> and implement the required interfaces. A simple field aliasing
> mechanism
> is provided
> (work in progress). For more complex transformations, "virtual" fields
> can be added.
> See section 7.7.8 of the manual for more details and let me know if it
> can help
> with your use case.
> Best,
> Davide
>
> On 05/26/2014 09:55 AM, Wolfgang Laun wrote:
> > Even a relatively sophisticated transformation would be easier
> to implement
> > and most certainly safer from changes in the unstable Drools API
> than some
> > hook-and-intercept mechanism built into Drools.
> >
> > Notice that violent structural departure of the model the BUs
> see from what
> > you call "persistence model" might make it impossible for the
> BUs to come
> > up with rules that can be transformed to match the other model
> at all;
> > if it is possible, rules might still incur a heavy performance
> penalty.
> >
> > It is (IMHO) a myth that "Rules" is a foolproof way of establishing
> > business logic
> > independent from the data model and application environment with
> which
> > this logic should be able to cooperate. As long as everything is
> kept in the
> > abstract (i.e., formulated in terms of mathematics) it will look
>  good, but
> > any implementation may throw a spanner in the works, or worse.
> >
>  

Re: [rules-users] @propertyReactive not work when condition are coded in java

2014-05-26 Thread Davide Sottara
The engine analyzes the constraints to see which property a pattern is
"watching":

So, it expects something like:
Person( name == "alice" )

If you invoke your custom logic:
Person( myEqualComparator( ..., name, ... ) )
it's unlikely that the engine will recognize that a field is involved
and, even then, that it should react to.

The simplest solution is to force the pattern to react to the field,
doing either:

Person( myEqual(...), $n : name )

or, in alternative:

Person( myEqual(...) ) @watch( name )

Please let us know if it works for you.
Thanks
Davide


On 05/22/2014 02:49 PM, wtang wrote:
> I have rule1 and rule2 and rule1 is modifying an object whose property is
> checked in the when part of rule2 and rule2 should fire.
>
> The problem is rule2 is not firing.  When I took out the @PropertyReactive
> annotation, then rule2 will fire.
>
> After further investigation, I find the cause is because in the when part I
> am calling java function to do the comparison as suppose to using native
> operators like "==".
>
> Property Reactive seems to be not working when in the WHEN part of the rules
> we are calling java function to do the comparison as suppose to using native
> operators like ==, <, >, etc.  
>
> Please advice.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/propertyReactive-not-work-when-condition-are-coded-in-java-tp4029657.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] java.lang.VerifyError org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V

2014-05-26 Thread Davide Sottara
I can't tell for sure... 5.4.0 is relatively old, and there is not much
that can be done with the released jars.
I suspect that you had some duplicate, incompatible classes on the
classpath (having BOTH drools-all and the others
seems suspicious), and the classloader was 'almost always' picking up
the one that made it work. Out of pure luck.
Davide

On 05/26/2014 11:45 AM, Ivo Escamilla wrote:
>
> Thanks for your answer. It is the unique application in the server.
> The server is on my local. Right, it was working fine and then started
> throwing the exception.
>
> In the pom I had drools-core, drools-spring and drools-all-jdk5
> version 5.4.0.Final. I deleted all and use only drools- spring
> 5.4.0.Final and I solve the issue. I don't know why it works. I tried
> many things like new versions, deleted from my local and installed
> them again, with any success. It works using jetty but not with jboss.
> But using only that dependency fixed the issue. Do you know why?
>
> El may 26, 2014 11:02 AM, "Davide Sottara"  <mailto:dso...@gmail.com>> escribió:
>
> You mean that it used to work with your combination (jboss 4.2 +
> drools
> 5.4.0)
> and then it suddenly started throwing the exception?
> It seems strange.. do you have other applications deployed on the
> same
> instance
> of jboss? Maybe it's picking up a different version of the jars from
> somewhere else
> Davide
>
> On 05/26/2014 10:10 AM, ivonne wrote:
>
> > Hi
> >
> > I am using jboss 4.2 and drools core 5.4.0.Final. The
> application was
> > working fine but without any change it started to throw an error
> when spring
> > bean for kbase is created. This is the error:
> > org.springframework.beans.factory.BeanCreationException: Error
> creating bean
> > with name 'kbase': Invocation of init method failed; nested
> exception is
> > java.lang.VerifyError: (class: org/drools/reteoo/ReteooRuleBase,
> method:
> > setupRete signature: ()V) Incompatible argument to function
> >
> > If I run the application using jetty it works fine.
> >
> > I've been looking about the error with any sucess.
> >
> > Thanks
> >
> >
> >
> >
> > --
> > View this message in context:
> 
> http://drools.46999.n3.nabble.com/java-lang-VerifyError-org-drools-reteoo-ReteooRuleBase-method-setupRete-signature-V-tp4029694.html
> > Sent from the Drools: User forum mailing list archive at
> Nabble.com.
> > ___
> > rules-users mailing list
> > [hidden email]
> <http://user/SendEmail.jtp?type=node&node=4029698&i=0>
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
> ___
> rules-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4029698&i=1>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> 
> If you reply to this email, your message will be added to the
> discussion below:
> 
> http://drools.46999.n3.nabble.com/java-lang-VerifyError-org-drools-reteoo-ReteooRuleBase-method-setupRete-signature-V-tp4029694p4029698.html
>
> To unsubscribe from java.lang.VerifyError
> org/drools/reteoo/ReteooRuleBase, method: setupRete signature:
> ()V, click here
> 
> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4029694&code=aXZvbml2b25uZUBnbWFpbC5jb218NDAyOTY5NHw4MzAzODY1Mg==>.
> NAML
> 
> <http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
>
> ___
> 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] Cannot issue fireUntilHalt when using persisted session

2014-05-26 Thread Davide Sottara
Could you please show the code where you persist, reload and invoke
fireUntilHalt() on the session?
Ideally, could you open a jira ticket and post the code there? We'll
take a look then.
Thanks
Davide

On 05/22/2014 01:43 PM, rogerL wrote:
> Due to an issue with reloading persisted sessions that contained a cron timer
> rule, I upgraded to 6.1.0.Beta3. Now I'm encountering a problem with a
> threaded fireUntilHalt command (cannot be issued on a persisted session). 
>
> Exception in thread "SimpleAsyncTaskExecutor-1"
> java.lang.UnsupportedOperationException: Command session.fireUntilHalt();
> cannot be issued on a persisted session
>   at
> org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:474)
>   at
> org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353)
>   at
> org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.fireUntilHalt(CommandBasedStatefulKnowledgeSession.java:272)...
>
> It worked without issue in 6.0.1.Final. Though I suspect not, is this
> expected behaviour? Alternately, are there configuration/other changes that
> must be implemented.
>
> Libs
> spring 4.0.1
> kie, drools, jbpm 6.1.0.Beta3
> hibernate 4.3.4
>
>
>
>  
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Cannot-issue-fireUntilHalt-when-using-persisted-session-tp4029656.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] java.lang.VerifyError org/drools/reteoo/ReteooRuleBase, method: setupRete signature: ()V

2014-05-26 Thread Davide Sottara
You mean that it used to work with your combination (jboss 4.2 + drools
5.4.0)
and then it suddenly started throwing the exception?
It seems strange.. do you have other applications deployed on the same
instance
of jboss? Maybe it's picking up a different version of the jars from
somewhere else
Davide

On 05/26/2014 10:10 AM, ivonne wrote:
> Hi
>
> I am using jboss 4.2 and drools core 5.4.0.Final. The application was
> working fine but without any change it started to throw an error when spring
> bean for kbase is created. This is the error:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'kbase': Invocation of init method failed; nested exception is
> java.lang.VerifyError: (class: org/drools/reteoo/ReteooRuleBase, method:
> setupRete signature: ()V) Incompatible argument to function
>
> If I run the application using jetty it works fine.
>
> I've been looking about the error with any sucess.
>
> Thanks
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/java-lang-VerifyError-org-drools-reteoo-ReteooRuleBase-method-setupRete-signature-V-tp4029694.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] Abstraction between rules and data model?

2014-05-26 Thread Davide Sottara
We are working on the trait framework for cases like this. Essentially,
it allows to use
interfaces when writing rules AND to inject the interfaces dynamically
at runtime,
at the instance level. It relies on transparent proxies which wrap the
data classes
and implement the required interfaces. A simple field aliasing mechanism
is provided
(work in progress). For more complex transformations, "virtual" fields
can be added.
See section 7.7.8 of the manual for more details and let me know if it
can help
with your use case.
Best,
Davide

On 05/26/2014 09:55 AM, Wolfgang Laun wrote:
> Even a relatively sophisticated transformation would be easier to implement
> and most certainly safer from changes in the unstable Drools API than some
> hook-and-intercept mechanism built into Drools.
>
> Notice that violent structural departure of the model the BUs see from what
> you call "persistence model" might make it impossible for the BUs to come
> up with rules that can be transformed to match the other model at all;
> if it is possible, rules might still incur a heavy performance penalty.
>
> It is (IMHO) a myth that "Rules" is a foolproof way of establishing
> business logic
> independent from the data model and application environment with which
> this logic should be able to cooperate. As long as everything is kept in the
> abstract (i.e., formulated in terms of mathematics) it will look  good, but
> any implementation may throw a spanner in the works, or worse.
>
> -W
>
> On 26/05/2014, Péter Gergely, Horváth  wrote:
>> Hi Wolfgang,
>>
>> Thank you for your input. You are right that some of the cases could simply
>> be covered by regexp-replace, but I'm afraid, not all of them. Interfaces
>> could also help, but we have a requirement that the business rules should
>> not be tightly coupled to the underlying persistence model. (I understand
>> that some might say this is not ideal, but that is our current situation)
>>
>> I am wondering whether it is possible to hook into Drools engine and
>> intercept field value reference expression evaluations in run time (e.g if
>> "foo.bars" is used in an expression, we could return "foo.barList") ? By
>> injecting some custom code, we could make the necessary decisions and
>> extract the proper value from an object. Unfortunately these parts of
>> Drools are pretty much undocumented.
>>
>> Regards,
>> Peter
>>
>>
>>
>> 2014-05-26 13:57 GMT+02:00 Wolfgang Laun :
>>
>>> What you describe can be done with /bin/sed.
>>>
>>> Notice that the DSL processor doesn't require you to translate entire
>>> patterns; there is a mechanism for translating "keywords", which is
>>> just arbitrary tokens to whatever replacement text.
>>>
>>> If a "bar" must be translated to a "barList" in the context of a class
>>> "Foo" but not in any other context, a more sophisticated translation
>>> is required in any case (with /bin/sed still being sufficient if
>>> patterns aren't split across lines).
>>>
>>> Some say that good design makes use of Interfaces, which leaves room
>>> for actual implementations being changed as long as the interfaces are
>>> implemented. Here, note that rules can be written against interface
>>> types.
>>>
>>> -W
>>>
>>>
>>> On 26/05/2014, Péter Gergely, Horváth  wrote:
 Hi All,

 We are evaluating Drools 6 for our use case, and face challenges where
 we
 would need some ideas from more experienced users of Drools.

 We have an application with a massive code base and a large number of
>>> model
 (entity) classes. We are in the process of moving away from inherited
 legacy technologies and refactoring the old code base. As a part of
 this
 work we would like extract some of the hard-coded business logic to
 external rules, that is why we are looking at Drools as a potential
 solution.

 What we would like to have is some kind of abstraction or mapping
 between
 actual entities and rules the business users can define so that they do
>>> not
 have to know the _exact_ details of the data model (field names,
 precise
 relations etc). This would be important for us so that we can refactor
>>> the
 old model classes without affecting business rules; also it would make
>>> life
 easier for the business users. While IDE support might make refactoring
 easier, we definitely want to have a separation between rules and
>>> entities.
 Given our situation, writing and maintaining "stable" wrapper/adapter
 classes for the sole purpose of rule processing is out of question. I
>>> have
 checked the documentation of Drools DSL support and for me it seems to
 be
 overkill for our use case: we do not really need a custom language, but
 simply an abstraction between rules and the data model classes.

 What I could imagine is a piece of code, (a custom property resolver? -
>>> no
 sure how it is called) which maps property expressions to actual
>>> properties
 based on

Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread Davide Sottara
Could you please elaborate on what you mean by "suspect that sometime we
get wrong, unexpected results"?
We'd need to know at least the inputs to reproduce the possible issue
Thanks
Davide


On 05/22/2014 05:35 AM, dec wrote:
> Due to a bug we came up with the following rule:
>
> /*
> Rule "intriguing"
> when
>$foo: Foo( $foo.getBar() == null )
> then
>...
> */
>
> Our original intention was to actually generate the rule like so:
>
> /*
> Rule "intended"
> when
>$foo: Foo( bar == null )
> then
>...
> */
>
> In most cases the "intriguing" rule actually seem to behave much like the
> "intended".
> We are unsure way.
> Moreover, we suspect that sometime we get wrong, or rather unexpected
> results when firing up this rule.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647.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] Is @PropertySpecific supported in Drools 5.6.0

2014-05-21 Thread Davide Sottara
In the end it was actually named @PropertyReactive

On 05/21/2014 12:38 AM, RavishankarHassain wrote:
> I was looking fro some examples and document which explains on how to use the
> @Modifies annotations inside Facts(Java class) and it happened for me to see
> this doc 
>
> http://docs.jboss.org/drools/release/5.4.0.Beta2/droolsjbpm-introduction-docs/html/releaseNotesBeta2.html
>
> I tired to implement @PropertySpecific and @Modifies according to the
> session 3.1.2.1. Fine Grained Property Change Listeners (Property Specific)
> which is briefly described in the above mentioned link
>
> But, when I tried to use @PropertySpecific annotation in my Facts(java
> class) Eclipse IDE is not able to identify or resolve the package for
> @PropertySpecific annotation. I am using Drools 5.6.0. Is this
> @PropertySpecific annotation still supported in Drools, if yes then where is
> it ? in which package and in which jar ? 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Is-PropertySpecific-supported-in-Drools-5-6-0-tp4029633.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] Is property reactive bug in 5.5 fixed in 6.0

2014-05-06 Thread Davide Sottara
Please try 5.6 or 6.x, the problem is known in 5.5 and it won't be
possible to fix it there


On 05/06/2014 10:42 PM, wtang wrote:
> thank for all your reply!
>
> here is an example of a  rule that did not work:
>
> declare myobject
> @propertyReactive
> p1: integer
> end
>
> rule1
> when (p1 == 1)
>  p1 = 2
>
> rule2
> when (p1 == 2)
> system.out.println("hello");
>
> rule2 never get executed with propertyReactive.  Take out PR and it will
> fire.  I am still trying to figure out how to submit jira bug.  Sorry!
>
> Wing
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Is-property-reactive-bug-in-5-5-fixed-in-6-0-tp4029419p4029453.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] Is property reactive bug in 5.5 fixed in 6.0

2014-05-04 Thread Davide Sottara
Bugs about @PR were reported and fixed in 5.6 and 6.x
The fixes cover the bug described in the original thread.
More issues related with @PR were fixed here:

https://issues.jboss.org/browse/DROOLS-91?jql=project%20%3D%20DROOLS%20AND%20text%20~%20%22property%20reactive%22

If you have encountered a specific problem with one of your rules,
please report it.
Thanks
Davide



On 05/04/2014 04:34 PM, wtang wrote:
> if you please could click on the link on the original post, you will see it
> has Mark Proctor name on it and you were pushing for a fix in future release
> of 5.5.
>
> Please let me know if this bug have been fixed in 6.0.
>
> thx, Wing
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Is-property-reactive-bug-in-5-5-fixed-in-6-0-tp4029419p4029421.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] Question about length windows

2014-05-01 Thread Davide Sottara
On 05/01/2014 09:46 PM, Wolfgang Laun wrote:
> A window:length is filled depending on the constraints but independent
> of how old the participating facts are.
Currently only ALPHA constraints determine which facts are
filtered by a length window. There is a JIRA to include beta constraints,
but it has not yet been discussed.
So yes, if none of your facts had value > 102.352, it is possible for
(26) to be still in the window when (146) comes in.

Davide
>
> What you want to achieve can be done without windows:
>
>t2_1 : Tick( value < 102.352 )
>t1_1 : Tick( this before t2_1 , value >= 102.352 )
>not Tick( this before t2_1 && after t1_1 )
>
> The last pattern ascertains that the preceding pair of facts is
> adjacent. (The three timestamps should be different.)
>
> You can also use rules based on an auxiliary fact maintaining state:
> While value < 102.352, state is set to "below"; as soon as a
> fact with value >= 102.352 matches state == "below", the
> threshold is passed and state is set to "above"...
>
> -W
>
>
> On 02/05/2014, Demian Calcaprina  wrote:
>> Hi Guys, I have one question about how lenght windows will work.
>>
>> I have a rule like this. Basically, it is a "crosses" function, where the
>> value of my object crosses a value.
>>
>> rule "mytest"
>> dialect "mvel"
>> when
>> t2_1 : Tick( value < 102.352 ) over window:length (1)
>> t1_1 : Tick( this before t2_1 , value >= 102.352 ) over window:length (2)
>> then
>> //DO SOMETHING
>> end
>>
>> 23:51:32,150 INFO  [org.drools.core.audit.WorkingMemoryConsoleLogger]
>> (Camel (camel-1) thread #2 - JmsConsumer[]) ACTIVATION FIRED rule:mytest
>> activationId:berarrr_1 [0, 27, 26] declarations: t2_1=Tick [value=102.351,
>> tickTime=Fri May 02 05:51:31 ART 2014](27); t1_1=Tick [value=102.352,
>> tickTime=Fri May 02 05:51:12 ART 2014](26)
>>
>> 23:53:30,560 INFO  [org.drools.core.audit.WorkingMemoryConsoleLogger]
>> (Camel (camel-1) thread #2 - JmsConsumer[]) ACTIVATION CREATED rule:mytest
>> activationId:berarrr_1 [0, 146, 26] declarations: t2_1=Tick [value=102.349,
>> tickTime=Fri May 02 05:53:30 ART 2014](146); t1_1=Tick [value=102.352,
>> tickTime=Fri May 02 05:51:12 ART 2014](26)
>>
>> If you see, the first activation, the
>> window:length(1), matched the object 27
>> window:length(2), matched the object 26
>>
>> Then, after 2 minutes and some Ticks insertes in the WM
>> window:length(1), matched the object 146
>> but window:length(2), still matched the object 26
>>
>> I would expect, that, as object 26 was the first one to be inserted, then
>> it is outside the window:length(2).
>>
>> Is my understanding correct? Am I making something wrong? I am using Drools
>> 6.
>>
>> Thanks!
>>
>> Demian
>>
> ___
> 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] Guvnor 5.3.0 crashing OOM JoinNodeLeftTuple

2014-05-01 Thread Davide Sottara
This is unlikely a problem of the guided editor. Tuples are created when
you run the rules in a session.
We'd need to know which rules you're running and how you are
inserting/retracting facts.
Best
Davide

On 05/01/2014 01:57 PM, Jens Alejos at OAK CORP x4287 wrote:
>
> Hello,
>
>  
>
> Our Guvnor 5.3.0 is generating an OOM and crashing the server.
>
>  
>
> At the time of the crash we could see lots objects holding a lot of
> stuff in memory, most notably 23,878,166
> org.drools.reteoo.JoinNodeLeftTuple, each of which takes 72 bytes. For
> 1.7 GB of heap.
>
> I believe the real issue is something is going wrong in guvnor that it
> is creating way to many of these org.drools.reteoo.JoinNodeLeftTuple
> objects.
>
> Do you guys have had this issue? Is this because of a Guvnor guided
> editor bug?
>
>  
>
> Thanks
>
>
>
> NOTICE: This message, including any attachments, is intended for the
> use of the party to which it is addressed and may contain information
> that is privileged, confidential and exempt from disclosure. 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 contact the sender
> immediately by reply e-mail, and delete the original and any copies of
> this message. It is the sole responsibility of the recipient to ensure
> that this message and any attachments are virus free.
>
>
> ___
> 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] Distributed Drools

2014-04-23 Thread Davide Sottara
Daniel, this is a really timely message.
In the past, we did an initial experiment, creating a drools-5.x
based agent compatible with the FIPA spec.
The code is here
https://github.com/droolsjbpm/drools-mas

We are now planning to migrate to 6.x/KIE, probably over summer.
We may want to join efforts.
I'm bcc-ing Mauricio and Esteban, who worked on the initial implementation,
and of course Mark who may provide more information.

As far as I know, there is some independent work going on
regarding the creation of an "execution container". I don't know the specs,
but maybe it could also be exploited as an underlying platform.

We may try to arrange a moment to get together, in IRC or hangout.

I am definitely interested in seeing this move forward
Best
Davide


On 04/23/2014 04:53 PM, Daniel Souza wrote:
> Hi all, I'm looking for some distributed solution available with drools. I
> want to create a distributed Multi-agent architecture for my project using a
> shared working memory.
>
> Searching for solutions, I found the DJess and Octopus solution that use the
> Jess inference engine.
> For Drools, I found this one:
> http://www.plugtree.com/making-a-non-persistent-ha-knowledge-session/
> It seems that Kie is flexible enough to distribute the knowledge session in
> local ksessions, but I think that the ha-ksession doesn't provide a shared
> working memory to different kbases. Seeing the sample project, there's just
> one rule set (drl) with only one rule. I can use as a sample model to do
> what I want to do. This project showed me how I can extend the Kie and
> implement my own.
> I'm not familiar with Drools 6 yet, but I'm reading papers about distributed
> Rule-Based Systems concerning Multi-Agent Systems solutions and I didn't
> find any solution using Drools. The majority solutions were provided using a
> shared working memory with local copies. 
>
> *Than, it gives me a question: is it possible to create a shared working
> memory with Drools?*
>
> To refresh What I mean, there's an old paper showing differences between
> Blackboard Systems and Rule-Based Systems (see Figure 1).
>
> 
>  
>
> In Figure 1, the Blackboard is a shared working memory to insert facts,
> where each knowledge source (KS) is activated according with the facts
> inserted. Each KS is a specific expert with your own rules set that look for
> the blackboard to produce partial solutions that can be seen as new facts to
> be inserted in the blackboard. These partial solutions can activate more KS
> to produce new partial solutions until the final solution be reached. In
> contrast, in production systems, we build a knowledge base with a set o
> rules that can be activated according with facts inserted in a local working
> memory (there's no shared working memory between others kbases with their
> own rules set).
>
> In DJess, the authors introduce a model for distributing rule-based
> inference systems called Web of Inference Systems (WoIS). Each member of
> WoIS is composed of an inference system (IS) and a rule base, while all ISs
> operate on a single Shared Working Memory (SWM). WoIS is controlled by a
> dedicated
> component called manager (M). Each IS holds a copy of a part of the SWM in
> its local working memory, while all ISs run independently in parallel. This
> model was utilized to implement a distributed version of Jess called DJess.
> Synchronization between interfering rules is achieved by means of shadow
> facts and ghost facts. A shadow fact is a Jess fact linked to a Java bean
> object. Each shared fact is implemented as a shadow fact, and thus an
> associated Java bean object is created. All the proxies corresponding to the
> same shared fact are linked together by means of a Java remote object called
> ghost fact. Access of the ISs to the ghost facts are synchronized by
> acquiring locks during the transition from the conflict resolution stage to
> the act stage of an inference cycle.
>
> If not were done yet, I want to implement my own approach using Drools. I
> don't know if I can reach the final solution using Drools, but it seems the
> the Kie is flexible enough to be extend and I implement something. I'm
> planning to use the FIPA Subscribe protocol to synchronize the Shared
> Working Memory with a local working memory for each agent.
>
> "The FIPA Subscribe Interaction Protocol (IP) allows an agent to request a
> receiving agent to perform an action on subscription and subsequently when
> the referenced object changes"
>   
>
> Regards,
> Daniel Souza 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Distributed-Drools-tp4029338.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

Re: [rules-users] Is there a better way to write this rule?

2014-04-23 Thread Davide Sottara
I think you missed Wolfgang's points.. this form is ***WRONG***

1) It assumes that the DiscountResult is in the working memory,
which may not be the case unless you insert it explicitly
2) it will fire for ANY DiscountResult/TripRequest combination
since there is no explicit join condition between the two.
3) Bound variables are not meant to be reassigned in the RHS.
4) Even the cast in the RHS will not save you from ClassCastExceptions,
unless it's implied that destinations "Egypt" can only have
DiscountResult as results.

You need something like this:

when
$T : TripRequest( destination == "Egypt",
$dest : result,
result#DiscountResult // same as
"instanceof"here
)
then
((DiscountResult) $dest).setDiscount( 5 ); 
end 


One thing that could be done - but does not work right now,
is to expand on the "#" operator, so that whenever
you write

TripRequest( $dest : result#DiscountResult )

the variable $dest is created with DiscountResult as an
inferred type, rather than its declared type IResult
As mentioned, this does not work right now... it may
be a bug (cc-ing Mario for discussion)

Best
Davide






On 04/23/2014 04:17 AM, Leonard93 wrote:
> It only works if you do it like this:
> rule "Discount Egypt"
> salience 0
> when
> $T : TripRequest ( destination == "Egypt" )
> $dest: DiscountResult()
> then
> $dest= (DiscountResult) $T.getResult();
>$dest.setDiscount(5);
> end
>
>
> Since getResult() returns an instance of the interface IResult, it needs to
> be cast to the proper type first. But this approach does not feel better
> than the previous notation.
>
> But thanks for the replies.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Is-there-a-better-way-to-write-this-rule-tp4029327p4029333.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] java.lang.VerifyError: Bad type on operand stack

2014-04-15 Thread Davide Sottara
Looks like a bug.. can you post the DRL that generates this error?


On 04/15/2014 09:12 AM, lvtenorio wrote:
> Hello,
>
> I am writing a rules file and unit tests to test each one of them. I am
> getting this error during the execution
>
> java.lang.VerifyError: Bad type on operand stack
> Exception Details:
>   Location:
>
> ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d.evaluate(Lorg/drools/core/common/InternalFactHandle;Lorg/drools/core/common/InternalWorkingMemory;Lorg/dr
> ools/core/reteoo/LeftTuple;)Z @12: ireturn
>   Reason:
> Type 'java/lang/Boolean' (current frame, stack[0]) is not assignable to
> integer
>   Current Frame:
> bci: @12
> flags: { }
> locals: { 'ConditionEvaluator81806ffb7242407db6e6d8f829f4fd4d',
> 'org/drools/core/common/InternalFactHandle',
> 'org/drools/core/common/InternalWorkingMemory',
>  'org/drools/core/reteoo/LeftTuple' }
> stack: { 'java/lang/Boolean' }
>   Bytecode:
> 000: 2bb9 001b 0100 c000 1db6 0021 ac
>
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
> at java.lang.Class.getConstructor0(Class.java:2803)
> at java.lang.Class.getConstructor(Class.java:1718)
> at
> org.drools.core.rule.builder.dialect.asm.ClassGenerator.newInstance(ClassGenerator.java:197)
> at
> org.drools.core.rule.constraint.ASMConditionEvaluatorJitter.jitEvaluator(ASMConditionEvaluatorJitter.java:55)
> at
> org.drools.core.rule.constraint.MvelConstraint.executeJitting(MvelConstraint.java:289)
> at
> org.drools.core.rule.constraint.MvelConstraint.access$200(MvelConstraint.java:53)
> at
> org.drools.core.rule.constraint.MvelConstraint$ConditionJitter.run(MvelConstraint.java:266)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> at java.lang.Thread.run(Thread.java:744)
>
>
> The tests don't stop running and keep working. Here is my pom in case it
> helps
>
> http://maven.apache.org/POM/4.0.0";
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> 4.0.0
>
> DroolsTest
> DroolsTest
> 1.0-SNAPSHOT
>
> 
> 
> org.apache.maven.plugins
> maven-jxr-plugin
> 2.4
> 
>
> 
> 
> org.codehaus.groovy
> groovy-eclipse-batch
> 2.1.8-01
> 
>
> 
> 
> org.drools
> drools-compiler
> 6.1.0.Beta1
> 
>
> 
> org.drools
> drools-core
> 6.1.0.Beta1
> 
>
> 
> org.drools
> knowledge-api
> 6.1.0.Beta1
> 
> 
> 
> 
> 
> 
>
>
> 
> 
> joda-time
> joda-time
> 2.3
> 
>
> 
> commons-lang
> commons-lang
> 2.6
> 
>
> 
> org.slf4j
> slf4j-api
> 1.7.6
> 
>
> 
> org.slf4j
> slf4j-log4j12
> 1.7.6
> 
>
> 
> junit
> junit
> 4.7
> 
>
> 
> org.codehaus.gmaven.runtime
> gmaven-runtime-1.6
> 1.5
> 
> 
>
> 
> 
> 
> org.apache.maven.plugins
> maven-compiler-plugin
> 3.1
> 
> 1.7
> 1.7
> 
> 
> 
> maven-surefire-plugin
> 2.9
> 
>
> false
> true
> plain
> 
> 
> 
> org.apache.maven.plugins
> maven-surefire-report-plugin
> 2.9
> 
> 
> 
> 
> 
> org.apache.maven.plugins
> maven-jxr-plugin
> 2.4
> 
> 
> org.codehaus.gmaven
> gmaven-plugin
> 1.5
> 
> 
> 
> generateStubs
> compile
> generateTestStubs
> testCompile
> 
> 
> 
> 
> 
> 
> 
> 
> 
> org.apache.maven.plugins
> maven-surefire-repo

Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue

2014-04-14 Thread Davide Sottara
MVEL glitch, try size() > 0

On 04/14/2014 11:59 AM, Cwen wrote:
> Thank you Davide. That helped. I re-compiled the pkg and it got loaded
> successfully. However the run execution is throwing the following errors. I
> am looking into it. Not sure if that's something you have any insight.
>
> [Error: could not access: size; in class: java.util.ArrayList]
> [Near : {... size > 0 }]
>  ^
> [Line: 1, Column: 1]
>   at
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:683)
>   at
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanPropertyAO(ReflectiveAccessorOptimizer.java:465)
>   at
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:370)
>   at
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
>   at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
>   at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
>   at
> org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:114)
>   at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
>   at
> org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
>   at
> org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
>   at org.mvel2.MVEL.executeExpression(MVEL.java:930)
>   at
> org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:73)
>   at
> org.drools.rule.constraint.MvelConditionEvaluator.evaluate(MvelConditionEvaluator.java:52)
>   at
> org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:218)
>   at
> org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:175)
>   at
> org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:655)
>   at
> org.drools.reteoo.AccumulateNode.assertLeftTuple(AccumulateNode.java:185)
>   at
> org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:232)
>   at
> org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:116)
>   at
> org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:151)
>   at
> org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
>   at
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
>   at
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:364)
>   at 
> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:302)
>   at 
> org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:254)
>   at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:366)
>   at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:327)
>   at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:950)
>   at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:894)
>   at
> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029253.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] KnowledgeAgentImpl registeredResourceMap memory issue

2014-04-14 Thread Davide Sottara
Are you downloading a compiled PKG resource? You'd have to rebuild
the PKG with 5.6, or use the source DRL..

On 04/14/2014 11:08 AM, Cwen wrote:
> Davide, 
> I tried change our methods signature and run the application. Getting
> following stack trace when calling KnowledgeAgent.applyChangeSet(Resource
> resource):
>
> java.lang.RuntimeException: KnowledgeAgent exception while trying to
> deserialize KnowledgeDefinitionsPackage  
>   at
> org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:796)
>   at
> org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:1094)
>   at
> org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:844)
>   at
> org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:684)
>   at
> org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:207)
>   at
> org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:186)
>
>   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>   at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>   at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>   at 
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
>   at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1004)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:957)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
>   at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
>   at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121)
>   at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
>   at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
>   at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
>   at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
>   at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
>   at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
>   at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
>   at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
>   at
> org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
>   at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
>   at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
>   at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4350)
>   at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4816)
>   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>   at
> org.apache.catalina.core.ContainerBase.startInternal(Con

Re: [rules-users] KnowledgeAgentImpl registeredResourceMap memory issue

2014-04-14 Thread Davide Sottara
Ok, perfect. That internal "interface" was indeed changed.
Please note that there is a potential problem with the implementation of
the
custom evaluators in 5.6. It has been fixed in 6.x, but it should
probably be backported. Let me know if you have problems.
Davide

On 04/14/2014 08:29 AM, Cwen wrote:
> Davide, please ignore my last post. I looked into the code more and it's the
> interface changes Evaluator cause the errors. evaluate() methods now have
> InternalFactHandle as an argument instead of Object. Let me work on those
> and I will update with you if I see more problems. Thanks.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029247.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] KnowledgeAgentImpl registeredResourceMap memory issue

2014-04-12 Thread Davide Sottara
Strange.. the APIs should have not changed between 5.5 and 5.6...
what kind of compilation errors are you getting exactly?

1) The KA was partially rewritten because of a sub-project (drools-mas),
so it was a combination of fixes and "natural evolution"
You can try the tickets here, however:
https://issues.jboss.org/browse/DROOLS-273?jql=text%20~%20%22KnowledgeAgent%22%20AND%20project%3DDrools

2) The easiest thing to try would be to replace the 5.5 KA with the 5.6 and
recompile + test..

Next week I may have some time to assist you
Best
Davide

On 04/12/2014 05:30 AM, Cwen wrote:
> Thank you for your advice Davide! I actually tried upgrade to 5.6.0.final.
> However there were a lot of compile errors from our system. So it's not easy
> for us to upgrade. I have couple of questions:
> 1. Is this a known issue documented and fixed with 5.6.0.final? Is there a
> JIRA ticket tracking this?
> 2. Is it possible to patch 5.5.0 version with the fixes?
>
> Thank you!
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-registeredResourceMap-memory-issue-tp4029216p4029223.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] KnowledgeAgentImpl registeredResourceMap memory issue

2014-04-11 Thread Davide Sottara
Can you try 5.6.0.Final?
Many issues regarding the KnowledgeAgent were fixed in that version
Thanks
Davide

On 04/11/2014 08:45 PM, Cwen wrote:
>
> 
> View this message in context: Re: KnowledgeAgentImpl
> registeredResourceMap memory issue
> 
> 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] Memory leak due CompositeClassLoader

2014-04-05 Thread Davide Sottara
I think I'm starting to see the problem now. Where does this "component" live
exactly, and how is that (and the KB) shared between your different webapps? 



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-due-CompositeClassLoader-tp4029053p4029131.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] Linkage Error In execute method

2014-04-05 Thread Davide Sottara
You should look at the 5.6 series, not the 6.0. Too many things have changed
in the latter



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Linkage-Error-In-execute-method-tp4029123p4029130.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] Linkage Error In execute method

2014-04-04 Thread Davide Sottara
Can you upgrade to 5.6?
Otherwise, you'll have to synchronize the methods int ClassLoader, the
null check is not enough

On 04/04/2014 09:16 PM, Karan Malhotra wrote:
>
> Hi All,
>
>  
>
> We have recently upgraded our application from 5.1.0 to 5.4.0.Final.
>
>  
>
> Everything worked well until this was deployed at Production Envr. We
> started getting multiple Linkage Error in execute method of Stateless
> KnowledgeSession.
>
>  
>
> StackTrace:
>
>  
>
> Exception: java.util.concurrent.ExecutionException:
> java.lang.LinkageError: loader (instance
> oforg/drools/rule/JavaDialectRuntimeData$PackageClassLoader):
> attemptedduplicate class definition for name:
> "OffBarCapping/Rule_Off_Bar_Tariff_Capping_13_2a4a909def69414bbd60cdfdac9ad807"|
>
>  
>
> OffBarCapping/Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1f#
>  
> at
> OffBarCapping.Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1fPredicate0InvokerGenerated.evaluate(Unknown
> Source)#at
> OffBarCapping.Rule_Off_Bar_Tariff_Capping_16_6b6f1282708449448fc434e820fa8e1fPredicate0Invoker.evaluate(Unknown
> Source)# at
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:299)#
> at
> org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)#   
> at
> org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)#
>   
> at
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)#
> 
> at
> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)# 
> at
> org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)# 
> at
> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)# 
> at
> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)# 
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)#
>  
> at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)#
>  
> at
> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)#
>  
> at
> org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:294)#
>
>  
>
> 1.Some surfing on the internet referred us to a similar JIRA
> issue:- JBRULES-3675 
>
> It says this has been fixed in 6.0.0. We were not in a position to
> upgrade to 6.0.0 right away and hence decide to apply a patch in
> drools-core-5.4.0.Final.jar
>
>  
>
> Drools: 5.4.0
>
> public Class More ...fastFindClass( final String name ) {
>
> Class cls = findLoadedClass( name );
>
>  
>
> if (cls == null) {
>
> final byte[] clazzBytes = this.store.read(
> convertClassToResourcePath( name ) );
>
> if (clazzBytes != null) {
>
> String pkgName = name.substring( 0,
>
>  name.lastIndexOf(
> '.' ) );
>
> if (getPackage( pkgName ) == null) {
>
> definePackage( pkgName,
>
>   "",
>
>"",
>
>"",
>
>"",
>
>"",
>
>"",
>
>null );
>
> }
>
>  
>
> cls = defineClass( name,
>
>clazzBytes,
>
>0,
>
>   clazzBytes.length,
>
>PROTECTION_DOMAIN );
>
> }
>
> if (cls != null) {
>
> resolveClass( cls );
>
> }
>
> }
>
> return cls;
>
> }
>
>  
>
> Path applied:-
>
>  
>
> public Class fastFindClass(String name)
>
> {
>
> Class cls = findLoadedClass(name);
>
> if(cls == null)
>
> {
>
> byte clazzBytes[] =
> store.read(JavaDialectRuntimeData.convertClassToResourcePath(name));
>
> if(clazzBytes != null)
>
> {
>
> String pkgName = name.substring(0, name.lastIndexOf('.'));
>
> if(!existingPackages.contains(pkgName))
>
> {
>
> synchronized(this)
>
> {
>
> if(!existingPackages.contains(pkgName))
>
> {
>
> if(getPackage(pkgName) == null)
>
> {
>
> definePackage(pkgName, "", "", "", "",
> "", "", null);
>
> }
>
> existingPackages.add(pkgName);
>
> }
>
> }
>
> }
>
>   

Re: [rules-users] Memory leak due CompositeClassLoader

2014-04-02 Thread Davide Sottara
You may have to dispose the sessions explicitly - or even the knowledgebase,
using the internal method that was added as a temporary "brute force" patch
to leaks in 5.6.
The composite classloader was replaced in 6.x, so the newer versions should
not have this kind of problems.
Best
Davide



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-due-CompositeClassLoader-tp4029053p4029100.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] Programmatically load rules classloader NullPointerException

2014-03-20 Thread Davide Sottara
Can you try 6.1.0-SNAPSHOT?
I tried your code quickly and it seems to work
Davide

On 03/20/2014 03:25 PM, GrantWang wrote:
> Would someone please help with this? Did I do something wrong or is this a
> bug? I am using 6.0.1. Thanks!
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Programmatically-load-rules-classloader-NullPointerException-tp4028783p4028827.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] KnowledgeAgentImpl memory leak (5.5.0.Final)

2014-03-19 Thread Davide Sottara
Can you try version 5.6?

On 03/19/2014 05:27 PM, alineasol wrote:
> Hello,
>
> We have a  KnowledgeAgent with this configuration:
>* drools.resource.scanner.interval = 900
>* drools.agent.monitorChangeSetEvents = "true"
>* drools.agent.scanResources = "true"
>* drools.agent.scanDirectories = "true"
>* drools.agent.newInstance = "false"
>* drools.resource.urlcache = /path/cache
>
> We have noticed a memory leak in the class KnowledgeAgentImpl when the
> resources are down. The KnowledgeAgentImpl begins to reload from cache all
> the resources every scanner interval they are not reachable. The
> KnowledgeAgentImpl object increases its size every loop causing a Java Perm
> Gen error.
>
> We use:
>* drools release 5.5.0.Final
>* jdk1.6.0_45
>* apache tomcat 7.0.42
>
>
> Any suggestion?
>
> Thank you. 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798.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] problem in sliding window

2014-03-18 Thread Davide Sottara
All the context of a session, including the windows, goes away when the
session is disposed.
In general, please try to post all your DRL and as much information you
can on how the
sessions are built and managed. That makes it easier to understand what
is going on.
Thanks!


On 03/18/2014 07:20 AM, Sandhya Sree wrote:
> no, actually i think the problem is because, i create a new session
> once in 10 seconds and dispose it off. so when i create the first two
> files in first 10 seconds , the session is disposed, and in the next
> session the next two files are created and disposed.. like this it
> goes.. so when i create more than 4 files all at the same instant it
> falls under the same session and the sliding window works.. 
> could this be the problem?
>
>
>
> On Mon, Mar 17, 2014 at 5:28 PM, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> It is possible to declare sliding windows
>
> A possible problem (I didn't check the logic) is that
> you are not inserting the new Events you create.
>
>
>
>
> On 03/17/2014 12:13 PM, Sandhya Sree wrote:
>> i found this type of declaration in a site and thought this is
>> allowed..
>> also it doesnt throw any compilation error and works the same way
>> as declared like this:
>>
>> accumulate( $e :Event (name == "new file added") *over window :
>> time(1m)*, count($e)
>>
>>
>> On Mon, Mar 17, 2014 at 4:23 PM, Wolfgang Laun
>> mailto:wolfgang.l...@gmail.com>> wrote:
>>
>> On 17/03/2014, Sandhya Sree > <mailto:sandhyachinna...@gmail.com>> wrote:
>>
>> > declare window Ticks
>> > Event()
>> > over window:time(1m )
>> > end
>>
>> Is there any documentation snippet that says you can declare
>> a fact
>> (not even an event) like this, restricting its existence?
>>
>> If not, why does this not cause an compilation error?
>>
>> -W
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto: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] problem in sliding window

2014-03-17 Thread Davide Sottara
It is possible to declare sliding windows

A possible problem (I didn't check the logic) is that
you are not inserting the new Events you create.



On 03/17/2014 12:13 PM, Sandhya Sree wrote:
> i found this type of declaration in a site and thought this is allowed..
> also it doesnt throw any compilation error and works the same way as
> declared like this:
>
> accumulate( $e :Event (name == "new file added") *over window :
> time(1m)*, count($e)
>
>
> On Mon, Mar 17, 2014 at 4:23 PM, Wolfgang Laun
> mailto:wolfgang.l...@gmail.com>> wrote:
>
> On 17/03/2014, Sandhya Sree  > wrote:
>
> > declare window Ticks
> > Event()
> > over window:time(1m )
> > end
>
> Is there any documentation snippet that says you can declare a fact
> (not even an event) like this, restricting its existence?
>
> If not, why does this not cause an compilation error?
>
> -W
> ___
> 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] NullPointerException with factType.get(fact, "fieldname")

2014-03-15 Thread Davide Sottara
Michael, I think the class is just incidentally named ValidationError.

The problem is in the "wiring" of the accessors into the FieldDefinition
(you see that "accessor=null" at the end of the toString in the failing
case).
This wiring is done by the PackageBuilder when the DRL is compiled, so
I suspect that there is a problem with the interaction of the data modeller
and the package builder..

Jarkko, thanks for reporting this, it really looks like a WB bug!
Could you please open a JIRA ticket?

Davide

On 03/15/2014 04:09 PM, Michael Anstis wrote:
>
> ValidationError is indeed an *internal* workbench class. What makes
> you think you can query for it?
>
> Sent on the move
>
> On 15 Mar 2014 12:00, "JarkkoMakela"  > wrote:
>
> This ValidationError is created with drools workbench data
> modeller. It has
> only String fields.
> I have only couple of rules (which will create two
> ValidationErrors) and one
> query (for the ValidationError) in the knowledgebase.
>
>
> -Jarkko
>
>
>
> --
> View this message in context:
> 
> http://drools.46999.n3.nabble.com/NullPointerException-with-factType-get-fact-fieldname-tp4028688p4028744.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] IllegalStateException:

2014-03-15 Thread Davide Sottara
Raj,
I'd like to see how you used to create the KieSessions before.

If you just did:
KieContainer.newKieSession()
that might not work

You should instead be able to do:
KieBase.newKieSession(),
but create the KieBase only once, not every time you need a
KieSession (assuming that all sessions will essentially use
the same rules)

The way you do it now works, but has a heavy impact
on performance, since you recreate the KieBase every time.

Davide

On 03/15/2014 08:04 AM, Raja Sekhar wrote:
> Hi  Davide/Wolfgang
> The problem is resolved by establishing the session from Kiebase
> KieContainer kc = KieServices.Factory.get().getKieClasspathContainer();
> KieBaseConfiguration conf
> =KieServices.Factory.get().newKieBaseConfiguration();
> KieBase kieBase = kc.newKieBase(kBaseName, conf);
> ksession=kieBase.newKieSession();
> No more errors are seen in the log. Kiebase is thread safe.
>
> Regards,
> Raj
>
>
>
>
> On 14 March 2014 23:38, Raja Sekhar  <mailto:raja.amir...@gmail.com>> wrote:
>
> Hi 
> Thanks a lot Wolfgang 
>
> Actually i have 2 bolts 1 bolt gets inserts the facts emitted by
> sprout and  other bolt inserts data into the database. yes 1 bot
> per fact 
> regarding losing session i mean that does the KieSession(6.0)
> works in a current technology  stack  which i am using currently
> using strom - drools- saving back to database.
>
> Regards,
> Raj
>
>
> On 14 March 2014 19:59, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> +1 Wolfgang :)
>
> Raj,
> we'd need to know things like: how many bolts, how many
> knowledge bases
> (I guess one),
> how many kiesession - a singleton, one per bolt, one per batch
> of facts...?
> Also, "losing the session since it's running in a multi-threaded
> environment" - what does
> it mean exactly?
> Thanks
>
> On 03/14/2014 12:42 PM, Wolfgang Laun wrote:
> > The clarity and precision of your descriptions is unsurpassed.
> > -W
> >
> > On 14/03/2014, Raja Sekhar  <mailto:raja.amir...@gmail.com>> wrote:
> >> We are using storm in big data stack, we are reading data
> from database and
> >> apply rules on them.
> >> This is how storm works we have a topology and a
> spout(input) and
> >> bolts(processing and output). spouts will be reading from
> DB and sending
> >> them to the bolt. The bolt will initiate a  kiesession and
> fire the rules
> >> after a threshold is reached. the threshold  will be
>     decided by spout Here
> >> what is happening , suppose we are processing a set of 500
> records, 250 are
> >> getting processed and 250 are getting failed
> >> Please suggest
> >>
> >>
> >>
> >> On 14 March 2014 15:53, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
> >>
> >>>  Major bugs are usually backported.. are you sure that
> this fix addresses
> >>> your problem?
> >>> In general, if you don't provide a detailed description of
> your
> >>> environment and your
> >>> problem, it will be extremely difficult to help you
> >>>
> >>>
> >>> On 03/14/2014 10:03 AM, Raja Sekhar wrote:
>     >>>
> >>> Hi Davide,
> >>> I see that i am loosing the session since i am running is
> multi-threaded
> >>> environment
> >>> I see the following URL
> >>> https://github.com/droolsjbpm/drools/pull/256/files
> >>>
> >>>  Are these changed to main branch for version 6.0.1
> >>>
> >>>  Regards,
> >>> Raj
> >>>
> >>>
> >>>
> >>> On 13 March 2014 23:46, Davide Sottara      <mailto:dso...@gmail.com>> wrote:
> >>>
> >>>>  Do you call session.dispose() after you fire your rules?
> >>>> That exception means that your stateful session was disposed,
> >>>> and you can no longer call methods to insert facts or
> fire rules
> >>>> (or anything if that matters) o

Re: [rules-users] IllegalStateException:

2014-03-15 Thread Davide Sottara
Raj,
thanks, I think I see what happens. I'll get back to you later!
Davide

On 03/15/2014 08:04 AM, Raja Sekhar wrote:
> Hi  Davide/Wolfgang
> The problem is resolved by establishing the session from Kiebase
> KieContainer kc = KieServices.Factory.get().getKieClasspathContainer();
> KieBaseConfiguration conf
> =KieServices.Factory.get().newKieBaseConfiguration();
> KieBase kieBase = kc.newKieBase(kBaseName, conf);
> ksession=kieBase.newKieSession();
> No more errors are seen in the log. Kiebase is thread safe.
>
> Regards,
> Raj
>
>
>
>
> On 14 March 2014 23:38, Raja Sekhar  <mailto:raja.amir...@gmail.com>> wrote:
>
> Hi 
> Thanks a lot Wolfgang 
>
> Actually i have 2 bolts 1 bolt gets inserts the facts emitted by
> sprout and  other bolt inserts data into the database. yes 1 bot
> per fact 
> regarding losing session i mean that does the KieSession(6.0)
> works in a current technology  stack  which i am using currently
> using strom - drools- saving back to database.
>
> Regards,
> Raj
>
>
> On 14 March 2014 19:59, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> +1 Wolfgang :)
>
> Raj,
> we'd need to know things like: how many bolts, how many
> knowledge bases
> (I guess one),
> how many kiesession - a singleton, one per bolt, one per batch
> of facts...?
> Also, "losing the session since it's running in a multi-threaded
> environment" - what does
> it mean exactly?
> Thanks
>
> On 03/14/2014 12:42 PM, Wolfgang Laun wrote:
> > The clarity and precision of your descriptions is unsurpassed.
> > -W
> >
> > On 14/03/2014, Raja Sekhar  <mailto:raja.amir...@gmail.com>> wrote:
> >> We are using storm in big data stack, we are reading data
> from database and
> >> apply rules on them.
> >> This is how storm works we have a topology and a
> spout(input) and
> >> bolts(processing and output). spouts will be reading from
> DB and sending
> >> them to the bolt. The bolt will initiate a  kiesession and
> fire the rules
> >> after a threshold is reached. the threshold  will be
>     decided by spout Here
> >> what is happening , suppose we are processing a set of 500
> records, 250 are
> >> getting processed and 250 are getting failed
> >> Please suggest
> >>
> >>
> >>
> >> On 14 March 2014 15:53, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
> >>
> >>>  Major bugs are usually backported.. are you sure that
> this fix addresses
> >>> your problem?
> >>> In general, if you don't provide a detailed description of
> your
> >>> environment and your
> >>> problem, it will be extremely difficult to help you
> >>>
> >>>
> >>> On 03/14/2014 10:03 AM, Raja Sekhar wrote:
>     >>>
> >>> Hi Davide,
> >>> I see that i am loosing the session since i am running is
> multi-threaded
> >>> environment
> >>> I see the following URL
> >>> https://github.com/droolsjbpm/drools/pull/256/files
> >>>
> >>>  Are these changed to main branch for version 6.0.1
> >>>
> >>>  Regards,
> >>> Raj
> >>>
> >>>
> >>>
> >>> On 13 March 2014 23:46, Davide Sottara      <mailto:dso...@gmail.com>> wrote:
> >>>
> >>>>  Do you call session.dispose() after you fire your rules?
> >>>> That exception means that your stateful session was disposed,
> >>>> and you can no longer call methods to insert facts or
> fire rules
> >>>> (or anything if that matters) on a session that has been
> disposed.
> >>>> If so, you'll need to create a new one.
> >>>> Davide
> >>>>
> >>>>
> >>>> On 03/13/2014 07:06 PM, Raja Sekhar wrote:
> >>>>
> >>>> Iam using Stateful session

Re: [rules-users] IllegalStateException:

2014-03-14 Thread Davide Sottara
+1 Wolfgang :)

Raj,
we'd need to know things like: how many bolts, how many knowledge bases
(I guess one),
how many kiesession - a singleton, one per bolt, one per batch of facts...?
Also, "losing the session since it's running in a multi-threaded
environment" - what does
it mean exactly?
Thanks

On 03/14/2014 12:42 PM, Wolfgang Laun wrote:
> The clarity and precision of your descriptions is unsurpassed.
> -W
>
> On 14/03/2014, Raja Sekhar  wrote:
>> We are using storm in big data stack, we are reading data from database and
>> apply rules on them.
>> This is how storm works we have a topology and a spout(input) and
>> bolts(processing and output). spouts will be reading from DB and sending
>> them to the bolt. The bolt will initiate a  kiesession and fire the rules
>> after a threshold is reached. the threshold  will be decided by spout Here
>> what is happening , suppose we are processing a set of 500 records, 250 are
>> getting processed and 250 are getting failed
>> Please suggest
>>
>>
>>
>> On 14 March 2014 15:53, Davide Sottara  wrote:
>>
>>>  Major bugs are usually backported.. are you sure that this fix addresses
>>> your problem?
>>> In general, if you don't provide a detailed description of your
>>> environment and your
>>> problem, it will be extremely difficult to help you
>>>
>>>
>>> On 03/14/2014 10:03 AM, Raja Sekhar wrote:
>>>
>>> Hi Davide,
>>> I see that i am loosing the session since i am running is multi-threaded
>>> environment
>>> I see the following URL
>>> https://github.com/droolsjbpm/drools/pull/256/files
>>>
>>>  Are these changed to main branch for version 6.0.1
>>>
>>>  Regards,
>>> Raj
>>>
>>>
>>>
>>> On 13 March 2014 23:46, Davide Sottara  wrote:
>>>
>>>>  Do you call session.dispose() after you fire your rules?
>>>> That exception means that your stateful session was disposed,
>>>> and you can no longer call methods to insert facts or fire rules
>>>> (or anything if that matters) on a session that has been disposed.
>>>> If so, you'll need to create a new one.
>>>> Davide
>>>>
>>>>
>>>> On 03/13/2014 07:06 PM, Raja Sekhar wrote:
>>>>
>>>> Iam using Stateful sessions .
>>>> On Mar 13, 2014 11:27 PM, "Davide Sottara"  wrote:
>>>>
>>>>>  Are you using stateful or stateless sessions?
>>>>> Davide
>>>>>
>>>>> On 03/13/2014 05:01 PM, Raja Sekhar wrote:
>>>>>
>>>>> Hi
>>>>> Can someone help me with this.
>>>>>
>>>>>  Regards
>>>>> Raj
>>>>>
>>>>>
>>>>> On 13 March 2014 14:05, Raja Sekhar  wrote:
>>>>>
>>>>>> Hi
>>>>>> Iam processing dataset stream with storm. After receiving the first
>>>>>> set
>>>>>> of records the rule is firing. For next set of records i getinet this
>>>>>> exception
>>>>>> Illegal method call. This session was previously disposed
>>>>>> I after firing the rules the session is get disposed. I am not getting
>>>>>> where to reeslish the session. Also how i do  i know  if the session
>>>>>> is
>>>>>> alive or not?
>>>>>>
>>>>>> --
>>>>>> Raja Sekhar Amirapu
>>>>>> --
>>>>>> "If any anyone can do it, i can do it. If no one else can do it, i
>>>>>> must
>>>>>> do it"
>>>>>>
>>>>>
>>>>>
>>>>>  --
>>>>> Raja Sekhar Amirapu
>>>>> --
>>>>> "If any anyone can do it, i can do it. If no one else can do it, i must
>>>>> do it"
>>>>>
>>>>>
>>>>> ___
>>>>> rules-users mailing
>>>>> listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>>
>>>>> ___
>>>>> rules-users mailing list
>>>>> rules-users@lists

Re: [rules-users] IllegalStateException:

2014-03-14 Thread Davide Sottara
Major bugs are usually backported.. are you sure that this fix addresses
your problem?
In general, if you don't provide a detailed description of your
environment and your
problem, it will be extremely difficult to help you

On 03/14/2014 10:03 AM, Raja Sekhar wrote:
> Hi Davide,
> I see that i am loosing the session since i am running is
> multi-threaded environment
> I see the following URL
> https://github.com/droolsjbpm/drools/pull/256/files
>
> Are these changed to main branch for version 6.0.1
>
> Regards,
> Raj
>
>
>
> On 13 March 2014 23:46, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> Do you call session.dispose() after you fire your rules?
> That exception means that your stateful session was disposed,
> and you can no longer call methods to insert facts or fire rules
> (or anything if that matters) on a session that has been disposed.
> If so, you'll need to create a new one.
> Davide
>
>
> On 03/13/2014 07:06 PM, Raja Sekhar wrote:
>>
>> Iam using Stateful sessions .
>>
>> On Mar 13, 2014 11:27 PM, "Davide Sottara" > <mailto:dso...@gmail.com>> wrote:
>>
>> Are you using stateful or stateless sessions?
>> Davide
>>
>> On 03/13/2014 05:01 PM, Raja Sekhar wrote:
>>> Hi 
>>> Can someone help me with this. 
>>>
>>> Regards
>>> Raj
>>>
>>>
>>> On 13 March 2014 14:05, Raja Sekhar >> <mailto:raja.amir...@gmail.com>> wrote:
>>>
>>> Hi 
>>> Iam processing dataset stream with storm. After
>>> receiving the first set of records the rule is firing.
>>> For next set of records i getinet this exception
>>> Illegal method call. This session was previously disposed
>>> I after firing the rules the session is get disposed. I
>>> am not getting where to reeslish the session. Also how i
>>> do  i know  if the session is alive or not?
>>>  
>>> -- 
>>> Raja Sekhar Amirapu
>>> --
>>> "If any anyone can do it, i can do it. If no one else
>>> can do it, i must do it"
>>>
>>>
>>>
>>>
>>> -- 
>>> Raja Sekhar Amirapu
>>> --
>>> "If any anyone can do it, i can do it. If no one else can do
>>> it, i must do it"
>>>
>>>
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> -- 
> Raja Sekhar Amirapu
> --
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
> ___
> 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] Question to Knowledge-Agent Behaviour

2014-03-13 Thread Davide Sottara
The ResourceChangeScanner will consider a resource modified if last
modification > last read.
If your resource is a URL resource pointing to a file, the
implementation (version 5.6, at least)
will delegate to File.lastModified().
Make sure that whenever you (re)deploy your PKGs, the lastModified()
timestamp is updated

On 03/13/2014 12:47 PM, Peach Wyss wrote:
> Hy all
>
> We're having the following situation in our application:
>
> ChangeSet:
>  xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>   xs:schemaLocation='http://drools.org/drools-5.0/change-set
> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'>
>   
> 
>   
> 
>
>
> Code:
> ...
> // Build initial KnowledgeBase
> KnowledgeBuilderConfiguration kbuilderConfig =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,
> classloaders);
> knowledgeBuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(kbuilderConfig);
> knowledgeBuilder.add(resource, resourceType); //Resource: URL-Resource
> (Patch to ChangeSet), ResourceType: ChangeSet
> Collection knowledgePackages =
> knowledgeBuilder.getKnowledgePackages();
> knowledgeBase.addKnowledgePackages(knowledgePackages);
>
> // Create and configure Knowledge Agent
> KnowledgeAgentConfiguration knowledgeAgentConfig =
> KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
> knowledgeAgentConfig.setProperty("drools.agent.useKBaseClassLoaderForCompiling",
> "true");
> knowledgeAgentConfig.setProperty("drools.agent.newInstance", "false");
> knowledgeAgent = KnowledgeAgentFactory.newKnowledgeAgent("MyAgent",
> knowledgeBase, knowledgeAgentConfig);
> knowledgeAgent.addEventListener(new KnowledgeAgentEventListener()
> {...} // Just for debugging purposes
> knowledgeAgent.monitorResourceChangeEvents(true);
> knowledgeAgent.applyChangeSet(resource);
>
> // Configure Notification and Scanner
> ResourceChangeScannerConfiguration resourceChangeScannerConfig =
> ResourceFactory
>  
> .getResourceChangeScannerService().newResourceChangeScannerConfiguration();
> resourceChangeScannerConfig.setProperty("drools.resource.scanner.interval",
> "10");
> ResourceFactory.getResourceChangeScannerService().configure(resourceChangeScannerConfig);
> ResourceFactory.getResourceChangeNotifierService().start();
> ResourceFactory.getResourceChangeScannerService().start();
>
> // Get KnowledgeBase from Agent
> knowledgeBase = knowledgeAgent.getKnowledgeBase();
> ...
>
>
> When i replace the rules.pkg with a new package (exported from guvnor
> with a newer "Date Modified"), the Knowledge-Base is newly generated.
> When I replace the pkg with the Package from the previous Version
> (older "Date modified"), nothing happens (despite the pkg has changed).
>
> Question:
> Does the agent only updates the Knowledge-Base, when the replaced
> pkg-File has a newer "Date Modified"?
> In our scenario, the expected behaviour would be that the Agent
> updates the Knowledge-Base everytime the pkg-file changes, so that we
> can switch between newer and older versions of the pkg-file. Any idea
> how to achieve this?
>
> Thanks for your help.
>
> Kind regards,
> Peter
>
>
> ___
> 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] IllegalStateException:

2014-03-13 Thread Davide Sottara
Do you call session.dispose() after you fire your rules?
That exception means that your stateful session was disposed,
and you can no longer call methods to insert facts or fire rules
(or anything if that matters) on a session that has been disposed.
If so, you'll need to create a new one.
Davide

On 03/13/2014 07:06 PM, Raja Sekhar wrote:
>
> Iam using Stateful sessions .
>
> On Mar 13, 2014 11:27 PM, "Davide Sottara"  <mailto:dso...@gmail.com>> wrote:
>
> Are you using stateful or stateless sessions?
> Davide
>
> On 03/13/2014 05:01 PM, Raja Sekhar wrote:
>> Hi 
>> Can someone help me with this. 
>>
>> Regards
>> Raj
>>
>>
>> On 13 March 2014 14:05, Raja Sekhar > <mailto:raja.amir...@gmail.com>> wrote:
>>
>> Hi 
>> Iam processing dataset stream with storm. After receiving the
>> first set of records the rule is firing. For next set of
>> records i getinet this exception
>> Illegal method call. This session was previously disposed
>> I after firing the rules the session is get disposed. I am
>> not getting where to reeslish the session. Also how i do  i
>> know  if the session is alive or not?
>>  
>> -- 
>> Raja Sekhar Amirapu
>> --
>> "If any anyone can do it, i can do it. If no one else can do
>> it, i must do it"
>>
>>
>>
>>
>> -- 
>> Raja Sekhar Amirapu
>> --
>> "If any anyone can do it, i can do it. If no one else can do it,
>> i must do it"
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto: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] IllegalStateException:

2014-03-13 Thread Davide Sottara
Are you using stateful or stateless sessions?
Davide

On 03/13/2014 05:01 PM, Raja Sekhar wrote:
> Hi 
> Can someone help me with this. 
>
> Regards
> Raj
>
>
> On 13 March 2014 14:05, Raja Sekhar  > wrote:
>
> Hi 
> Iam processing dataset stream with storm. After receiving the
> first set of records the rule is firing. For next set of records i
> getinet this exception
> Illegal method call. This session was previously disposed
> I after firing the rules the session is get disposed. I am not
> getting where to reeslish the session. Also how i do  i know  if
> the session is alive or not?
>  
> -- 
> Raja Sekhar Amirapu
> --
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
>
>
> -- 
> Raja Sekhar Amirapu
> --
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
> ___
> 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] sliding window problem

2014-03-11 Thread Davide Sottara
No, the combination of accumulate/count + over should be fine (I didn't
check though).
The problem is that you are simply creating the Events, but not
inserting them in the wm.
You need to add insert(event) to your rules


On 03/11/2014 07:39 PM, grules wrote:
>
> I think you have to follow the structure of accumulate function. Like
>
> *//*from accumulate( *//*,
>
>   init( *//*),
>
>   action( *//*),
>
>   reverse( *//*), (optional)
>
>   result( *//*) )
>
>  
>
> examples are:
>
> when
>
> $order : Order()
>
> $total : Number( doubleValue > 100 )
>
>  from accumulate( OrderItem( order == $order, $value :
> value ),
>
>   init( double total = 0; ),
>
>   action( total += $value; ),
>
>  result( total ) )
>
> then
>
> # apply discount to $order
>
> end
>
>  
>
> As I understand from your code,
>
> 1.  Make List for Event class, because accumulate will loop through
> the elements of List
>
> 2.  Init (write action codes, i.e. initialize value so you will find
> how many time it got looped)
>
> 3.  Write code inside the block of action(//code here) and
>
> 4.  Update it in result block i.e. result(//update here);
>
>  
>
> Being said, follow the structure 1) init, 2) action, 3) result as above..
>
>  
>
>  
>
>  
>
>  
>
> *From:*Sandhya Sree [via Drools] [mailto:ml-node+[hidden email]
> ]
> *Sent:* Tuesday, March 11, 2014 1:51 PM
> *To:* Gopu Shrestha
> *Subject:* [rules-users] sliding window problem
>
>  
>
> i have a class called Event which has the following members { name,
> source, timestamp } with getters ,setters and constructor. i have a
> rule file which creates Event objects whenever a file is added /
> deleted in a particular folder. the rule file is as follows
>
>  
> |rule "new file"|
> |when|
> |$p: RuleContext( $old : getOldContext().getContainedFiles(), $new 
> :getNewContext().getContainedFiles())|
> |RuleContext( $old != $new)|
> |accumulate( $s : Object( this not memberOf $old ) from $new, $plus : 
> collectList( $s ) )  |
> |events : Object() from $plus;|
> |then|
> |Event event = new Event("new file added",$p.getOldContext().getParent(),new 
> Date());|
> |end|
> | |
> | |
> |rule " file deleted"|
> |when|
> |$p: RuleContext( $old : getOldContext().getContainedFiles(), 
> $new:getNewContext().getContainedFiles())|
> |RuleContext( $old != $new)|
> |accumulate( $t : Object( this not memberOf $new ) from $old, $mins : 
> collectList( $t ) )|
> |events : Object() from $mins; |
> |then|
> |Event event = new Event("file deleted",$p.getOldContext().getParent(),new 
> Date());|
> |end |
>
> (do not confuse with RuleContext and other unknown identifiers.. they
> r just related with other classes in the project.. these two rules
> just works fine )..i need to use a sliding time window and create
> another event if the number of file additions are > 5 over the past 1
> minute. my rule file is :
>
>  
> |declare Event |
> |@role( event ) |
> |end |
> | |
> | |
> |rule "More than 5 additions"|
> |when |
> |Number(intValue > 5) |
> |fromaccumulate( $tick : Event ( name == "new file added" ) over 
> window:time( 1m ),|
> |count( $tick ) ) )|
> |then |
> |System.out.println("too many additions"); |
> |end |
>
> i have enabled stream mode processing too.. but it doesnt seem to
> work. what could be the problem?
>
>
> ___
> rules-users mailing list
> [hidden email] 
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> 
>
> *If you reply to this email, your message will be added to the
> discussion below:*
>
> http://drools.46999.n3.nabble.com/rules-users-sliding-window-problem-tp4028639.html
>
>
> To start a new topic under Drools: User forum, email [hidden email]
> 
> To unsubscribe from Drools, click here.
> NAML
> 
>
>
>
> 
> View this message in context: RE: [rules-users] sliding window problem
> 
> 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] looping in drools

2014-03-10 Thread Davide Sottara
You should realize that the LHS ("when") and RHS ("then") are different
and use different syntaxes.
The RHS is essentially java... you can't use ":" and "from".

Also.. "Event(..) from .." is a pattern - a filter that tries to match
existing objects asserted in the WM.
What you need there is to create a new Event.. just do it the way you
would in Java.

You will have to learn to read error messages, too.
What the error is trying to say, is that it interpreted the Event( .. )
statement as a method call,
which is of course undefined.

On 03/10/2014 08:19 PM, Sandhya Sree wrote:
> i tried this :
>
> rule "new file"
> when
> FileData($old : fileOld, $new : fileNew, fileOld != fileNew)
> $newFile : String( this not memberOf $old ) from $new
> then   
> event : Event("file added", filename, new Date()) from $plus
> Event.listOfEvents.add(event);
> event.display(); 
> end
>
>
> this gives the following error:
> The method Event(String, File, Date) is undefined for the type
> Rule_new_file_0c90fff8d9b74b439ab79971b13b75ac
>  Syntax error on token "from", ; expected
>  $plus cannot be resolved to a type
>  Syntax error on token ".", ; expected
>  listOfEvents cannot be resolved
>
>
> On Tue, Mar 11, 2014 at 12:09 AM, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> "from" will iterate for you, exactly like "accumulate" counted the
> events.
> If you need more details, please consult the documentation
>
>
>
> On 03/10/2014 07:29 PM, Sandhya Sree wrote:
>> The problem here is even if multiple files are added, there is
>> only one event object created. i want to have like say if 3 new
>> files are added, 3 event objects must be created, and all three
>> event objects must be added to List listOfEvents. 
>>
>>
>> Thanks.
>>
>>
>> On Mon, Mar 10, 2014 at 11:48 PM, Davide Sottara
>> mailto:dso...@gmail.com>> wrote:
>>
>> The "accumulates" should not be in the "then" part of a rule
>> (see my previous email).
>> That rule gave you two lists, in the variables $plus and
>> $mins, that you can use in the consequence.
>>
>> If you need to process each file separately, you may want to
>> do something like this:
>>
>> rule "new file"
>> when
>> FileData($old : fileOld, $new : fileNew, fileOld != fileNew)
>>$newFile : String( this not memberOf $old ) from $new
>> then  
>>// create new event for a new file : new Event(...)
>>// add to list : Event.listOfEvents.add(...)
>> end
>>
>> You'll need another rule for the files that have been removed.
>>
>> Notice that your Event class has no way to distinguish
>> "added" from "removed" files, you may want to
>> add a boolean or something there.
>> Best
>> Davide
>>
>>
>> On 03/10/2014 07:04 PM, Sandhya Sree wrote:
>>> hi,
>>> im new to drools..im trying to create a project as follows.
>>> i have a class called Monitor  which monitors a folder and
>>> creates two lists called fileOld( which is the list of
>>> filenames in that folder at time t1)  and fileNew(which is
>>> the list of filenames in that folder at time t2). i have
>>> another class called FileData which contains two members
>>> fileOld and fileNew (list of strings) with getters,setters
>>> and constructor. fileOld and fileNew from Monitor Class are
>>> passed to FileData class.
>>>
>>> i also have another class called Event which is as follows:
>>> public class Event {
>>> public static String name;
>>> private  File source;
>>> private  Date timeStamp;
>>> public  static  List listOfEvents = new
>>> ArrayList();
>>>  
>>> public Event(String name, File source, Date timeStamp) {
>>> this.name <http://this.name> = name;
>>> this.source = source;
>>> this.timeStamp = timeStamp;
>>> }
>>> public String getName() {
>>> return name;
>>> }
>>> public void setName(String name) {
>>>

Re: [rules-users] looping in drools

2014-03-10 Thread Davide Sottara
"from" will iterate for you, exactly like "accumulate" counted the events.
If you need more details, please consult the documentation


On 03/10/2014 07:29 PM, Sandhya Sree wrote:
> The problem here is even if multiple files are added, there is only
> one event object created. i want to have like say if 3 new files are
> added, 3 event objects must be created, and all three event objects
> must be added to List listOfEvents. 
>
>
> Thanks.
>
>
> On Mon, Mar 10, 2014 at 11:48 PM, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> The "accumulates" should not be in the "then" part of a rule (see
> my previous email).
> That rule gave you two lists, in the variables $plus and $mins,
> that you can use in the consequence.
>
> If you need to process each file separately, you may want to do
> something like this:
>
> rule "new file"
> when
> FileData($old : fileOld, $new : fileNew, fileOld != fileNew)
>$newFile : String( this not memberOf $old ) from $new
> then  
>// create new event for a new file : new Event(...)
>// add to list : Event.listOfEvents.add(...)
> end
>
> You'll need another rule for the files that have been removed.
>
> Notice that your Event class has no way to distinguish "added"
> from "removed" files, you may want to
> add a boolean or something there.
> Best
> Davide
>
>
> On 03/10/2014 07:04 PM, Sandhya Sree wrote:
>> hi,
>> im new to drools..im trying to create a project as follows. i
>> have a class called Monitor  which monitors a folder and creates
>> two lists called fileOld( which is the list of filenames in that
>> folder at time t1)  and fileNew(which is the list of filenames in
>> that folder at time t2). i have another class called FileData
>> which contains two members fileOld and fileNew (list of strings)
>> with getters,setters and constructor. fileOld and fileNew from
>> Monitor Class are passed to FileData class.
>>
>> i also have another class called Event which is as follows:
>> public class Event {
>> public static String name;
>> private  File source;
>> private  Date timeStamp;
>> public  static  List listOfEvents = new
>> ArrayList();
>>  
>> public Event(String name, File source, Date timeStamp) {
>> this.name <http://this.name> = name;
>> this.source = source;
>> this.timeStamp = timeStamp;
>> }
>> public String getName() {
>> return name;
>> }
>> public void setName(String name) {
>> this.name <http://this.name> = name;
>> }
>> public File getSource() {
>> return source;
>> }
>> public void setSource(File source) {
>> this.source = source;
>> }
>> public Date getTimeStamp() {
>> return timeStamp;
>> }
>> public void setTimeStamp(Date timeStamp) {
>> this.timeStamp = timeStamp;
>> }
>>
>> now i have to compare these two lists(fileOld and fileNew) in a
>> rule file and if they are not equal i have to create an event
>> object for every file added and deleted and put it in the
>> List listOfEvents.
>>
>> here is my rule file:
>>
>> rrule "files are equal"
>> when 
>>  FileData( fileOld == fileNew)
>> then
>>System.out.println("files are equal");
>> end
>>
>>
>> rule "files not equal"
>> when
>> FileData($old : fileOld, $new : fileNew, fileOld != fileNew)
>> 
>> then
>>accumulate( $s : String( this not memberOf $old ) from $new,
>> $plus : collectList( $s ) ) 
>>accumulate( $t : String( this not memberOf $new ) from $old,
>> $mins : collectList( $t ) ) 
>>System.out.println("files added:" + $plus ); 
>>System.out.println( "files deleted:" + $mins );
>> end
>>
>>
>>
>> how can i loop through each of the file added or deleted and
>> create an Event Class object for every file added and deleted
>>  and finally add all the created objects to List
>> listOfEvents..
>>
>>
>> Thanks.
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto: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] looping in drools

2014-03-10 Thread Davide Sottara
The "accumulates" should not be in the "then" part of a rule (see my
previous email).
That rule gave you two lists, in the variables $plus and $mins, that you
can use in the consequence.

If you need to process each file separately, you may want to do
something like this:

rule "new file"
when
FileData($old : fileOld, $new : fileNew, fileOld != fileNew)
   $newFile : String( this not memberOf $old ) from $new
then  
   // create new event for a new file : new Event(...)
   // add to list : Event.listOfEvents.add(...)
end

You'll need another rule for the files that have been removed.

Notice that your Event class has no way to distinguish "added" from
"removed" files, you may want to
add a boolean or something there.
Best
Davide

On 03/10/2014 07:04 PM, Sandhya Sree wrote:
> hi,
> im new to drools..im trying to create a project as follows. i have a
> class called Monitor  which monitors a folder and creates two lists
> called fileOld( which is the list of filenames in that folder at time
> t1)  and fileNew(which is the list of filenames in that folder at time
> t2). i have another class called FileData which contains two members
> fileOld and fileNew (list of strings) with getters,setters and
> constructor. fileOld and fileNew from Monitor Class are passed to
> FileData class.
>
> i also have another class called Event which is as follows:
> public class Event {
> public static String name;
> private  File source;
> private  Date timeStamp;
> public  static  List listOfEvents = new ArrayList();
>  
> public Event(String name, File source, Date timeStamp) {
> this.name  = name;
> this.source = source;
> this.timeStamp = timeStamp;
> }
> public String getName() {
> return name;
> }
> public void setName(String name) {
> this.name  = name;
> }
> public File getSource() {
> return source;
> }
> public void setSource(File source) {
> this.source = source;
> }
> public Date getTimeStamp() {
> return timeStamp;
> }
> public void setTimeStamp(Date timeStamp) {
> this.timeStamp = timeStamp;
> }
>
> now i have to compare these two lists(fileOld and fileNew) in a rule
> file and if they are not equal i have to create an event object for
> every file added and deleted and put it in the List listOfEvents.
>
> here is my rule file:
>
> rrule "files are equal"
> when 
>  FileData( fileOld == fileNew)
> then
>System.out.println("files are equal");
> end
>
>
> rule "files not equal"
> when
> FileData($old : fileOld, $new : fileNew, fileOld != fileNew)
> 
> then
>accumulate( $s : String( this not memberOf $old ) from $new, $plus
> : collectList( $s ) ) 
>accumulate( $t : String( this not memberOf $new ) from $old, $mins
> : collectList( $t ) ) 
>System.out.println("files added:" + $plus ); 
>System.out.println( "files deleted:" + $mins );
> end
>
>
>
> how can i loop through each of the file added or deleted and create an
> Event Class object for every file added and deleted  and finally add
> all the created objects to List listOfEvents..
>
>
> Thanks.
>
>
> ___
> 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] 6.0.1.F EXTENDS in Guided Rule Editor does not work

2014-03-06 Thread Davide Sottara
If I remember correclty, extension only works within the same package

On 03/06/2014 05:08 PM, SrjTx wrote:
> BaseRule DRL is
>
> package com.xyz.cep;
>
> import com.xyz.model.Flow;
>
> declare Flow
>   @role(event)
> end
>
> rule "BaseRule"
> dialect "java"
> when
> then
> end
>
>
> -
> Child.rdslr freshly created and empty other than selecting to extend from
> BaseRule
>
>
> 1.|   package com.securelogix.policy.cep;
> 2.|   
> 3.|   import java.lang.Number;
> 4.|   
> 5.|   rule "Child" extends "BaseRule"
> 6.|   dialect "mvel"
> 7.|   when
> 8.|   then
> 9.|   end
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/6-0-1-F-EXTENDS-in-Guided-Rule-Editor-does-not-work-tp4028506p4028571.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] Facing Problem with this exception

2014-03-05 Thread Davide Sottara
Similar bugs have been fixed over different versions, but
it's very difficult to tell without some context.
One would need at least the rule that causes the exception,
but a minimal reproducer (rules + facts) would be ideal.

On 03/05/2014 11:12 AM, Wolfgang Laun wrote:
> Could be a bug that has been fixed in some later version - can someone
> confirm this please?
>
> OP is using drools 5.1.1, and should try 5.6.
>
> -W
>
> On 05/03/2014, Mallikarjun Kohalli (mkohalli)  wrote:
>> Hi All,
>> We are getting the following exceptions when drools is executing some
>> rules.
>>
>> Exception:
>>
>> Caused by: java.lang.NullPointerException
>> at
>> org.drools.core.util.LeftTupleIndexHashTable.remove(LeftTupleIndexHashTable.java:251)
>> at org.drools.reteoo.NotNode.retractLeftTuple(NotNode.java:226)
>> at
>> org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateRetractLeftTuple(SingleLeftTupleSinkAdapter.java:217)
>> at
>> org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateRetractRightTuple(SingleLeftTupleSinkAdapter.java:124)
>> at org.drools.reteoo.JoinNode.retractRightTuple(JoinNode.java:151)
>> at
>> org.drools.reteoo.ObjectTypeNode.retractObject(ObjectTypeNode.java:232)
>> at
>> org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:412)
>> at
>> org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1471)
>> ... 51 more
>>
>>
>>
>> Regards,
>> Mallikarjun K
>>
> ___
> 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] Guvnor - Custom operator problem (Not finding it)

2014-03-04 Thread Davide Sottara
Evaluators are typically registered in the packagebuilder.conf file,
or passed to the packagebuilder. Did you do something equivalent in guvnor?


On 03/04/2014 05:46 PM, mattmadhavan wrote:
> Hello,
> I have written a custom operator called "inlist" and it works great in 5.4.0
> (not in 5.6.0).
>
> When I import the rules to Guvnor my rule validation fails with the
> following error:
>
> /[Administration and Timing of RT - Date RT started unknown, assumed started
> more than 365 days of diagnosis] Unable to determine the Evaluator for ID
> '*inlist*'/
>
> Any ideas please?
>
> Thanks
> Matt
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Guvnor-Custom-operator-problem-Not-finding-it-tp4028490.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] ArrayIndexOutOfBoundsException under high events load in drools CEP

2014-03-04 Thread Davide Sottara
Thanks, we'll look into this as soon as possible!!
Davide

On 03/04/2014 06:46 PM, ters wrote:
> Davide Sottara wrote
>> However, the *deadlock* situation might have exposed a bug.
>> Could you please submit a self-contained reproducer?
> Davide, I've posted on forum new  topic with complete example and
> description
> <http://drools.46999.n3.nabble.com/Drools-6-0-1-CEP-stucks-during-marshaling-in-fireUntilHalt-mode-td4028493.html>
>   
> Hope it helps anyone of us.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071p4028494.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] Simple aggregation problem

2014-03-03 Thread Davide Sottara
Drools does not have "groupBy", the rule you have written will react to
each Product.

You need something like:

rule Acc
when
  // get all Ids
  accumulate( Product( $id : id ), $ids : collectSet(
$id ) ) 
  // for each Id
  $idx : String() from $ids
  // accumulate the Products
  accumulate( Product( id == $idx, $p : price ), $sum :
sum( $p ) )
then
   System.out.println( $idx + ' : ' + $sum );
end

This is to give you an idea, for example you could split the rule in two
or use helper facts



On 03/03/2014 12:43 PM, Raja Sekhar wrote:
> Hi Davide,
> I am trying to group by Hild. Here first i will get the hlld into id
> and segregate the results by hild and sum the value t1
> If you take an sql 
> select sum(t1),hlid from product group by hild
> so i will get
> if the data is 
> hlid t1
> 110 
> 110
> 2   10
> 2   10
> the result would be
> hiid t1
> 1   20
> 2   20
> Hope you understand what i am trying to do here
>
> Regards,
> Raja
>
> Regards,
> Raja
>
>
>
> On 3 March 2014 17:05, Davide Sottara  <mailto:dso...@gmail.com>> wrote:
>
> Raja,
> it is not clear what you are trying to achieve.
>
> The rule might be well written or not, we don't know your
> requirements.
> If "id" is what it should be - an identifier - your accumulate
> constraint
> would match a single object for each Product (the original product
> itself),
> which looks suspicious.
>
> I'll assume that you are doing a performance test and you are not
> satisfied
> with the overall execution time.
> The question, however, is: how many facts are you inserting? Are
> you firing
> all rules after the insertion of each fact, or just once at the end?
> Last, but not least, which version are you using?
>
> Accumulate should be used carefully in combination with insertLogical,
> since the former updates its result every time its fact collection
> changes.
> The latter will generate a new fact, keep track of its dependencies,
> and replace it when the accumulation result itself changes.
>
> Of course, if you were inserting 100 facts, the numbers would raise
> a warning, but could be reasonable for several thousands, if not
> hundred thousands. Citing one of your previous emails:
> "I want to test my rules with 10,000 facts to 20,000,000 facts"
>
> Best
> Davide
>
>
>
> On 03/03/2014 12:10 PM, Raja Sekhar wrote:
>> Hi,
>> I am using the following rule
>> package com.demo;
>> import com.sample.model.Product;
>> import com.sample.model.Products;
>> import java.util.List;
>> import java.util.Set;
>> dialect "mvel"
>>
>> rule "Product_0"
>> no-loop
>> when
>> Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 :
>> sum(e.t1) ) 
>> then
>>  insertLogical("hid=" + id +",T1=" + $sum1);
>> end
>>
>> I am inserting facts (Product objects) into it and firing the rules.
>> When i took performance stats from visual vm with JMX. got a time
>> of 3832ms. I can you suggest if i am doing any thing wrong with this.
>>
>> Regards,
>> Raja Sekhar 
>>
>> -- 
>> Raja Sekhar Amirapu
>> --
>> "If any anyone can do it, i can do it. If no one else can do it,
>> i must do it"
>>
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> -- 
> Raja Sekhar Amirapu
> --
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
> ___
> 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] Simple aggregation problem

2014-03-03 Thread Davide Sottara
Raja,
it is not clear what you are trying to achieve.

The rule might be well written or not, we don't know your requirements.
If "id" is what it should be - an identifier - your accumulate constraint
would match a single object for each Product (the original product itself),
which looks suspicious.

I'll assume that you are doing a performance test and you are not satisfied
with the overall execution time.
The question, however, is: how many facts are you inserting? Are you firing
all rules after the insertion of each fact, or just once at the end?
Last, but not least, which version are you using?

Accumulate should be used carefully in combination with insertLogical,
since the former updates its result every time its fact collection changes.
The latter will generate a new fact, keep track of its dependencies,
and replace it when the accumulation result itself changes.

Of course, if you were inserting 100 facts, the numbers would raise
a warning, but could be reasonable for several thousands, if not
hundred thousands. Citing one of your previous emails:
"I want to test my rules with 10,000 facts to 20,000,000 facts"

Best
Davide


On 03/03/2014 12:10 PM, Raja Sekhar wrote:
> Hi,
> I am using the following rule
> package com.demo;
> import com.sample.model.Product;
> import com.sample.model.Products;
> import java.util.List;
> import java.util.Set;
> dialect "mvel"
>
> rule "Product_0"
> no-loop
> when
> Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 : sum(e.t1) ) 
> then
>  insertLogical("hid=" + id +",T1=" + $sum1);
> end
>
> I am inserting facts (Product objects) into it and firing the rules.
> When i took performance stats from visual vm with JMX. got a time of
> 3832ms. I can you suggest if i am doing any thing wrong with this.
>
> Regards,
> Raja Sekhar 
>
> -- 
> Raja Sekhar Amirapu
> --
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
> ___
> 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] problem with drools

2014-02-28 Thread Davide Sottara
There are a few errors in the rules

1)
not FileData( fileOld == fileNew )
will fire either 1) when there is a FileData with different lists OR 2)
when there is no FileData at all in the workingMemory

2)
the rule should not compile, unless fileOld and fileNew are STATIC
fields of the class FileData. Is this the case? If so, why?
The problem is that the rule will fire also when there is no FileData in
the WM, so calling the function there is pointless

Your rule should be rewritten as : (notice that the != operator is
overloaded, so it correctly computes "not equals")

FileData( fileOld != fileNew )

3) To do what you want, you don't even need the function - if you prefer
to use functions and code, consider dropping Drools.
A possible rule-based approach to your problem is this:

rule "Deltas"
when
FileData( $old : fileOld, $new : fileNew, fileOld != fileNew )
accumulate( $s : String( this not memberOf $old ) from $new, $plus :
collectList( $s ) )
accumulate( $t : String( this not memberOf $new ) from $old, $mins :
collectList( $t ) )
then
System.out.println( $plus );
System.out.println( $mins );
end

The other rule is fine.

Best
Davide


On 02/28/2014 09:54 AM, Sandhya Sree wrote:
> hi,
> im new to drools..im trying to create a project as follows. i have a
> class called Monitor  which monitors a folder and creates two lists
> called fileOld( which is the list of filenames in that folder at time
> t1)  and fileNew(which is the list of filenames in that folder at time
> t2). i have another class called FileData which contains two members
> fileOld and fileNew (list of strings) with getters,setters and
> constructor. fileOld and fileNew from Monitor Class are passed to
> FileData class.
>
> now i have to compare these two lists in a rule file and if they are
> not equal i have to print the lists of files added/ deleted. how to do
> this in drools.
>
> here is my rule file:
>
> rule "files are equal"
>  
> when 
> FileData(fileOld == fileNew)
> 
> then
>System.out.println("files are equal");
>
>
> end
>
> rule "files not equal"
>
>   when
> not FileData(fileOld == fileNew)
> then
>System.out.println("files are not equal");
>difference(FileData.getFileOld(),FileData.getFileNew()); 
>
> end
>
>
> function void difference(List fileOld, List fileNew)
> {
>   
>
>   ArrayList add = new ArrayList(fileNew);
>   add.removeAll(fileOld);
>   System.out.println("files Added: " + add);
>
>   ArrayList remove = new ArrayList(fileOld);
>   remove.removeAll(fileNew);
>   System.out.println("files Removed: " + remove);
> }   
>
>
> but this displays the following error...
>
> Rule Compilation error : [Rule name='files not equal']
> Cannot make a static reference to the non-static method getFileOld()
> from the type FileData
> Cannot make a static reference to the non-static method getFileNew()
> from the type FileData
>
>
>
> what can be done??
>
>
> ___
> 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] Nested negation constraints behavior change from Drools 5.x to 6.x

2014-02-27 Thread Davide Sottara
We could reproduce the issue, it's now in a unit test:
https://github.com/droolsjbpm/drools/pull/317/files

Thanks for reporting this!!
Davide

On 02/28/2014 12:44 AM, mikerod wrote:
> I made a basic jar that only depends on Drools.
>
> All the rules do is output to standard out to demonstrate.
> This can just be ran with:
> `mvn exec:java -Dexec.mainClass="example.drools.TestingNestedNegation"`
>
> This is with v6.0.1.Final; so switching this in the pom.xml to 5.6.0.Final,
> for example, will cause the different behavior between the versions i.e.
> changing 6.0.1.Final in pom.xml .
>
> @Mark I looked at the link and he had a zip file.  I'm guessing a jar with a
> main class in it is sufficient? drools-example-tests-1.0-SNAPSHOT.jar
> 
>   
>
> Also, I am still using the now, legacy API for the kb and Stateful session. 
> I tried to add the logback.xml config file, but it doesn't seem to work
> quite so simply there.  That is likely due to me not reading up on the new
> API yet...  I'm hoping the initial uplift to v6.x can just be to the legacy
> API and migrate over later on.
>
> I don't think the API choice would make this behavioral change in the rules
> nonetheless.
>
> Let me know what else would be helpful.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-change-from-Drools-5-x-to-6-x-tp4028390p4028398.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] NullPointerException when calling Scan manually

2014-02-27 Thread Davide Sottara
Could you please share the unit test?
Thanks
Davide

On 02/27/2014 11:42 AM, Brecht De Rooms wrote:
> Dear Drools users,
>
> I just merged all my code to Drools 6.0.1 and I am happy to see that it is  
> more stable. Several issues I had with 5.6.x do not present themselves in  
> 6.0.1. I am still stuck on one bug however that occurs randomly. I wrote a  
> unit test in which I deploy new rules and then call scanNow. Often the  
> unit test succeeds, but sometimes it throws this nullpointer exception.
>
>
> java.lang.NullPointerException
>   at  
> org.drools.core.rule.Package.getRulesGeneratedFromResource(Package.java:668)
>   at  
> org.drools.core.rule.Package.removeRulesGeneratedFromResource(Package.java:658)
>   at  
> org.drools.core.reteoo.ReteooRuleBase.removeObjectsGeneratedFromResource(ReteooRuleBase.java:1653)
>   at  
> org.drools.compiler.compiler.PackageBuilder.removeObjectsGeneratedFromResource(PackageBuilder.java:4150)
>   at  
> org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:149)
>   at  
> org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:214)
>   at  
> org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:204)
>   at derooms.be.engine.RuleEngine.scanNow(RuleEngine.java:111)
>   at  
> derooms.be.engine.ruleDeployment.RulesPackageWriter.deployRules(RulesPackageWriter.java:104)
>   at  
> derooms.be.engine.ruleDeployment.RulesPackageWriter.addRules(RulesPackageWriter.java:84)
>   at  
> derooms.be.engine.dynamicRuleWatcher.RuleFileHandler.handleModifiedFile(RuleFileHandler.java:50)
>   at  
> derooms.be.engine.dynamicRuleWatcher.RulesWatcherRunnable.run(RulesWatcherRunnable.java:105)
>   at java.lang.Thread.run(Thread.java:744)
>
>
> Does anyone have an idea what the problem might be?
> Kind Regards,
> Brecht
>
> -
> Brecht De Rooms
> Phd Student @ WISE
> Department of Computer Science
> Vrije Universiteit Brussel
> Pleinlaan 2, B-1050 Brussels, Belgium
>
> office: 10 G 731f
> phone: +32 2 629 37 49
> email: bdero...@vub.ac.be
> -
>
> ---
> Dit e-mailbericht bevat geen virussen en malware omdat avast! 
> Antivirus-bescherming actief is.
> http://www.avast.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] Source from Snapshot in Guvnor 5.6

2014-02-26 Thread Davide Sottara
Yes, instead of the URL

http:// ... /packages/ [my pack ] / binary

use

http:// ... /packages/ [my pack ] / source




On 02/26/2014 10:24 PM, gboro54 wrote:
> Is there a way to download the drl of a snapshot? I know you can see the
> rules in the Guvnor(uneditable of course) but is there a way to actual
> download the DRL file? 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Source-from-Snapshot-in-Guvnor-5-6-tp4028355.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] What is the 5.6_dynamic branch?

2014-02-26 Thread Davide Sottara
5.6.x is the master of the 5.x series..
5_6 dynamic is a temporary branch, created for development or test purposes,
which has never been deleted

On 02/26/2014 09:59 PM, dunnlow wrote:
> What is the difference between the 5.6.x and 5.6_dynamic branches in github?
>
> Thanks,
> -J
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/What-is-the-5-6-dynamic-branch-tp4028353.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] @key declarations for a type - What's under the hood?

2014-02-26 Thread Davide Sottara
In recent versions, knowledge bases allow to retrieve "fact types" by
package and class name.
Those may be the descriptor classes that you are looking for

On 02/26/2014 08:23 PM, profversaggi wrote:
> I was looking for something along the lines of a method of inspecting the
> resulting code of any arbitrary @key declarations I might want to deploy. Is
> there such a way?
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-under-the-hood-tp4028343p4028346.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 5.6.0.Final PKG vs DRL infinite loop

2014-02-26 Thread Davide Sottara
Ok, so I have to test it.
There could be two possible failure points:

1) The compiler should see the annotations and create the internal
data structures, tracking the fact that the classes are @PR
2) The data structures are declared in the package of the beans,
which is not (necessarily) the package where the rules are defined.
We have to ensure that ALL packages are downloaded from guvnor.

To check #2, it should be enough to ensure that the rules and the
classes live in the same package

I'll get back to you later
Davide


On 02/26/2014 03:59 PM, gboro54 wrote:
> No luck adding ProperReactive to the classes(in the sample project). 
>
>
> Davide Sottara wrote
>> I think I see the problem - though I haven't been able to test it with
>> guvnor.
>>
>> Property Reactivity is resolved at compile time, when the package is
>> built.
>>
>> When you load the DRL, you set PropertyReactive.ALWAYS in the (local)
>> KnowledgeBuilder, so it will consider all classes as PR.
>>
>> However, afaik there is no way to do the same in Guvnor, so its (remote)
>> builder will create the Packages as if the classes were NOT
>> PropertyReactive.
>>
>> Could you try to annotate the model classes with @PropertyReactive before
>> you load the jar in guvnor?
>>
>> Davide
>>
>>
>> On 02/25/2014 11:53 PM, gboro54 wrote:
>>> test-drools.zip
>>> <http://drools.46999.n3.nabble.com/file/n4028329/test-drools.zip>;  
>>>
>>> Here is a sample project which shows the issue. You can build the project
>>> as
>>> the fact model and upload the drl into guvnor
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>>
>> rules-users@.jboss
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028335.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 5.6.0.Final PKG vs DRL infinite loop

2014-02-26 Thread Davide Sottara
I think I see the problem - though I haven't been able to test it with
guvnor.

Property Reactivity is resolved at compile time, when the package is built.

When you load the DRL, you set PropertyReactive.ALWAYS in the (local)
KnowledgeBuilder, so it will consider all classes as PR.

However, afaik there is no way to do the same in Guvnor, so its (remote)
builder will create the Packages as if the classes were NOT
PropertyReactive.

Could you try to annotate the model classes with @PropertyReactive before
you load the jar in guvnor?

Davide


On 02/25/2014 11:53 PM, gboro54 wrote:
> test-drools.zip
>   
>
> Here is a sample project which shows the issue. You can build the project as
> the fact model and upload the drl into guvnor
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.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 5.6.0.Final PKG vs DRL infinite loop

2014-02-25 Thread Davide Sottara
Thanks!
I'll get back to you tomorrow with the results

On 02/25/2014 11:53 PM, gboro54 wrote:
> test-drools.zip
>   
>
> Here is a sample project which shows the issue. You can build the project as
> the fact model and upload the drl into guvnor
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028329.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 5.6.0.Final PKG vs DRL infinite loop

2014-02-25 Thread Davide Sottara
Interesting.. this may be a bug in the serialization process, and it may
affect 6.x too
Could you please check it with a package that contains a single rule
using a single
@propertyReactive class?

On 02/25/2014 09:25 PM, gboro54 wrote:
> Also note we are using property reactive listener always. The rules do modify
> an object that a bunch of the rules use however the modified property is not
> being evaluated(i.e no rule is checking the property at the moment). 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-5-6-0-Final-PKG-vs-DRL-infinite-loop-tp4028318p4028320.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] ArrayIndexOutOfBoundsException under high events load in drools CEP

2014-02-25 Thread Davide Sottara
Persisting sessions manually, especially out of synchronization and
transactions, is not recommended.
As previously suggested by Mario, could you try the JPA Persistent Sessions?

However, the *deadlock* situation might have exposed a bug.
Could you please submit a self-contained reproducer?

Thanks
Davide

On 02/25/2014 02:13 PM, Ievgenii wrote:
> Hello,
> I have the same problems in my CEP project, and I would appreciate any help.
> It's very important for me.
> Thank you.
>
> Best Regards,
> Ievgeni.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071p4028301.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 error log msg?

2014-02-25 Thread Davide Sottara
  _description:catalog['description'],
>  _selector:("from Alert where " + 
> "name like '%Error'" + 
> "and not severity='Harmless'" + 
> "and not state='Closed'"
>  )
>   )
>then
> System.out.println("ClearAlertRule is processed.")
>  EntityBuilder entityBuilder = new EntityBuilder();
>  entityBuilder.addProperty("modifiedBy","ClearAlertRule")
> entityBuilder.addProperty("state","Closed");
>  AlertHandler alertHandler = new
> AlertHandler(entityBuilder.getProperties(),_selector);
>  alertHandler.update();
>  RuleLogHandler ruleLogHandler = new RuleLogHandler();
> ruleLogHandler.create("ClearAlertRule",_name);
>end
>
> //--
> rule 'CreateAlertRule'
> //--
>dialect  'mvel'
>salience 700
>no-loop
>when
>  _event : Event(eventClass == "Event",
> _name:catalog['name'],
>  _category:catalog['category'],
>  _severity:catalog['severity'],
>  _priority:catalog['priority'],
>  _state:catalog['state'],
>  _source:catalog['source'],
>  _subSource:catalog['subSource'],
>  _origin:catalog['origin'],
>  _subOrigin:catalog['subOrigin'],
>  _owner:catalog['owner'],
>  _description:catalog['description'],
>  _selector:("from Alert where " + 
> "name='" + catalog['name'] + "' " + 
> "and severity='" + catalog['severity'] + "' " + 
> "and not state='Closed'"
>  )
>   )
>  eval(isDuplicate(_event,"CreateAlertRule",_selector) == false)
>then
> System.out.println("CreateAlertRule is processed.");
> EntityBuilder entityBuilder = new EntityBuilder();
>  entityBuilder.addProperty("modifiedBy","CreateAlertRule");
>  entityBuilder.addProperty("name",_name);
>  entityBuilder.addProperty("category",_category);
>  entityBuilder.addProperty("severity",_severity);
>  entityBuilder.addProperty("priority",_priority);
>  entityBuilder.addProperty("state",_state);
>  entityBuilder.addProperty("source",_source);
>  entityBuilder.addProperty("subSource",_subSource);
>  entityBuilder.addProperty("origin",_origin);
>  entityBuilder.addProperty("subOrigin",_subOrigin);
>  entityBuilder.addProperty("owner",_owner);
>  entityBuilder.addProperty("description",_description);
>  AlertHandler alertHandler = new
> AlertHandler(entityBuilder.getProperties(),_selector);
> alertHandler.create();
> RuleLogHandler ruleLogHandler = new RuleLogHandler();
> ruleLogHandler.create("CreateAlertRule",_name);
>end
>
> //--
> rule 'EventRetractionRule'
> //--
>dialect  'mvel'
>salience 1
>no-loop
>when
>  _event : Event(eventClass == "Event",
>
> _name:catalog['name'] not contains 'Timer'
>
>
>   )
>then
> System.out.println("EventRetractionRule is processed.");
> retract(_event);
>  RuleLogHandler ruleLogHandler = new RuleLogHandler();
> ruleLogHandler.create("EventRetractionRule",_name);
>end
>
>
>
> 2014-02-25 14:00 GMT+01:00 Markus Schneider
> mailto:markus.schneide...@gmail.com>>:
>
> Hi Davide,
>
> thank you for the fast response. I've defined an
> DebugAgendaEventListener as it's described here:
> Drools Docu 5.5.0-Final/Section 7.2/HelloWorld example.
> 
> http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html/index.html
>
> Where can I find any docu about the config of the
> DebugAgendaEventListener?
>
> Cheers,
>
> -markus
>
>  
>
>
> 2014-02-25 12:59 GMT+01:00 Davide Sottara  <mailto:dso...@gmail.com>>:
>
> You likely have configured a DebugAgendaEventList

Re: [rules-users] Drools error log msg?

2014-02-25 Thread Davide Sottara
You likely have configured a DebugAgendaEventListener, which logs agenda
events (rules activated, fired, etc..)
on the standard error rather than the standard output. If you want a
different behavior, remove the listener
and implement one of your own.
These are not errors anyway.
Davide

On 02/25/2014 09:40 AM, Markus Schneider wrote:
> Hi list,
>
> I see the following error msg in my drools log but I don't know how to
> interpret this.
> Do I have a serious problem here?
>
> Has anybody a clue?
>
> Thanks in advance.
>
> Cheers,
>
> -markus
>
> | Error ==>[AfterActivationFiredEvent: getActivation()=[Activation
> rule=UpdateAlertRule, act#=37, salience=900, tuple=[fact
> 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event
> : 19]
> ],
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87]
> | Error ==>[BeforeActivationFiredEvent:  getActivation()=[Activation
> rule=EventRetractionRule, act#=36, salience=1, tuple=[fact
> 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event
> : 19]
> ],
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87]
> EventRetractionRule is processed.
> | Error ==>[ObjectRetractedEventImpl: getFactHandle()=[fact
> 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event
> : 19], getOldObject()=rapideca.plugins.rbm.entity.Event : 19,
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87,
> getPropagationContext()=PropagationContextImpl [activeActivations=0,
> dormantActivations=2, entryPoint=EntryPoint::DEFAULT, factHandle=[fact
> 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event
> : 19], leftTuple=[fact
> 0:19:184363445:184363445:19:DEFAULT:rapideca.plugins.rbm.entity.Event
> : 19]
> , originOffset=-1, propagationNumber=40, rule=[Rule
> name=EventRetractionRule, agendaGroup=MAIN, salience=1, no-loop=true],
> type=1]]
> 2014-02-25 08:59:03,524 [eventQueueReceiverJmsListenerContainer-1]
> INFO  log.RuleLogHandler  - RuleLog with id: 38 was successfully saved.
> | Error ==>[AfterActivationFiredEvent: getActivation()=[Activation
> rule=EventRetractionRule, act#=36, salience=1, tuple=[fact
> 0:-1:184363445:184363445:19:null:null]
> ],
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@6dd4ab87]
>
>
> ___
> 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] "in" syntax breaking the Rete Tree

2014-02-20 Thread Davide Sottara
Please open a JIRA ticket, this is the way bugs are reported to the
development team.

https://issues.jboss.org/browse/DROOLS

Davide

On 02/20/2014 03:38 PM, droolster wrote:
> @laune, any update? Should I post to Stackoverflow as you are active there.
> Is this forum dead?
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/in-operator-breaking-the-Rete-Tree-tp4028148p4028204.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] Custom Operator - 5.4.0 works but nor not in 5.6.0.

2014-02-17 Thread Davide Sottara
Matt, I had answered another thread directly on the forum, I'm not sure
that it made it to the user list.
This was my answer:

>

I have noticed another small detail:
<< The error is:
[Error: inlist0.evaluate( PRIMARY_SITE, ("C500-C505") ):
org.drools.common.DefaultFactHandle cannot be cast to java.lang.String]
[Near : {... inlist0.evaluate( PRIMARY_SITE }]
>>

Since PRIMARY_SITE is capitalized, is it a regular field, or something
else like a global?
There was a bug we found last week which may be related:
https://issues.jboss.org/browse/DROOLS-426

Davide


  

On 02/17/2014 05:25 PM, mattmadhavan wrote:
> Hi Wolfgang,
> "cannot cast primarySite to a FactHnadle " is the out put I am receiving
> from the rule processing. 
>
> The reality is that, there is an issue with my custom operator when I try to
> extract the value. Any ideas please?
>
> Thanks
> Matt
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Custom-Operator-5-4-0-works-but-nor-not-in-5-6-0-tp4028126p4028152.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] java.lang.NullPointerException when using a custom operator

2014-02-17 Thread Davide Sottara
Unfortunately I am not completely surprised... ironically, that function
signature was changed at some point to simplify the code and make it more
robust internally. 
The change, however, broke the backwards compatibility with existing custom
implementations (something the users can fix) and the way the evaluators are
invoked by MVEL in the constraints. 
The latter required to create an EvaluatorWrapper class which is responsible
for matching the Objects to their handles and extractors. 

>From what you say, there seems to be a problem in the latter: 
"the first step return back the same factHandle object"

Could you make sure that the factHandle is holding the correct object and
that the extractor is a ClassFieldExtractor trying to read the appropriate
field?
A self-contained reproducer would also be appreciated. Some bugs related to
the custom evaluators were fixed last week in 6.1 master, 
it would be important to know if this bug is still there, and whether the
fixes should be backported and how
Thank you in advance
Davide



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-java-lang-NullPointerException-when-using-a-custom-operator-tp4025287p4028143.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] packageBuilder.getPackage() returns null

2014-02-17 Thread Davide Sottara
Could you provide a full reproducer: rules, java snippet and stack trace
of your exceptions?
As a side note, is the path correct? "dymanic" looks like a typo..
Thanks
Davide

On 02/17/2014 09:34 AM, Raja Sekhar wrote:
> Hi
> i am trying to use drools template
> String drl = resultSetGenerator.compile(resultSet, new
> FileInputStream(new File("D:\\Raj\\dymanic.drt")));
> complied drl as above 
> when i try add the pakage packageBuilder.getPackage()  it return null
> i am using the 5.6.0.Final version of drools
>
> Regards,
> Raja Sekhar Amirapu
> --
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
> ___
> 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] java.lang.NullPointerException when using a custom operator

2014-02-14 Thread Davide Sottara
Could you please show the stack trace of the exception and the rule that
causes it?
Thanks
Davide

On 02/14/2014 02:38 AM, mattmadhavan wrote:
> Hello, 
> I am having a hard time with a custom operator. It works great  in 5.2 but
> not in 5.6. Do you mind sharing your email ample for 5.6 please? I  spent 
> the whole day  today on this issue. 
> There are Any differences between a 5.2 5.6 and 6.0.x.
>
> Your example works great for 6.0.x btw. 
>
> Thanks in advance.! 
>
> Matt 
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-java-lang-NullPointerException-when-using-a-custom-operator-tp4025287p4028110.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] ArrayIndexOutOfBoundsException under high events load in drools CEP

2014-02-12 Thread Davide Sottara
I can see a few independent issues here.
Drools 5.x was not designed to be thread-safe in general: there are some
known
critical races that may arise when multiple threads are inserting
facts in parallel. Many have been patched in 5.6, but the real
solution to the problem will be introduced in the 6.x series.

On a separate notice, are you trying to marshal the session while
facts are being inserted by the various threads? I don't think
that there is a test case for that, so a reproducer would be really
appreciated.
Thanks
Davide


On 02/11/2014 03:20 PM, ters wrote:
> Hi, drools users/developers. As mentioned in subject, I often faced
> ArrayIndexOutOfBoundsException under high events load in drools during
> marshaling. 
> Conditions: drools CEP (5.4.0.Final), Stream mode, fireUntilHalt mode,
> during very active marshaling process (in several threads) I often have such
> trace:
> java.lang.ArrayIndexOutOfBoundsException: 2773
>   at
> org.drools.marshalling.impl.ProtobufOutputMarshaller.orderFacts(ProtobufOutputMarshaller.java:592)
>   at
> org.drools.marshalling.impl.ProtobufOutputMarshaller.writeFactHandles(ProtobufOutputMarshaller.java:533)
>   at
> org.drools.marshalling.impl.ProtobufOutputMarshaller.serializeSession(ProtobufOutputMarshaller.java:139)
>   at
> org.drools.marshalling.impl.ProtobufOutputMarshaller.writeSession(ProtobufOutputMarshaller.java:100)
>   at
> org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:169)
>   at
> org.drools.marshalling.impl.ProtobufMarshaller.marshall(ProtobufMarshaller.java:151)
>   at
> com.blablabla.cep.CEPEventProcessor.marshalWorkingMemory(CEPEventProcessor.java:332)
>
> This exception occurs really often.
> I googled fresh tracked bug
> https://bugzilla.redhat.com/show_bug.cgi?id=1044577. As I understand, this
> bug is fixed in drool 5.3.x branch, but we using drools-core 5.4.0.Final. 
>
> So could you please help me what to do with this exeption? 
> Thanks in advance.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/ArrayIndexOutOfBoundsException-under-high-events-load-in-drools-CEP-tp4028071.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 : 2 identical calls to the same knowledgeBase don't give the same result… why?

2014-02-10 Thread Davide Sottara
It is a bug, I'd say related to constraint jitting..
It seems to work with 5.6.0.Final, could you please try that version?
Thanks
Davide

On 02/10/2014 06:06 PM, antoine wrote:
> Hello,
>
> I've faced some weird result using Drools 5.5.0.Final, and I would like to
> know if I am doing something wrong ?
>
> I am using drools to process some user rules (the Excel way). If I call the
> rules with the exact same data at different time in the process, I don't get
> the same result. (I am using a StateLessSession)
>
> After digging a bit more, I managed to extract a very simple maven-based
> unit-test to reproduce the problem. (the archive can be downloaded here : 
> http://www.filedropper.com/using-drools
>    )
>
> In fact, I call many times to execute the same rule, and after the 23rd
> times I don't get the same expected result :
> @RunWith(SpringJUnit4ClassRunner.class)
> @ContextConfiguration({ "classpath:status-rules-config.xml" })
> public class StatusRuleTest {
> @Autowired StatusRule ruleRunner;
>
> @Test public void do_not_work_at_25th_call() throws Exception {
> for(int i = 0 ; i < 35 ; i++){
> MyFact fact = new MyFact();
> assertThat(fact.getStatus()).isEqualTo("NONE");
>
> ruleRunner.defineStatus(fact);
>
> assertThat(fact.getStatus()).isEqualTo("DONE");
> }
> }
> }
>
> with rule definition as :
> public class StatusRuleImpl implements StatusRule {
>
> @Setter private StatelessKnowledgeSession ksessionStatus;
>
> @Override
> public void defineStatus(MyFact myFact) {
> ksessionStatus.addEventListener(new DebugAgendaEventListener() );
> ksessionStatus.addEventListener(new
> DebugWorkingMemoryEventListener());
> ksessionStatus.execute(myFact);
> }
> }
>
> It uses a statelessSession, with sequential mode and ACTIVATION-GROUP
> column.
> I also posted more details and more logs here : 
> http://stackoverflow.com/questions/21585666/drools-2-identical-calls-to-the-same-knowledgebase-dont-give-the-same-result
> 
>   
>
> >From what I checked, it might be coming from the negative BigDecimal (If I
> change it to 10 in both of the code and the Excel, it seems to work)
>
> If someone has an Idea, I will be pleased to read it !
> Thanks in advance,
>
> Antoine
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-2-identical-calls-to-the-same-knowledgeBase-don-t-give-the-same-result-why-tp4028038.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] 5.6.0.CR1 gives a NullPointerException in after evaluator

2014-02-03 Thread Davide Sottara
Noted, and under investigation.
Thanks
Davide

On 02/03/2014 12:32 PM, nxv wrote:
> Hello,
>
> I have the same problem with kie 6.1.0-SNAPSHOT :(
>
> Here is the unit test:  Drools-after-61.zip
> <http://drools.46999.n3.nabble.com/file/n4027965/Drools-after-61.zip>  
>
>
>
> nxv wrote
>> The problem is the same as reported by abr.  I work with abr on the
>> project :)  As he could not reproduce the bug, I just removed lines of
>> code as much as possible to keep only the essentials.  Here is a unit
>> test: 
>> Drools-after.zip
>> <http://drools.46999.n3.nabble.com/file/n4027676/Drools-after.zip>  
>>
>> Davide Sottara wrote
>>> This is unlikely to be the same exception that started the initial
>>> thread, but a problem nevertheless.. :(
>>> could you create a self-contained test case and submit it?
>>> Thanks
>>> Davide
>>>
>>> On 01/13/2014 08:05 AM, Mark Proctor wrote:
>>>> That was recreated on 5.6.0.CR1 ? The 5.6 ship has sailed now :( and
>>>> currently there are no plans for 5.7 any time soon. We should focus on
>>>> making sure this is fixed in 6.x.
>>>>
>>>> Mark
>>>> On 12 Jan 2014, at 19:21, nxv <
>>> nxvanderlinden@
>>> > <mailto:
>>> nxvanderlinden@
>>> >> wrote:
>>>>> Hello,
>>>>>
>>>>> I'm able to reproduce this issue with a KB containing only 1 rule.
>>>>>
>>>>> rule "Qualification##ToControl"
>>>>> salience 50
>>>>>when
>>>>> $p: AccessRegisterSnapshot(
>>>>> $effDt: effectivedate )
>>>>> $dpo: DeliveryPoint()
>>>>> $gCfg: GeneralConfig(
>>>>> ( todate == null || 
>>>>>   ( todate after[ 0d ] $effDt &&
>>>>> todate after[ 1ms ] fromdate ) ) )
>>>>> from $dpo.generalConfigs
>>>>>then
>>>>>
>>>>> end
>>>>>
>>>>> This rule worked under drools 5.5.0.Final.  
>>>>>
>>>>> Caused by: java.lang.NullPointerException at
>>>>> org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluate(AfterEvaluatorDefinition.java:347)
>>>>> at org.drools.base.EvaluatorWrapper.evaluate(EvaluatorWrapper.java:99)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Davide Sottara wrote
>>>>>> I tried to reproduce the problem, with no success.
>>>>>> Could you please create a self-contained unit test?
>>>>>> If confirmed, I'll fix the problem as soon as possible
>>>>>> Thanks
>>>>>> Davide
>>>>>>
>>>>>> On 11/14/2013 04:48 AM, abr wrote:
>>>>>>> Hi everyone,
>>>>>>>
>>>>>>> I tried to switch from 5.5.0.Final to 5.6.0.CR1 and got a null
>>>>>>> pointer
>>>>>>> exception in the evaluation of the after evaluator.
>>>>>>> (Exact method is:
>>>>>>> /org.drools.base.evaluators.AfterEvaluatorDefinition.AfterEvaluator.evaluate(InternalWorkingMemory,
>>>>>>> InternalReadAccessor, InternalFactHandle, InternalReadAccessor,
>>>>>>> InternalFactHandle)/ )
>>>>>>>
>>>>>>> When debugging, the exception occurs at the very first line of the
>>>>>>> method,
>>>>>>> in:
>>>>>>> /if ( extractor1.isNullValue( workingMemory,
>>>>>>> handle1.getObject() ) || 
>>>>>>>extractor2.isNullValue( workingMemory, handle2.getObject()
>>>>>>> )
>>>>>>> ) {
>>>>>>>return false;
>>>>>>>}
>>>>>>> /
>>>>>>> The cause of the exception is that handle1 is null.
>>>>>>>
>>>>>>> The rule where the exception occurs looks like:
>>>>>>> /MyFact(
>>>>>>>fromdate before[ 0d ] $min,
>>>>>>>( todate == null || todate after[ 0d ] $max ) )
>>>>>>> /
>>>>>>>
>>>>>>> When the exception occurs, /MyFact.fromdate/ is not null, /$min/ is
>>>>>>> not
>>>>>>> null, /MyFact.todate/ is null, /$max/ is not null.
>>>>>>> In AfterEvaluator.evaluate : /extractor1/ refers to /MyFact.todate/,
>>>>>>> /extractor2/ refers to /$max/, /handle1/ is null, /handle2/ refers
>>>>>>> to the
>>>>>>> fact including the attribute to which /$max/ variable is bound to.
>>>>>>>
>>>>>>> Of course, this worked fine in 5.5.0.Final.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/5-6-0-CR1-gives-a-NullPointerException-in-after-evaluator-tp4026780p4027965.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] Incorrect resolution of global symbols in LHS rule constraint (Java dialect)

2014-01-30 Thread Davide Sottara
Thanks,
today we have actually identified the real cause of the error
and we are already working to get it fixed.
I wonder if a cast would also work :
MyType( (Boolean) global_invoke( this ) )
Davide

On 01/30/2014 10:03 PM, mikerod wrote:
> Thank you for your reply.  That was helpful.  I did notice that the
> workaround you proposed of 
> only calling the `some.classpath.package2.MyType (
> global_instance.invoke(this) )` was still not analyzing the constraint
> correctly.  I think this was because #invoke() was returning an
> java.lang.Object type (which would be a java.lang.Boolean at runtime).
>
> This led us to the discovery that if we just flipped the order of the
> constraint expression to:
> `some.classpath.package2.MyType ( true == global_instance.invoke(this) )`
> it works fine.
>
> It looks like with beginning the expression with `true ==` instead of having
> it `== true` after the method call, was able to be
> analyzed correctly.
>
> I posted a Jira for this @ https://issues.jboss.org/browse/DROOLS-420 .  I
> haven't logged a Drools Jira before, so hopefully
> it is filled out as expected/desired.
>
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Incorrect-resolution-of-global-symbols-in-LHS-rule-constraint-Java-dialect-tp4027921p4027935.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


  1   2   3   4   5   >