[rules-users] cannot import function

2012-01-17 Thread xdyl
HI,all:
   i want import an function in another drools file. but when i use "import
function " in drools 5.3.0.Final
   compile give me a error message:

  Rule Compilation error : [Rule name='start']
room/Rule_start.java (2:279) : Only a type can be imported.
util.convertString2Set resolves to a package
room/Rule_start.java (9:629) : The method convertString2Set(String) is
undefined for the type Rule_start

 and i search in google not find any help .
 
 

--
View this message in context: 
http://drools.46999.n3.nabble.com/cannot-import-function-tp3668460p3668460.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] APIs to create rules

2012-01-17 Thread bobbi_80
Thanks a ton MarK.
For benefit of others who may read this post here is the code snippet.

PackageDescr pkg = DescrFactory.newPackage()
   .name("org.drools.example")
   .newRule().name("Xyz")
   .attribute("ruleflow-grou","bla")
   .lhs()
   .and()
   .pattern("Foo").id( "$foo", false
).constraint("bar==baz").constraint("x>y").end()
   .not().pattern("Bar").constraint("a+b==c").end().end()
   .end()
   .end()
   .rhs( "System.out.println();" ).end()
   .getDescr();




--
View this message in context: 
http://drools.46999.n3.nabble.com/APIs-to-create-rules-tp3662689p3668409.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] drools5.2 integrate with JMS

2012-01-17 Thread Mark Proctor
On 29/11/2011 18:47, DroolersEye wrote:
> Hi, I would like to integrate JMS with drools 5.2. I have a confusion over
> selecting right approach.
> I noticed from the mailing list drools pipeline is depricated so  I assume
> that not recomended now. So ignored it than look for another option but not
> using spring? when i check the user forum I not getting any right direction
> insted more confusion selecting rigt tool. Can some one help me to provide
> me some info about integration JMS with drools without using spring?i am
> using drools5.2
look at the camel integration as part of the -integration module.

Mark
>
> thanks lot,
>
> -
> with kind regards,
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/drools5-2-integrate-with-JMS-tp3546100p3546100.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] ClassCastException when KnowledgeAgent loads declared type

2012-01-17 Thread lhorton
Thank you, Davide.  This is not a critical bug for my shop so I don't wish to
force a JIRA when other Drools work might be more important.

My workaround so far is just to rename the declared class if I have to
hot-deploy, that way there are no conflicts.

I tried to separate the declared class from the drl but did not have
success.   I tried putting the declaration into its own drl with a different
package name, but the drl file that used the declared class, even when
including an import for the package name with declared class name, did not
find the declared class.  I have not had time to troubleshoot this. Have you
done it with success?  We don't use Guvnor; instead we have drl and xls
files loaded with a change set.

No need to spend a lot of time on this, it is not critical for us, but if
you have any more insights I would be happy to hear them.

--
View this message in context: 
http://drools.46999.n3.nabble.com/ClassCastException-when-KnowledgeAgent-loads-declared-type-tp3664044p3668304.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] ClassCastException when KnowledgeAgent loads declared type

2012-01-17 Thread lhorton
I meant to say also, we use only Stateless knowledge sessions, so no worries
about existing orphaned facts.  It is all new, each session


--
View this message in context: 
http://drools.46999.n3.nabble.com/ClassCastException-when-KnowledgeAgent-loads-declared-type-tp3664044p3668305.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] Guvnor export options.

2012-01-17 Thread pm-lemos
Hi,

I'm kind of looking for a way to export the rules I wrote in Guvnor to a
.DRL file.
Is it possible? How can I do it?

Thanks in advance.
Pedro

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-export-options-tp3668262p3668262.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] How to generate drl files from knowledge builder or knowledge base?

2012-01-17 Thread Zhao Yi
I am getting a knowledge base and knowledge builder. How can I generate drl
file from them?

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-generate-drl-files-from-knowledge-builder-or-knowledge-base-tp3668202p3668202.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] How to combine different drl files

2012-01-17 Thread Zhao Yi
I have a bunch of drl files and they are in same package. How can I combine
these drl files to one big drl files? I am looking for a drools API to
generate the big drl file automatically?

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-combine-different-drl-files-tp3668184p3668184.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] APIs to create rules

2012-01-17 Thread Mark Proctor
Just generate a string with a template. You can use drools-templates 
which is based on MVEL templating.

There is also the descr builder api too that you can use, see release 
notes in documentation.


Mark
On 16/01/2012 09:43, bobbi_80 wrote:
> public static class CpuTracker{
>  private String machinename;
>  private String averageCPU;
> }
>
> Consider the following rule :
>
> rule first_rule
> @ID(“1”)
>   when
>   averageCPU>  80
>   then
>   syso("do something");
> end
>   
>
> I have the following requirements to let the user change the rules.
>
> 1)Create an app that will accept user input for rule Name, LHS , RHS of
> rule.
> 2)Add/remove rules from the knowledge base at runtime.
> 3)Display all compiled rules .
>
> For task(1) I am unable to figure out the exact APIs to programmatically
> create rules . Have gone through number of posts in user forums and docs but
> got nothing conclusive.
> For Task(3)  I could get rule name and any other meta data information but
> not LHS,RHS info. Does that mean that rules will have to be persisted and
> there are no APIs to fetch LHS/RHS at run time?
>
> What are my options here?
>
> Many Thanks,
> Dumb programmer!
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/APIs-to-create-rules-tp3662689p3662689.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] Get fact type returning null

2012-01-17 Thread kavita
Hi,

I am a beginner to drools and am trying to integrate drools rules to java .
Am doing this using changeset. 
Here's my piece of code:

package edu.arizona;

import org.drools.KnowledgeBase;

import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentFactory;

import org.drools.definition.type.FactType;
import org.drools.io.Resource;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;

public class TestRest {
 public static void main(String[] args) throws
InstantiationException,IllegalAccessException {
 StatefulKnowledgeSession ksession = null;
   KnowledgeBase kbase = readKnowledgeBase();
  
   FactType factType = kbase.getFactType("edu.arizona", 
"result");
   System.out.println (factType);
Object obj = factType.newInstance();

factType.set(obj,"rawConcentration",150);


ksession = kbase.newStatefulKnowledgeSession();
ksession.insert(obj);

ksession.fireAllRules();

System.out.println(factType.get(obj,"rescode"));

 }
 private static KnowledgeBase readKnowledgeBase() {
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("LabAgent");
Resource changeset = ResourceFactory.newClassPathResource(
"edu.arizona/lab-changeset.xml");
kagent.applyChangeSet(changeset);
KnowledgeBase kbase = kagent.getKnowledgeBase();

kagent.dispose();
return kbase;
}
}


When i run the application the  System.out.println (factType) is printing as
null.  and getting 

Exception in thread "main" java.lang.NullPointerException
at edu.arizona.TestRest.main(TestRest.java:20)

What am i missing? Please help.

Thanks,
Kavitha.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Get-fact-type-returning-null-tp3667266p3667266.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] ArrayIndexOutOfBounds exception when predicate parameter is varArgs

2012-01-17 Thread Martin A
Thanks for your reply Vincent :)

Best regards,
Martin

On Tue, Jan 17, 2012 at 9:08 PM, Vincent Legendre <
vincent.legen...@eurodecision.com> wrote:

> ok, did not know that.
> If you use lists, you can use the 'contains' operator then, instead of
> your predicates (will be more efficient).
>
> But I think it is better to deal with Event objects (will be even more
> efficient, and far much extensible in the future when you will want to
> add more business logic, for example using fusion temporal operators ...).
> And may be that in fact, it is your GameStateController that should be a
> living ksession in where you post events ...
>
>
> Le 17/01/2012 19:58, Martin A a écrit :
> > Hi, Vincent,
> >
> > No, it's actually a List events that is a property of that
> > GameStateController, not Event objects.
> > Ok I will workaround it, but I guess it may be a bug, because I think
> > that varArgs feature was not supported in 5.2.1, and is something new...
> >
> > Best regards,
> > Martin
>
> ___
> 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] ArrayIndexOutOfBounds exception when predicate parameter is varArgs

2012-01-17 Thread Vincent Legendre
ok, did not know that.
If you use lists, you can use the 'contains' operator then, instead of 
your predicates (will be more efficient).

But I think it is better to deal with Event objects (will be even more 
efficient, and far much extensible in the future when you will want to 
add more business logic, for example using fusion temporal operators ...).
And may be that in fact, it is your GameStateController that should be a 
living ksession in where you post events ...


Le 17/01/2012 19:58, Martin A a écrit :
> Hi, Vincent,
>
> No, it's actually a List events that is a property of that 
> GameStateController, not Event objects.
> Ok I will workaround it, but I guess it may be a bug, because I think 
> that varArgs feature was not supported in 5.2.1, and is something new...
>
> Best regards,
> Martin

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


Re: [rules-users] ArrayIndexOutOfBounds exception when predicate parameter is varArgs

2012-01-17 Thread Martin A
Hi, Vincent,

No, it's actually a List events that is a property of that
GameStateController, not Event objects.
Ok I will workaround it, but I guess it may be a bug, because I think that
varArgs feature was not supported in 5.2.1, and is something new...

Best regards,
Martin

2012/1/17 Vincent Legendre 

>  May be drool cannot support variable length arguments in methods. But,
> seeing your rules, I think you should change the way you match your events
> objects by exploiting drools syntax and RETE instead of calling predicates.
>
> If I understand well, you are creating a game, and this rule should
> trigger when the player achives some goals to pass him to next level.
> So I guess that your GameStateController contains a set of Event objects ?
> If yes, I recommend inserting directly the event in the session, and write
> a rule like this :
>
>  rule "quest_reach_level_1_in_any_category_accomplished"
> when
> Event(id == "eventId")
> *not *Event(id == "otherEventId")
> *exists *Event(id == "param1" || "param2" || "param3"  etc
> etc)
> $gsc : GameStateController()   // if you still need it, consider
> adding it as a global
>  $response : Response() // if you can, set it as
> global
>  then
> ... some business logic
> end
>
> Note that it is solving the problem of varaible length argument, using the
> fact that you can add easily new terms to a boolean expression.
>
> Le 17/01/2012 19:23, Martin A a écrit :
>
> Hello, guys,
>
>  I've got a rule which states:
>
>  rule "quest_reach_level_1_in_any_category_accomplished"
> when
> $gsc : GameStateController(hasEventOccurred("eventId") &&
> !hasEventOccurred("otherEventId") && hasAnyEventOccurred("param1",
> "param2", "param3", "param4", "param5", "param6", "param7", "param8",
> "param9", "param10", "param11", "param12"))
> $response : Response()
> then
> ... some business logic
> end
>
>  which ends up with:
>
>  Caused by: org.drools.RuntimeDroolsException: Exception executing
> predicate hasA
> nyEventOccurred("level1_love", "level1_friendship", "level1_prosperity",
> "level1
> _charisma", "level1_willpower", "level1_wisdom", "level1_entertainment",
> "level1
> _adventure", "level1_inspiration", "level1_harmony",
> "level1_lightheartedness",
> "level1_confidence")
> at
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
>
>
> I'm using Drools 5.3.0.Final and it fails when it comes to evaluating the
> predicate hasAnyEventOccurred(String... varArgs).
>
>  Thanks,
> Martin
>
>
> ___
> rules-users mailing 
> listrules-users@lists.jboss.orghttps://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] ArrayIndexOutOfBounds exception when predicate parameter is varArgs

2012-01-17 Thread Vincent Legendre
May be drool cannot support variable length arguments in methods. But, 
seeing your rules, I think you should change the way you match your 
events objects by exploiting drools syntax and RETE instead of calling 
predicates.


If I understand well, you are creating a game, and this rule should 
trigger when the player achives some goals to pass him to next level.

So I guess that your GameStateController contains a set of Event objects ?
If yes, I recommend inserting directly the event in the session, and 
write a rule like this :


rule "quest_reach_level_1_in_any_category_accomplished"
when
Event(id == "eventId")
*not *Event(id == "otherEventId")
*exists *Event(id == "param1" || "param2" || "param3"  etc etc)
$gsc : GameStateController()   // if you still need it, 
consider adding it as a global

$response : Response() // if you can, set it as global
then
... some business logic
end

Note that it is solving the problem of varaible length argument, using 
the fact that you can add easily new terms to a boolean expression.


Le 17/01/2012 19:23, Martin A a écrit :

Hello, guys,

I've got a rule which states:

rule "quest_reach_level_1_in_any_category_accomplished"
when
$gsc : GameStateController(hasEventOccurred("eventId") && 
!hasEventOccurred("otherEventId") && hasAnyEventOccurred("param1", 
"param2", "param3", "param4", "param5", "param6", "param7", "param8", 
"param9", "param10", "param11", "param12"))

$response : Response()
then
... some business logic
end

which ends up with:

Caused by: org.drools.RuntimeDroolsException: Exception executing 
predicate hasA
nyEventOccurred("level1_love", "level1_friendship", 
"level1_prosperity", "level1
_charisma", "level1_willpower", "level1_wisdom", 
"level1_entertainment", "level1
_adventure", "level1_inspiration", "level1_harmony", 
"level1_lightheartedness",

"level1_confidence")
at 
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)



I'm using Drools 5.3.0.Final and it fails when it comes to evaluating 
the predicate hasAnyEventOccurred(String... varArgs).


Thanks,
Martin


___
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] ArrayIndexOutOfBounds exception when predicate parameter is varArgs

2012-01-17 Thread Martin A
Hello, guys,

I've got a rule which states:

rule "quest_reach_level_1_in_any_category_accomplished"
when
$gsc : GameStateController(hasEventOccurred("eventId") &&
!hasEventOccurred("otherEventId") && hasAnyEventOccurred("param1",
"param2", "param3", "param4", "param5", "param6", "param7", "param8",
"param9", "param10", "param11", "param12"))
$response : Response()
then
... some business logic
end

which ends up with:

Caused by: org.drools.RuntimeDroolsException: Exception executing predicate
hasA
nyEventOccurred("level1_love", "level1_friendship", "level1_prosperity",
"level1
_charisma", "level1_willpower", "level1_wisdom", "level1_entertainment",
"level1
_adventure", "level1_inspiration", "level1_harmony",
"level1_lightheartedness",
"level1_confidence")
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:145)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:149)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:149)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:468)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:436)
at
org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:288)
at
org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:271)
at
org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:459)
at
org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:363)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:298)
at
org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:306)
at
org.drools.base.ModifyInterceptor.doAfter(ModifyInterceptor.java:59)
at
org.mvel2.ast.InterceptorWrapper.getReducedValueAccelerated(InterceptorWrapper.java:38)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:87)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at
org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:105)
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 47 more
Caused by: java.lang.RuntimeException: cannot invoke method:
hasAnyEventOccurred
at
org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:62)
at
org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:106)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:87)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:100)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291)
... 67 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 12
at
org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.executeAll(MethodAccessor.java:148)
at
org.mvel2.optimizers.impl.refl.nodes.MethodAccessor.getValue(MethodAccessor.java:47)
... 73 more

I'm using Drools 5.3.0.Final and it fails when it comes to evaluating the
predicate hasAnyEventOccurred(String... varArgs).

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


Re: [rules-users] Multiple conditions in a single BRL

2012-01-17 Thread Wolfgang Laun
rule "25/30/50"
when
   Person( $age: age == 25 || == 30 || == 50 )
then
   System.out.println( $age );
end

Asking for "return" is futile.

-W

On 17/01/2012, srinivasasanda  wrote:
> Hi,
>
> Please suggest me in achieving my requirement.My requirement is.
>
> When
>
> Person age is equal to 25,Print 25 and return 25..else if Person age is
> equal to 30,Print 30 and return 30,else if Person age is equal to 50,print
> 50 return 50..
>
> How can I write these nested type of  if-else statements in a single
> BRL.Please suggest me.I tried by verifying docs bt couldnt find solution...
>
> Thanks
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Multiple-conditions-in-a-single-BRL-tp3666200p3666200.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] Multiple conditions in a single BRL

2012-01-17 Thread srinivasasanda
Hi,

Please suggest me in achieving my requirement.My requirement is.

When

Person age is equal to 25,Print 25 and return 25..else if Person age is
equal to 30,Print 30 and return 30,else if Person age is equal to 50,print
50 return 50..

How can I write these nested type of  if-else statements in a single
BRL.Please suggest me.I tried by verifying docs bt couldnt find solution...

Thanks

--
View this message in context: 
http://drools.46999.n3.nabble.com/Multiple-conditions-in-a-single-BRL-tp3666200p3666200.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] Insert and Retract from drools server in one call?

2012-01-17 Thread Wolfgang Laun
On 17/01/2012, dunnlow  wrote:
> Sorry for my terminology; I'm a noob, but I think I understand your
> suggestion.  By "initial" facts, I just mean the facts that I insert within
> my batchexecution command.  In reality, I am adding a pojo to that
> batchexecutioncommand and then my rules check the pojo's attributes.  I
> don't want that pojo to remain in memory; however, there are new facts that
> are created (RHS) by the rules that are fired and I want those to remain in
> working memory.

This is quite clear now.

>
> If I understand your response, you are suggesting one approach is to add a
> rule with a really low salience that will trigger whenever it sees the bean
> and retract it after the other rules have fired.  Something like:
>
> rule retractInitialFact
>   salience -100
> when
>   $mp:MyPojoBean
> then
>   retract($mp)
>
> Is that correct?

Yes, that's what I meant.

>  I have been trying to avoid using salience (I feel like I
> read that somewhere).

IMHO, such a "background" or "cleanup" rule is not a violation of the
general principle "Do not use salience to achieve a particular order
of rule firings."

-W

>  However, is that the most common way to do what I am
> trying to do?  There is no way in the batch execution command to add a
> "retract" as the last command?
>
> Thanks again.
> -J
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Insert-and-Retract-from-drools-server-in-one-call-tp3657736p3665856.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] Insert and Retract from drools server in one call?

2012-01-17 Thread dunnlow
Sorry for my terminology; I'm a noob, but I think I understand your
suggestion.  By "initial" facts, I just mean the facts that I insert within
my batchexecution command.  In reality, I am adding a pojo to that
batchexecutioncommand and then my rules check the pojo's attributes.  I
don't want that pojo to remain in memory; however, there are new facts that
are created (RHS) by the rules that are fired and I want those to remain in
working memory.

If I understand your response, you are suggesting one approach is to add a
rule with a really low salience that will trigger whenever it sees the bean
and retract it after the other rules have fired.  Something like:

rule retractInitialFact
  salience -100
when
  $mp:MyPojoBean
then
  retract($mp)

Is that correct?  I have been trying to avoid using salience (I feel like I
read that somewhere).  However, is that the most common way to do what I am
trying to do?  There is no way in the batch execution command to add a
"retract" as the last command?

Thanks again.
-J


--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-and-Retract-from-drools-server-in-one-call-tp3657736p3665856.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] How to run the " rule test scenarios " from the Eclipse.

2012-01-17 Thread srinivasasanda
Thanks  Toni Rikkola-2 for u r reply.

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-run-the-rule-test-scenarios-from-the-Eclipse-tp3665269p3665765.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] ClassCastException when KnowledgeAgent loads declared type

2012-01-17 Thread Davide Sottara
The problem is more complicated than it seems: imagine you

- load the DRL the first time
- create some instances of your clas
- load the DRL a second time

all the instances created so far would be "orphaned".

Likewise, all patterns include a type check: should that be updated?
We are still looking for an optimal policy. For now, my suggestion is to
include the declarations
in a different DRL (even better if you use a different package), keeping
them separate from
the rules that may have a different lifecycle.
Davide

( If this does not apply, please open a "zero-day" jira and force us to find
a solution :) )

--
View this message in context: 
http://drools.46999.n3.nabble.com/ClassCastException-when-KnowledgeAgent-loads-declared-type-tp3664044p3665692.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] Problem with Negative Patterns and Temporal Constraints

2012-01-17 Thread Geoffrey De Smet



Op 17-01-12 10:41, Mark Proctor schreef:

On 17/01/2012 08:27, Weiss, Wolfgang wrote:


Thank you for the quick answer! This makes absolutely sense and the 
rules work now as expected.


Unfortunately, I was not able to find this somewhere in the 
documentation. It would be nice to see it in the documentation of 
drools fusion.



Documentation is something anyone can do with a spare 10 minutes:
1) install git
2) install xmlmind
3) "fork" drools on github, https://github.com/droolsjbpm/drools
4) clone your fork locally
5) make changes to files with xmlmind, or xml editor of choice
https://github.com/droolsjbpm/drools/tree/master/drools-docs/drools-fusion-docs/src/main/docbook/en-US
6) commit changes, push changes back to github
7) use github gui to submit a pull request for your changes.

It'll be more obvious to users what documentation is missing, and 
they'll be able to word it better in a way that makes more sense to 
other users.

If it's just a typo you want to fix, there's a very fast method:
1) Go to github to the correct file, for example:
https://github.com/droolsjbpm/drools/blob/master/drools-docs/drools-fusion-docs/src/main/docbook/en-US/Chapter-Features/Chapter-Events/Section-Events_Semantics.xml
2) Click "Edit this file", edit it and save
3) We automatically get a pull request and can accept it easily.

The only thing that can take longer then a few seconds here is 1) 
finding the file.

But maybe the pressgang-styles can be adjusted
to generate a link next to each section title to the docbook source file 
on github.


Mark


Best,

Wolfgang

*Von:*rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] *Im Auftrag von 
*Wolfgang Laun

*Gesendet:* Montag, 16. Jänner 2012 15:58
*An:* Rules Users List
*Betreff:* Re: [rules-users] Problem with Negative Patterns and 
Temporal Constraints


I don't see that the "not" CE excludes the AnalysisCue bound to $cue 
from being

matched by the pattern inside the "not". I recommend using

*   not*(AnalysisCue(*this != $cue*, this after[0ms,2500ms] $cue) from

since "[0ms,..." does not inhibit the same event being matched by 
both patterns,

which precludes the rule from firing.

-W

2012/1/16 Weiss, Wolfgang >


Hi all!

We have the problem that the following rule never fires:

*rule*"test-rule"

*agenda-group* "evaluation"

*salience* 100

*when*

 $cue : AnalysisCue() *from* entry-point "LowLevelCueStream"

*not*(AnalysisCue(*this* after[0ms,2500ms] $cue) *from* entry-point 
"LowLevelCueStream")


*then*

 logger.debug("... some message ..");

*end*

We found out that the problem is the combination of the negation with 
the conditional element "not" and the temporal constraint 
"[0ms,2500ms]". Using the temporal operator "this after $cue" without 
a temporal constraint works correct in its semantics.


Interestingly, when adding a constraint (cueType == 1) to the type in 
the negative pattern the rule begins to work. The rule would look 
like as follows:


*rule*"test-rule"

*agenda-group* "evaluation"

*salience* 100

*when*

 $cue : AnalysisCue() *from* entry-point "LowLevelCueStream"

*not*(AnalysisCue(cueType == 1, *this* after[0ms,2500ms] $cue) *from* 
entry-point "LowLevelCueStream")


*then*

 logger.debug("... some message ..");

*end*

unfortunately the rule then fires with a delay of 4 to 5 seconds. The 
second parameter of the temporal constraint influences the delay.


When changing the first parameter of the temporal constraint to a 
value greater than 0 the rule works as expected! The constraint would 
then look like as follows: "[1ms, 2500ms]". Whereas in our case, we 
want to evaluate the time window from 0 -- 2500ms.


Our system works in the stream mode and we could reproduce this 
behaviour with the versions 5.3.1 and 5.4.0 Beta 1.


Can anybody confirm if this is a bug in Drools, or did I overlook 
here something?


Best regards,

Wolfgang Weiss


___
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


--
With kind regards,
Geoffrey De Smet

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


Re: [rules-users] ClassCastException when KnowledgeAgent loads declared type

2012-01-17 Thread Esteban Aliverti
This is a known bug: https://issues.jboss.org/browse/JBRULES-2962 Some
improvements were made in 5.3 and 5.4 but AFAIK, the issue still remains.
Could you please try using 5.4.SNAPSHOT ot beta1 to see if the error
persists?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Mon, Jan 16, 2012 at 7:21 PM, lhorton  wrote:

> Code level:  5.2.0.Final
>
> I have a DRL file that includes a declared type:
>
> package com.abclegal.rules.servicerequirements
> declare TransgressionMetaData
>attempt : ServiceAttempt
>requirement : Requirement
> end
>
> The package loads the first time and its rules run without error.  If I
> make
> a change to the file and hot-deploy it (copy it to the server), the
> ResourceChangeScanner picks up the file and KnowledgeAgent loads it, but
> when any rule from that package subsequently fires, I get a
> ClassCastException on the declared type:
>
> com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
> to com.abclegal.rules.servicerequirements.TransgressionMetaData
>
> it appears the KnowledgeAgent is not replacing the existing (in working
> memory) definition of the declared type, but instead is creating a new one
> with a different hash code.
>
> looks like a bug?
>
> Full stack trace:
> Caused by: RulesConsequenceException executing consequence for rule
> "PHOTO_WHEN_SERVED: Photo must be taken if served." in
> com.abclegal.rules.servicerequirements
> [Error: drools.insert(new TransgressionMetaData($attempt,$req)):
> com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
> to com.abclegal.rules.servicerequirements.TransgressionMetaData]
> [Near : {... @Modify with($attempt){ }]
> ^
> [Line: 1, Column: 1]
> java.lang.ClassCastException:
> com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
> to com.abclegal.rules.servicerequirements.TransgressionMetaData
> Rules working memory:
> Fact ServiceAttempt id: 17
>at
>
> com.abclegal.rules.utility.RulesConsequenceExceptionHandler.handleException(RulesConsequenceExceptionHandler.java:24)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:912)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:845)
>at
> org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1056)
>at
>
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:733)
>at
>
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:699)
>at
>
> org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
>at
>
> org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:305)
>at
>
> com.abclegal.rules.server.RulesServiceImpl.execute(RulesServiceImpl.java:378)
>... 44 more
> Caused by: [Error: drools.insert(new TransgressionMetaData($attempt,$req)):
> com.abclegal.rules.servicerequirements.TransgressionMetaData cannot be cast
> to com.abclegal.rules.servicerequirements.TransgressionMetaData]
> [Near : {... @Modify with($attempt){ }]
> ^
> [Line: 1, Column: 1]
>at
>
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:409)
>at
>
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
>at
>
> org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:67)
>at org.mvel2.ast.ASTNode.optimize(ASTNode.java:154)
>at
> org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:110)
>at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
>at
> org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
>at
> org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:115)
>at org.mvel2.MVEL.executeExpression(MVEL.java:928)
>at
> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:105)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:906)
>... 51 more
> Caused by: java.lang.reflect.InvocationTargetException
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>at java.lang.reflect.Method.invoke(Method.java:597)
>at
>
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:1066)
>at
>
> org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:338)
>... 61 more
>
>
> --
> View this message in conte

Re: [rules-users] Resource Change Scanner Service modified date error

2012-01-17 Thread Esteban Aliverti
So, maybe some change in PackageBuilder is not setting the correct Resource
to Declared Fact types. Unfortunately I don't have time right now to take a
look at this problem.
Could you try adding DRL resource instead of compiled package?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2012/1/17 Dean Eastwood 

> Hi Esteban
>
> Unfortunately I haven't had time to work further on this issue, so I don't
> have an answer yet.
>
> All I can say for now is it seems that the ReaderResources are being
> created along with the URLResource each time. This is evidenced by the
> details below.
>
> In my test, I have the following changeset based on the mortgages sample
> (I have changed my hosting port):
>
>
> --
>
> * *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'
> >*
> **
> *  type='PKG' />*
> **
> **
>
> --
>
>
> This changeset can be read as a UrlResource, ClassPathResource or
> ByteArrayResource. I then use the following code to initialise the
> KnowledgeAgent:
>
> --
>
>
> *SystemEventListenerFactory.setSystemEventListener(new
> PrintStreamSystemEventListener(System.out));*
> **
> *KnowledgeAgent kagent =
> KnowledgeAgentFactory.newKnowledgeAgent("MortgageAgent");*
> *Resource changeset =
> ResourceFactory.newClassPathResource("ChangeSet.xml");*
> *kagent.applyChangeSet(changeset);*
>
> --
>
>
> Within the System event listener output, I see that the KnowledgeAgent
> picks up all of the KnowledgeDefinitions from Drools and creates them as
> new UrlResources. Next, it picks up the KnowledgeDefinitions from drools
> and creates these all as null ReaderResources. Here is some output from my
> System event listener:
>
> --
>
>
> *[2012-01-17 10:32:32,577:debug] KnowledgeAgent rebuilding KnowledgeBase
> using ChangeSet*
> *[2012-01-17 10:32:33,410:debug] KnowledgeAgent building resource map*
>  *[2012-01-17 10:32:33,411:debug] KnowledgeAgent no resource mapped for
> rule=[Rule name=Dummy rule, agendaGroup=MAIN, salience=0, no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=Dummy rule, agendaGroup=MAIN, salience=0,
> no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=Underage, agendaGroup=MAIN, salience=10,
> no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=Bankruptcy history, agendaGroup=MAIN,
> salience=10, no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=No bad credit checks, agendaGroup=MAIN,
> salience=10, no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=no NINJAs, agendaGroup=MAIN, salience=10,
> no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=Row 3 Pricing loans, agendaGroup=MAIN,
> salience=0, no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=Row 1 Pricing loans, agendaGroup=MAIN,
> salience=0, no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resource=[UrlResource path='
> http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
> to KnowledgeDefinition=[Rule name=Row 2 Pricing loans, agendaGroup=MAIN,
> salience=0, no-loop=false]*
> *[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
> resour

Re: [rules-users] Problem with Negative Patterns and Temporal Constraints

2012-01-17 Thread Mark Proctor

On 17/01/2012 08:27, Weiss, Wolfgang wrote:


Thank you for the quick answer! This makes absolutely sense and the 
rules work now as expected.


Unfortunately, I was not able to find this somewhere in the 
documentation. It would be nice to see it in the documentation of 
drools fusion.



Documentation is something anyone can do with a spare 10 minutes:
1) install git
2) install xmlmind
3) "fork" drools on github, https://github.com/droolsjbpm/drools
4) clone your fork locally
5) make changes to files with xmlmind, or xml editor of choice
https://github.com/droolsjbpm/drools/tree/master/drools-docs/drools-fusion-docs/src/main/docbook/en-US
6) commit changes, push changes back to github
7) use github gui to submit a pull request for your changes.

It'll be more obvious to users what documentation is missing, and 
they'll be able to word it better in a way that makes more sense to 
other users.


Mark


Best,

Wolfgang

*Von:*rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] *Im Auftrag von *Wolfgang 
Laun

*Gesendet:* Montag, 16. Jänner 2012 15:58
*An:* Rules Users List
*Betreff:* Re: [rules-users] Problem with Negative Patterns and 
Temporal Constraints


I don't see that the "not" CE excludes the AnalysisCue bound to $cue 
from being

matched by the pattern inside the "not". I recommend using

*   not*(AnalysisCue(*this != $cue*, this after[0ms,2500ms] $cue) from

since "[0ms,..." does not inhibit the same event being matched by both 
patterns,

which precludes the rule from firing.

-W

2012/1/16 Weiss, Wolfgang >


Hi all!

We have the problem that the following rule never fires:

*rule*"test-rule"

*agenda-group* "evaluation"

*salience* 100

*when*

 $cue : AnalysisCue() *from* entry-point "LowLevelCueStream"

*not*(AnalysisCue(*this* after[0ms,2500ms] $cue) *from* entry-point 
"LowLevelCueStream")


*then*

 logger.debug("... some message ..");

*end*

We found out that the problem is the combination of the negation with 
the conditional element "not" and the temporal constraint 
"[0ms,2500ms]". Using the temporal operator "this after $cue" without 
a temporal constraint works correct in its semantics.


Interestingly, when adding a constraint (cueType == 1) to the type in 
the negative pattern the rule begins to work. The rule would look like 
as follows:


*rule*"test-rule"

*agenda-group* "evaluation"

*salience* 100

*when*

 $cue : AnalysisCue() *from* entry-point "LowLevelCueStream"

*not*(AnalysisCue(cueType == 1, *this* after[0ms,2500ms] $cue) *from* 
entry-point "LowLevelCueStream")


*then*

 logger.debug("... some message ..");

*end*

unfortunately the rule then fires with a delay of 4 to 5 seconds. The 
second parameter of the temporal constraint influences the delay.


When changing the first parameter of the temporal constraint to a 
value greater than 0 the rule works as expected! The constraint would 
then look like as follows: "[1ms, 2500ms]". Whereas in our case, we 
want to evaluate the time window from 0 -- 2500ms.


Our system works in the stream mode and we could reproduce this 
behaviour with the versions 5.3.1 and 5.4.0 Beta 1.


Can anybody confirm if this is a bug in Drools, or did I overlook here 
something?


Best regards,

Wolfgang Weiss


___
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] Problem with Negative Patterns and Temporal Constraints

2012-01-17 Thread Wolfgang Laun
This is just following the basic principles of matching facts to patterns, e.g.
   $p1: Person( $age: age )
   $p2: Person( age >= $age )
binds (apart from many other results) each Person fact to both patterns.

The temporal operators are merely shortcuts for complex relations; do
not expect anything beyond that.

-W

On 17/01/2012, Weiss, Wolfgang  wrote:
> Thank you for the quick answer! This makes absolutely sense and the rules
> work now as expected.
> Unfortunately, I was not able to find this somewhere in the documentation.
> It would be nice to see it in the documentation of drools fusion.
>
> Best,
> Wolfgang
>
>
> Von: rules-users-boun...@lists.jboss.org
> [mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun
> Gesendet: Montag, 16. Jänner 2012 15:58
> An: Rules Users List
> Betreff: Re: [rules-users] Problem with Negative Patterns and Temporal
> Constraints
>
> I don't see that the "not" CE excludes the AnalysisCue bound to $cue from
> being
> matched by the pattern inside the "not". I recommend using
>
>not(AnalysisCue(this != $cue, this after[0ms,2500ms] $cue) from
>
> since "[0ms,..." does not inhibit the same event being matched by both
> patterns,
> which precludes the rule from firing.
>
> -W
>
> 2012/1/16 Weiss, Wolfgang
> mailto:wolfgang.we...@joanneum.at>>
> Hi all!
>
> We have the problem that the following rule never fires:
>
> rule "test-rule"
>agenda-group "evaluation"
>salience 100
>
>when
>  $cue : AnalysisCue() from entry-point "LowLevelCueStream"
>  not(AnalysisCue(this after[0ms,2500ms] $cue) from entry-point
> "LowLevelCueStream")
>then
>  logger.debug("... some message ..");
> end
>
> We found out that the problem is the combination of the negation with the
> conditional element "not" and the temporal constraint "[0ms,2500ms]". Using
> the temporal operator "this after $cue" without a temporal constraint works
> correct in its semantics.
> Interestingly, when adding a constraint (cueType == 1) to the type in the
> negative pattern the rule begins to work. The rule would look like as
> follows:
>
> rule "test-rule"
>agenda-group "evaluation"
>salience 100
>
>when
>  $cue : AnalysisCue() from entry-point "LowLevelCueStream"
>  not(AnalysisCue(cueType == 1, this after[0ms,2500ms] $cue) from
> entry-point "LowLevelCueStream")
>then
>  logger.debug("... some message ..");
> end
>
> unfortunately the rule then fires with a delay of 4 to 5 seconds. The second
> parameter of the temporal constraint influences the delay.
> When changing the first parameter of the temporal constraint to a value
> greater than 0 the rule works as expected! The constraint would then look
> like as follows: "[1ms, 2500ms]". Whereas in our case, we want to evaluate
> the time window from 0 - 2500ms.
>
> Our system works in the stream mode and we could reproduce this behaviour
> with the versions 5.3.1 and 5.4.0 Beta 1.
> Can anybody confirm if this is a bug in Drools, or did I overlook here
> something?
>
>
> Best regards,
> Wolfgang Weiss
>
>
> ___
> 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] Large number of rules in Drools

2012-01-17 Thread Michael Anstis
This is the JIRA to improve scalability:
https://issues.jboss.org/browse/GUVNOR-1635

Otherwise I would still recommend splitting your monolithic DRL file into
smaller ones and upload each individually.

Increasing your web-server time-out is also an option.

2012/1/16 Shweta1986 

> Can someone please look into this. Would really appreciate some help with
> these questions.
>
> 2012/1/11 Shweta Turakhia <[hidden 
> email]
> >
>
>> Thanks for your replies. Please see my response inline
>> My intention to use guvnor was to let non technical person go and change
>> the rules. But due to the size of the file and drl format it is difficult
>> for them to first search the rule and then edit it, save it and build it.
>>
>> Also since now my rules are in drl format there is no easy way to convert
>> them to excel format. Since that will make the file smaller with just 20K
>> rows which can be easily uploaded.
>> Please suggest.
>>
>>
>> "Thousands" of lines of DRL in a single file represent an issue not just
>> to Guvnor but to anything handling it.
>> >>  Agreed. But if you provide a way to upload drl file as it is it
>> would not be that bad right?
>>
>> The recommendation would be to split the DRL into individual rules,
>> resulting of thousands of assets in Guvnor.
>> >> This takes more than 20 minutes and times out.
>>
>>
>> The next question would be if you have "thousands" of similar rules why
>> not use a singe Template or Decision Table?
>> Having said that, using a Template or Decision table in Guvnor with
>> "thousands" of rows could exhibit a problem at present.
>> Both of the editors in Guvnor do not scale well past a few thousand. This
>> is a known issue and we have an open item to address given time.
>> >> Can you please point me to the jira item for this ? I would like to
>> look into it.
>>
>> Using an Excel based decision table loaded into Guvnor would be workable,
>> however the compilation time to build a binary package may be an issue (I
>> don't know).
>> >> For me 20K rules got saved once but they never got built. I always get
>> "Network error" It times out since the browser is idle for more time.
>>
>>
>> 1) Guvnor needs more that 2.5GB Ram => Go to 64 bits java (we have 5GB
>> heap)
>> 2) Building the binary on guvnor on a virtual environment takes a few
>> minutes (4 minutes in our case)
>> >> For me build fails as mentioned earlier. It says "Network" error" I
>> never got this error when my rules were 100. With number of rules
>> increasing I think it takes more time to build and on the UI it times out.
>>
>> 3) For the runtime, the rulebase to build is less then 1 minute when
>> getting the rulebase from guvnor
>> 4) We are using decision tables updated from remote, so to view them the
>> only way is to download via rest the decision table xml et edit it.
>> >> Is there any documentation available as how to do this ?
>>
>> 5) Performance are excellent, for one session execution, it takes 250 ms
>> to apply 300 rules again in a virtual environement.
>> >> I agree for me it is less than 100 ms for each request. But since I am
>> using the Resource Change Scanner whenever my rules change the response
>> time increases to 40 seconds for 15 minutes and comes back to normal after
>> that. I also had to increase the heap size for my application to 3GB
>> otherwise it was having memory issues due to the number of rules in memory.
>>
>>
>> 2012/1/11 Nicolas Héron [via Drools] <[hidden 
>> email]
>> >
>>
>> Hello,
>>> I just worked on a drools project with many thousands rules (100k). The
>>> project is now in production.
>>> the issues are :
>>> 1) Guvnor needs more that 2.5GB Ram => Go to 64 bits java (we have 5GB
>>> heap)
>>> 2) Building the binary on guvnor on a virtual environment takes a few
>>> minutes (4 minutes in our case)
>>> 3) For the runtime, the rulebase to build is less then 1 minute when
>>> getting the rulebase from guvnor
>>> 4) We are using decision tables updated from remote, so to view them the
>>> only way is to download via rest the decision table xml et edit it.
>>> 5) Performance are excellent, for one session execution, it takes 250 ms
>>> to apply 300 rules again in a virtual environement.
>>> I would like to know which JIRA is related to the issues in guvnor when
>>> there are many lines ?
>>> Regards
>>> Nicolas Héron
>>>
>>> 2012/1/11 Michael Anstis <[hidden 
>>> email]
>>> >
>>>
>>> "Thousands" of lines of DRL in a single file represent an issue not just
 to Guvnor but to anything handling it.

 The recommendation would be to split the DRL into individual rules,
 resulting of thousands of assets in Guvnor.

 The next question would be if you have "thousands" of similar rules why
 not use a singe Template or Decision Table?

 Having said that, using a Template or Deci

Re: [rules-users] How to run the " rule test scenarios " from the Eclipse.

2012-01-17 Thread Toni Rikkola
Sorry, but this is not possible at the moment. There has been a Jira for this 
for a while.

Toni

On Jan 17, 2012, at 7:48 AM, srinivasasanda wrote:

> Hi All,
> 
> i created a simple Fact (person) and rule (like age < 20)  in Guvnor .
> and i created a simple "rule test scenarios" , when i submit "Run Scenario"
> button  in "rule test scenarios" it is
> showing result 100% . So i have thousands of rules & for each rule i have a
> "rule test case" . So i want to run the test scenarios from outside of the
> Guvnor (like eclipse)to execute all at once..
> 
> Can anybody help me..
> 
> Thanks in Advance..
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/How-to-run-the-rule-test-scenarios-from-the-Eclipse-tp3665269p3665269.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] Using Drools Planner for dynamic service composition

2012-01-17 Thread ge0ffrey

johan.kumps wrote
> 
> Hi,
> 
> Could you point me to a document providing some more information on this.
> Using the Drools Planner documentation alone I'm not able to find a design
> for my problem.
> 
> Kind regards,
> 

This problem, "the most optimal service composition achieving a certain
consumer goal" probably falls into the category of problems called "assembly
line optimization". An example of assembly line optimization is in a
furniture factory: manufacture a number of chairs and tables and order the
usage of the machines (sequentially and in parallel) as optimal as possible.

There is no public canonical example of "assembly line optimization" yet,
but Drools Planner has been successfully used for it already, for example by
ualtin (irc). The trick is to create/remove machine assignments in Move's
(something the other examples don't do). You can reuse the local search
algorithms, such as Tabu Search, but the construction heuristics might be a
problem, in which case you 'll need to write a custom SolutionInitializer
like in some examples (until the construction heuristics become more
flexible).

--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-Drools-Planner-for-dynamic-service-composition-tp3660729p3665514.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] Code Coverage

2012-01-17 Thread Toni Rikkola
You need to write the coverage tests for JUnit yourself. Test Scenarios in 
Guvnor do this, but you can't use them outside Guvnor. 

Test Scenarios get all the rule names for the rules in one package and then 
compares that list to the rules that fired.
Edson's blog entry might help you 
http://blog.athico.com/2011/10/cookbook-how-to-test-rules-using-xunit.html.

Toni

On Jan 16, 2012, at 5:49 PM, mike wrote:

> Hi there,
> 
> I was wondering if its possible to measure code coverage on test running 
> against a set of rules.
> 
> Thank you
> Mike
>  
> ___
> 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] Resource Change Scanner Service modified date error

2012-01-17 Thread Dean Eastwood
Hi Esteban

Unfortunately I haven't had time to work further on this issue, so I don't
have an answer yet.

All I can say for now is it seems that the ReaderResources are being
created along with the URLResource each time. This is evidenced by the
details below.

In my test, I have the following changeset based on the mortgages sample (I
have changed my hosting port):

--

**
**
* *
**
**

--


This changeset can be read as a UrlResource, ClassPathResource or
ByteArrayResource. I then use the following code to initialise the
KnowledgeAgent:

--


*SystemEventListenerFactory.setSystemEventListener(new
PrintStreamSystemEventListener(System.out));*
**
*KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("MortgageAgent");*
*Resource changeset = ResourceFactory.newClassPathResource("ChangeSet.xml");
*
*kagent.applyChangeSet(changeset);*

--


Within the System event listener output, I see that the KnowledgeAgent
picks up all of the KnowledgeDefinitions from Drools and creates them as
new UrlResources. Next, it picks up the KnowledgeDefinitions from drools
and creates these all as null ReaderResources. Here is some output from my
System event listener:

--


*[2012-01-17 10:32:32,577:debug] KnowledgeAgent rebuilding KnowledgeBase
using ChangeSet*
*[2012-01-17 10:32:33,410:debug] KnowledgeAgent building resource map*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent no resource mapped for
rule=[Rule name=Dummy rule, agendaGroup=MAIN, salience=0, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=Dummy rule, agendaGroup=MAIN, salience=0,
no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=Underage, agendaGroup=MAIN, salience=10,
no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=Bankruptcy history, agendaGroup=MAIN,
salience=10, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=No bad credit checks, agendaGroup=MAIN,
salience=10, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=no NINJAs, agendaGroup=MAIN, salience=10,
no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=Row 3 Pricing loans, agendaGroup=MAIN,
salience=0, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=Row 1 Pricing loans, agendaGroup=MAIN,
salience=0, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=Row 2 Pricing loans, agendaGroup=MAIN,
salience=0, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=CreditApproval, agendaGroup=MAIN,
salience=0, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=DateDslRule, agendaGroup=MAIN,
salience=0, no-loop=false]*
*[2012-01-17 10:32:33,411:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.Guvnor/package/mortgages/LATEST']
to KnowledgeDefinition=[Rule name=CheckBoxDslRule, agendaGroup=MAIN,
salience=0, no-loop=false]*
*[2012-01-17 10:32:33,412:debug] KnowledgeAgent mapping
resource=[UrlResource path='
http://localhost:8090/guvnor/org.drools.guvnor.

Re: [rules-users] Application Guvnor integration

2012-01-17 Thread Senthil K
Oh,The bug is still open..Is there any other way to scan the changes that are
being happened in Guvnor console through ChangeSet and Java code.Is there
any other classes like ResourceChangeScanner or any other way to scan
changes in ChangeSet..

Is it possible??

Please let me know

Thanks

--
View this message in context: 
http://drools.46999.n3.nabble.com/Application-Guvnor-integration-tp3655924p3665489.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] creating bpmn process in drools-guvnor

2012-01-17 Thread yoganand
how to create bpmn process having one human task using web designer (I am
using jbpm 5.1 version).

Thanks
yoag.


--
View this message in context: 
http://drools.46999.n3.nabble.com/creating-bpmn-process-in-drools-guvnor-tp3665480p3665480.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] Problem with Negative Patterns and Temporal Constraints

2012-01-17 Thread Weiss, Wolfgang
Thank you for the quick answer! This makes absolutely sense and the rules work 
now as expected.
Unfortunately, I was not able to find this somewhere in the documentation. It 
would be nice to see it in the documentation of drools fusion.

Best,
Wolfgang


Von: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] Im Auftrag von Wolfgang Laun
Gesendet: Montag, 16. Jänner 2012 15:58
An: Rules Users List
Betreff: Re: [rules-users] Problem with Negative Patterns and Temporal 
Constraints

I don't see that the "not" CE excludes the AnalysisCue bound to $cue from being
matched by the pattern inside the "not". I recommend using

   not(AnalysisCue(this != $cue, this after[0ms,2500ms] $cue) from

since "[0ms,..." does not inhibit the same event being matched by both patterns,
which precludes the rule from firing.

-W

2012/1/16 Weiss, Wolfgang 
mailto:wolfgang.we...@joanneum.at>>
Hi all!

We have the problem that the following rule never fires:

rule "test-rule"
   agenda-group "evaluation"
   salience 100

   when
 $cue : AnalysisCue() from entry-point "LowLevelCueStream"
 not(AnalysisCue(this after[0ms,2500ms] $cue) from entry-point 
"LowLevelCueStream")
   then
 logger.debug("... some message ..");
end

We found out that the problem is the combination of the negation with the 
conditional element "not" and the temporal constraint "[0ms,2500ms]". Using the 
temporal operator "this after $cue" without a temporal constraint works correct 
in its semantics.
Interestingly, when adding a constraint (cueType == 1) to the type in the 
negative pattern the rule begins to work. The rule would look like as follows:

rule "test-rule"
   agenda-group "evaluation"
   salience 100

   when
 $cue : AnalysisCue() from entry-point "LowLevelCueStream"
 not(AnalysisCue(cueType == 1, this after[0ms,2500ms] $cue) from 
entry-point "LowLevelCueStream")
   then
 logger.debug("... some message ..");
end

unfortunately the rule then fires with a delay of 4 to 5 seconds. The second 
parameter of the temporal constraint influences the delay.
When changing the first parameter of the temporal constraint to a value greater 
than 0 the rule works as expected! The constraint would then look like as 
follows: "[1ms, 2500ms]". Whereas in our case, we want to evaluate the time 
window from 0 - 2500ms.

Our system works in the stream mode and we could reproduce this behaviour with 
the versions 5.3.1 and 5.4.0 Beta 1.
Can anybody confirm if this is a bug in Drools, or did I overlook here 
something?


Best regards,
Wolfgang Weiss


___
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] Application Guvnor integration

2012-01-17 Thread Esteban Aliverti
Unfortunately, this is a known issue that remains open:
https://bugzilla.redhat.com/show_bug.cgi?id=733008
What I don't understand is why Drools is trying to use a
ReaderResource instead of a URLResource. Let me check into the source code
to see what I find.

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2012/1/17 Michael Anstis 

> Yay, at long last a Java Stack Trace :)
>
> This is a known problem, but one I believe has been fixed for 5.4.0.beta1
> - correct me if I am wrong esteban.
>
> sent on the move
>
> On 17 Jan 2012 07:22, "Senthil K"  wrote:
>
>> Thank you Manstis..I'm able to retrieve the packages and rulenames through
>> ChangeSet.I verified that example(Mortgages).But,When I delete a rule in
>> guvnor,the change is not getting reflecting in my Java code..I think the
>> ResourceScanner is unable to start the service.Here is the following
>> exception I'm getting when i add the below lines
>> ResourceChangeScannerConfiguration sconf=
>>
>>
>> ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
>>
>> sconf.setProperty("drools.resource.scanner.interval", "30");
>>
>> ResourceFactory.getResourceChangeScannerService().configure(sconf);
>>
>>
>> ResourceFactory.getResourceChangeNotifierService().start();
>>
>> ResourceFactory.getResourceChangeScannerService().start();
>> *This is exception I'm getting*
>> Exception in thread "Thread-3" java.lang.IllegalStateException: reader
>> does
>> have a modified date
>>at
>> org.drools.io.impl.ReaderResource.getLastModified(ReaderResource.java:64)
>>at
>>
>> org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScannerImpl.java:166)
>>at
>>
>> org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(ResourceChangeScannerImpl.java:311)
>>at java.lang.Thread.run(Thread.java:662)
>> After starting Notification service
>> After rule engine start
>> no of packages1
>> This is : pricing Packages and  RuleName is ageprice
>> This is : pricing Packages and  RuleName is incomeprice
>> This is : pricing Packages and  RuleName is cpvprice
>>
>>
>> How to scan changes in that ChangeSet.Did my Java code went wrong??Can you
>> please help me out this..Please
>> Thanks
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Application-Guvnor-integration-tp3655924p3665380.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] Resource Change Scanner Service modified date error

2012-01-17 Thread Esteban Aliverti
Dean, did you figure out why your code is using a ReaderResource? There are
other threads reporting this same problem.

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Fri, Jan 6, 2012 at 2:14 PM, Jiri Svitak  wrote:

> Hello Dean,
>
> you are right,
> https://issues.jboss.org/browse/GUVNOR-1699
> solves something different. Bugzilla
> https://bugzilla.redhat.com/show_bug.cgi?id=733008
> still waits to be solved. I have updated this bugzilla to be linked to
> belonging JIRA issues.
> You can look also on other bugs which have the same root cause. But I am
> not developer, so I cannot
> tell you when it'll be fixed.
>
> Jiri Svitak
>
> On 01/05/2012 02:27 PM, Dean wrote:
> > Hi
> >
> > I am experiencing a problem with starting the
> ResourceChangeScannerService
> > as described here: https://bugzilla.redhat.com/show_bug.cgi?id=733008
> >
> > I can create a KnowledgeAgent instance and apply a changeset to it which
> > loads the desired package from Guvnor. However, as soon as I attempt to
> > start the ScannerService in order to be notified of changes to this
> package
> > I immediately receive the exception: java.lang.IllegalStateException:
> reader
> > does have a modified date. Then on every scanner interval following, the
> > scanner fails each time with the same error message.
> >
> > Apparently, this issue has already been fixed here:
> > https://issues.jboss.org/browse/GUVNOR-1699
> >
> > However, I am still experiencing this problem even with Drools
> 5.4.0.Beta1
> >
> > Could somebody perhaps help me with this. I am attempting to rebuild the
> > source code on my side, however, I am having endless problems with Maven.
> >
> > Regards
> >
> > Dean
> >
> > --
> > View this message in context:
> http://drools.46999.n3.nabble.com/Resource-Change-Scanner-Service-modified-date-error-tp3634802p3634802.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