Re: [rules-users] FW: Rule runs twice without explicit call to update($fact).

2009-11-25 Thread Wolfgang Laun
"Just the place for a Snark! I have said it twice:
That alone should encourage the crew.
Just the place for a Snark! I have said it thrice:
What i tell you three times is true."
[...]
He had forty-two boxes, all carefully packed,
With his name painted clearly on each:
But, since he omitted to mention the fact, (!)
They were all left behind on the beach.

I'm not sure whether Lewis Carroll had Drools in mind when he wrote these lines,
but the allusions are there. ;-)

That said, I'll now turn to your code which indeed achieves to
"tell it thrice": once by calling the setter in a modify, twice by
calling update,
and the third time by using the PropertyChangeSupport. Small wonder that
the engine is a little confused. Simply use just one of the three, and all will
be fine.

You should certainly do it once, or else the fact will be left changed but
forgotten on the beach...

-W


2009/11/25 Jason Smith :
> I never got an answer, any answer to this question.  I really need to know
> if PropertyChangeSupport actually works.  Is anyone out there successfully
> using it?
>
> In one case (using "modify()") I get a NPE.  In all cases, the rules run
> twice unless I explicitly call "update()".  Is anyone *not* seeing this
> behaviour?  Is anyone successfully using the PropertyChangeSupport mechanism
> without explicit calls to "update()"???
>
>
> Jason Smith
>
> 
> From: Jason Smith
> Sent: Monday, November 23, 2009 12:36 PM
> To: rules-users@lists.jboss.org
> Subject: Rule runs twice without explicit call to update($fact).
>
> My colleague has confirmed that this behavior has been around since Drools
> 4, and it continues to be a problem for Drools 5.0.1 and 5.1.0.M1, assuming
> it's a problem and not working as intended.
>
> $fact.setPath("...") implements the correct PropertyChangeSupport mechanism
> for Drools.  At least Drools is using it and responding mostly as expected.
>
> This runs once:
>
> rule
>
> "Constrain to owner or published to public"
>
> when
>
> $fact : ListFact(
>
> $path : path
>
> not matches ".*owner.*",
>
> noopResponse ==
>
> true
>
> )
>
> $model : Model()
>
> then
>
> modify($fact)
>
> {
>
> setPath($fact.getPath() +
>
> "[owner]")
>
> }
>
> update($fact);
>
> end
>
>
> This runs twice:
>
> rule
>
> "Constrain to owner or published to public"
>
> when
>
> $fact : ListFact(
>
> $path : path
>
> not matches ".*owner.*",
>
> noopResponse ==
>
> true
>
> )
>
> $model : Model()
>
> then
>
> modify($fact)
>
> {
>
> setPath($fact.getPath() + "[owner]")
>
> }
>
> end
>
>
> If I don't use modify(...) and simply change the $fact bean path property,
> the same thing occurs.  If I explicitly call update($fact), the rule runs
> once.  If I don't it runs twice.
>
> I get "/path[owner][owner]" when I actually wanted "/path[owner]", because
> it ran twice, not once.
>
> Why doe update(...) work differently from the PropertyChangeSupport
> mechanism???  Shouldn't I be able to depend on Drools to run this rule only
> one time?
>
> I am, admittedly, a bit of a noob at this, but I ran this by my local Drools
> resident expert, and he doesn't know the answer either.
>
> Thanks so much!
>
>
> Jason Smith
> Software Engineer
> InfoTrust Group, Inc.
>
> 500 Discovery Parkway, Suite 200
> Superior, CO 80027
> Office 303-627-6571
> Fax 303-666-6711
> Email jsm...@infotrustgroup.com
>
> WEB www.infotrustgroup.com
>
> This e-mail and all information included herein do not constitute a legal
> agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.
> All legal agreements must be formulated in writing by a legal representative
> of INFOTRUST GROUP. This email and any files transmitted with it are
> confidential and intended solely for the use of the individual or entity to
> whom they are addressed.  If you have received this e-mail by mistake,
> please inform us and destroy this e-mail and any documents it might
> contain.  Please note that any views or opinions presented in this email are
> solely those of the author and do not necessarily represent those of the
> company. Finally, the recipient should check this email and any attachments
> for the presence of viruses. The company accepts no liability for any damage
> caused by any virus transmitted by this email.  Thank you for your
> cooperation.
>
> ___
> 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 on Rule Flow and Web Console

2009-11-25 Thread ramram8

Thnx for ur advice Kris 
Yes I think I will use either an XOR or a Rule List But I have a question
about this because i was trying them yesterday:

1- Do I have to use either the rule or XOR or I have to use then both
together?
2- How I can pass a parameter to a rule or an XOR ?
3- can u give me an example on an XOR or Rule?

Thnx again for the help Kris
-- 
View this message in context: 
http://old.nabble.com/Question-on-Rule-Flow-and-Web-Console-tp26508838p26525235.html
Sent from the drools - user mailing list archive at Nabble.com.

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


[rules-users] 5.10M samples

2009-11-25 Thread Chris Richmond
I loaded the latest (5.1M) sample for fusion into eclipse and it builds and
runs, but does anyone else get this exception from time to time?

 

Thanks,

Chris

 

=

Unexpected exception caught: [Error: cannot invoke getter: getSymbol
[declr.class: org.drools.examples.broker.model.SuddenDropEvent; act.class:
null]]

[Near : {... Unknown }]

 ^

[Line: 1, Column: 0]

org.drools.runtime.rule.ConsequenceException: [Error: cannot invoke getter:
getSymbol [declr.class: org.drools.examples.broker.model.SuddenDropEvent;
act.class: null]]

[Near : {... Unknown }]

 ^

[Line: 1, Column: 0]

  at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleExcept
ion(DefaultConsequenceExceptionHandler.java:23)

  at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:980)

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


Re: [rules-users] GUI help

2009-11-25 Thread SzA84

I think not, because orvosimeres is the class in the package:

public class orvosimeres {
}




Nicolas Héron wrote:
> 
> I thing it is because you use twice the same variable ovosimeres
> your rule should be
> Rule "grafikus"
>dialect "mvel"
>when
>orvosimeres:Adattipus( ertek == "/heart_rate" )
>orvosimeres2:Mertadat( mertekegyseg == "/min" , mozgas ==
> "true" , vernyomas > ( 140 ) , vernyomas < ( 180 ) )
>then
> end
> 
> 2009/11/25 SzA84 
> 
>>
>> Hi!
>>
>> I have some questions about the guided editor.
>>
>> I try to build a rule in the guided editor. I added some conditions and
>> this
>> is the generated DRL:
>>
>> Rule "grafikus"
>>dialect "mvel"
>>when
>>orvosimeres$Adattipus( ertek == "/heart_rate" )
>>orvosimeres$Mertadat( mertekegyseg == "/min" , mozgas ==
>> "true" ,
>> vernyomas > ( 140 ) , vernyomas < ( 180 ) )
>>then
>> end
>>
>> My imports in the rule.package file are the following:
>> package orvosi;
>> import orvosi.orvosimeres.Adattipus;
>> import orvosi.orvosimeres.Mertadat;
>>
>> And I have this error message: unknown:4:2 Unexpected token 'orvosimeres'
>> .
>>
>> So that is my first question. What can cause the problem?
>> And my other question is, how can I execute a rule, that was made in the
>> guided editor?
>>
>> Thanks in advance for the reply!
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/GUI-help-tp26518461p26518461.html
>> Sent from the drools - user mailing list archive at Nabble.com.
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/GUI-help-tp26518461p26521545.html
Sent from the drools - user mailing list archive at Nabble.com.


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


Re: [rules-users] unable to resolve Type Declaration class

2009-11-25 Thread Edson Tirelli
   Nope, this sounds like a bug... can you open a JIRA with that info
please?

   Edson

2009/11/25 richarda 

>
> Also tried under 5.1.0M1 release.. same issue :(
> Am i doing something wrong by declaring the @role in the Configuration
> section?
>
>
> richarda wrote:
> >
> > Still trying to get this to work.
> > I have managed to create from a default (new) guvnor setup.
> >
> > Steps I do..
> > 1. Create fresh guvnor
> > 2. In eclipse create  Message.java file in package com.sample, and create
> > a jar file
> > 3. In guvnor import the model for the Message.jar file
> > 4. In guvnor create a category
> > 5. Create an import statement for  import com.sample.Message
> > 6. Create a simple technical rule,  something like   when, Message(),
> > then, System.out.println(".");
> > 7. Build the pkg
> > 8. download the pkg
> >
> > use the code from previous post to load the pkg...
> > it works fine..
> >
> > now, goto guvnor advanced view and change the Configuration from:
> > import com.sample.Message
> >
> > to:
> >
> > import com.sample.Message;
> >
> > declare Message
> >   @role( event )
> > end
> >
> >
> > build the pkg,
> > download the pkg,
> > run the test program...
> >
> > I get:
> > org.drools.RuntimeDroolsException: unable to resolve Type Declaration
> > class 'Message'
> >   at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
> >   at
> >
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
> >   at
> >
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
> >   at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
> >   at com.sample.DroolsTest.main(DroolsTest.java:27)
> >
> >
> > richarda wrote:
> >>
> >> So, my code is doing this:
> >>
> >>  KnowledgeBaseConfiguration conf =
> >> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> >> conf.setOption(EventProcessingOption.STREAM);
> >> KnowledgeBuilder builder =
> >> KnowledgeBuilderFactory.newKnowledgeBuilder();
> >> try {
> >> File f = new File("/tmp/my.pkg");
> >> InputStream stream = new FileInputStream(f);
> >> if (stream == null) {
> >> jlog.fatal("Unable to find rule pkg");
> >> } else {
> >> jlog.info("adding pkg");
> >>
> >> builder.add(ResourceFactory.newInputStreamResource(stream),
> >> ResourceType.PKG);
> >> }
> >> } catch (Exception e) {
> >> e.printStackTrace();
> >> }
> >> KnowledgeBase kbase =
> >> KnowledgeBaseFactory.newKnowledgeBase(conf);
> >> kbase.addKnowledgePackages(builder.getKnowledgePackages());
> >> jlog.info("setup creating knowledge session");
> >> ksession = kbase.newStatefulKnowledgeSession();
> >> jlog.info(" setup ksession created");
> >>
> >>
> >> The pkg was created from Guvnor.
> >>
> >> If in the package declaration area in Guvnor,  (where you put the import
> >> statements)
> >> If I put
> >> declare Signature
> >>  @role ( event )
> >> end
> >>
> >> then build the package, save it to disk /tmp/my.pkg
> >> on startup I get:
> >>
> >>
> [#|2009-11-24T14:50:38.944+|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
> >> unable to resolve Type Declaration class 'Signature'
> >>  at
> >> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
> >>  at
> >>
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
> >>  at
> >>
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
> >>
> >>
> >> I need to declare 'Signature' as an 'event'
> >> Am I doing this wrong?
> >>
> >> If I do this all in Eclipse and load the DRL files manually it all
> works.
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26519888.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



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


Re: [rules-users] GUI help

2009-11-25 Thread Nicolas Héron
I thing it is because you use twice the same variable ovosimeres
your rule should be
Rule "grafikus"
   dialect "mvel"
   when
   orvosimeres:Adattipus( ertek == "/heart_rate" )
   orvosimeres2:Mertadat( mertekegyseg == "/min" , mozgas ==
"true" , vernyomas > ( 140 ) , vernyomas < ( 180 ) )
   then
end

2009/11/25 SzA84 

>
> Hi!
>
> I have some questions about the guided editor.
>
> I try to build a rule in the guided editor. I added some conditions and
> this
> is the generated DRL:
>
> Rule "grafikus"
>dialect "mvel"
>when
>orvosimeres$Adattipus( ertek == "/heart_rate" )
>orvosimeres$Mertadat( mertekegyseg == "/min" , mozgas ==
> "true" ,
> vernyomas > ( 140 ) , vernyomas < ( 180 ) )
>then
> end
>
> My imports in the rule.package file are the following:
> package orvosi;
> import orvosi.orvosimeres.Adattipus;
> import orvosi.orvosimeres.Mertadat;
>
> And I have this error message: unknown:4:2 Unexpected token 'orvosimeres'
> .
>
> So that is my first question. What can cause the problem?
> And my other question is, how can I execute a rule, that was made in the
> guided editor?
>
> Thanks in advance for the reply!
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/GUI-help-tp26518461p26518461.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] unable to resolve Type Declaration class

2009-11-25 Thread richarda

Also tried under 5.1.0M1 release.. same issue :(
Am i doing something wrong by declaring the @role in the Configuration
section?


richarda wrote:
> 
> Still trying to get this to work.
> I have managed to create from a default (new) guvnor setup.
> 
> Steps I do..
> 1. Create fresh guvnor
> 2. In eclipse create  Message.java file in package com.sample, and create
> a jar file
> 3. In guvnor import the model for the Message.jar file
> 4. In guvnor create a category
> 5. Create an import statement for  import com.sample.Message
> 6. Create a simple technical rule,  something like   when, Message(),
> then, System.out.println(".");
> 7. Build the pkg
> 8. download the pkg
> 
> use the code from previous post to load the pkg...
> it works fine..
> 
> now, goto guvnor advanced view and change the Configuration from:
> import com.sample.Message
> 
> to:
> 
> import com.sample.Message;
> 
> declare Message
>   @role( event )
> end
> 
> 
> build the pkg,
> download the pkg,
> run the test program...
> 
> I get:
> org.drools.RuntimeDroolsException: unable to resolve Type Declaration
> class 'Message'
>   at 
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>   at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>   at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>   at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
>   at com.sample.DroolsTest.main(DroolsTest.java:27)
> 
> 
> richarda wrote:
>> 
>> So, my code is doing this:
>>  
>>  KnowledgeBaseConfiguration conf =
>> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>> conf.setOption(EventProcessingOption.STREAM);
>> KnowledgeBuilder builder =
>> KnowledgeBuilderFactory.newKnowledgeBuilder();
>> try {
>> File f = new File("/tmp/my.pkg");
>> InputStream stream = new FileInputStream(f);
>> if (stream == null) {
>> jlog.fatal("Unable to find rule pkg");
>> } else {
>> jlog.info("adding pkg");
>>
>> builder.add(ResourceFactory.newInputStreamResource(stream),
>> ResourceType.PKG);
>> }
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> KnowledgeBase kbase =
>> KnowledgeBaseFactory.newKnowledgeBase(conf);
>> kbase.addKnowledgePackages(builder.getKnowledgePackages());
>> jlog.info("setup creating knowledge session");
>> ksession = kbase.newStatefulKnowledgeSession();
>> jlog.info(" setup ksession created");
>> 
>> 
>> The pkg was created from Guvnor.
>> 
>> If in the package declaration area in Guvnor,  (where you put the import
>> statements)
>> If I put
>> declare Signature
>>  @role ( event )
>> end
>> 
>> then build the package, save it to disk /tmp/my.pkg
>> on startup I get:
>> 
>> [#|2009-11-24T14:50:38.944+|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
>> unable to resolve Type Declaration class 'Signature'
>>  at
>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>>  at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>>  at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>> 
>> 
>> I need to declare 'Signature' as an 'event'
>> Am I doing this wrong?
>> 
>> If I do this all in Eclipse and load the DRL files manually it all works.
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26519888.html
Sent from the drools - user mailing list archive at Nabble.com.

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


[rules-users] FW: Rule runs twice without explicit call to update($fact).

2009-11-25 Thread Jason Smith
I never got an answer, any answer to this question.  I really need to know if 
PropertyChangeSupport actually works.  Is anyone out there successfully using 
it?

In one case (using "modify()") I get a NPE.  In all cases, the rules run twice 
unless I explicitly call "update()".  Is anyone *not* seeing this behaviour?  
Is anyone successfully using the PropertyChangeSupport mechanism without 
explicit calls to "update()"???

Jason Smith

From: Jason Smith
Sent: Monday, November 23, 2009 12:36 PM
To: rules-users@lists.jboss.org
Subject: Rule runs twice without explicit call to update($fact).

My colleague has confirmed that this behavior has been around since Drools 4, 
and it continues to be a problem for Drools 5.0.1 and 5.1.0.M1, assuming it's a 
problem and not working as intended.

$fact.setPath("...") implements the correct PropertyChangeSupport mechanism for 
Drools.  At least Drools is using it and responding mostly as expected.

This runs once:

rule "Constrain to owner or published to public"

when

$fact : ListFact(

$path : path not matches ".*owner.*",

noopResponse == true

)

$model : Model()

then

modify($fact)

{

setPath($fact.getPath() + "[owner]")

}

update($fact);

end


This runs twice:

rule "Constrain to owner or published to public"

when

$fact : ListFact(

$path : path not matches ".*owner.*",

noopResponse == true

)

$model : Model()

then

modify($fact)

{

setPath($fact.getPath() + "[owner]")

}

end


If I don't use modify(...) and simply change the $fact bean path property, the 
same thing occurs.  If I explicitly call update($fact), the rule runs once.  If 
I don't it runs twice.

I get "/path[owner][owner]" when I actually wanted "/path[owner]", because it 
ran twice, not once.

Why doe update(...) work differently from the PropertyChangeSupport 
mechanism???  Shouldn't I be able to depend on Drools to run this rule only one 
time?

I am, admittedly, a bit of a noob at this, but I ran this by my local Drools 
resident expert, and he doesn't know the answer either.

Thanks so much!

Jason Smith
Software Engineer
InfoTrust Group, Inc.
500 Discovery Parkway, Suite 200
Superior, CO 80027
Office 303-627-6571
Fax 303-666-6711
Email jsm...@infotrustgroup.com
WEB www.infotrustgroup.com
This e-mail and all information included herein do not constitute a legal 
agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.  All 
legal agreements must be formulated in writing by a legal representative of 
INFOTRUST GROUP. This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to whom they are 
addressed.  If you have received this e-mail by mistake, please inform us and 
destroy this e-mail and any documents it might contain.  Please note that any 
views or opinions presented in this email are solely those of the author and do 
not necessarily represent those of the company. Finally, the recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.  Thank you for your cooperation.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] GUI help

2009-11-25 Thread SzA84

Hi!

I have some questions about the guided editor.

I try to build a rule in the guided editor. I added some conditions and this
is the generated DRL:

Rule "grafikus"
dialect "mvel"
when
orvosimeres$Adattipus( ertek == "/heart_rate" )
orvosimeres$Mertadat( mertekegyseg == "/min" , mozgas == "true" 
,
vernyomas > ( 140 ) , vernyomas < ( 180 ) )
then
end

My imports in the rule.package file are the following:
package orvosi;
import orvosi.orvosimeres.Adattipus;
import orvosi.orvosimeres.Mertadat;

And I have this error message: unknown:4:2 Unexpected token 'orvosimeres'   
.

So that is my first question. What can cause the problem?
And my other question is, how can I execute a rule, that was made in the
guided editor?

Thanks in advance for the reply!




-- 
View this message in context: 
http://old.nabble.com/GUI-help-tp26518461p26518461.html
Sent from the drools - user mailing list archive at Nabble.com.

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


[rules-users] Drools bootcamp schedules

2009-11-25 Thread Chris Richmond
Hello all,

 

Is there a list of scheduled boot camps with dates/locations anywhere?  I
can't seem to find it on the site/blog.

 

 

Thanks,

 

Chris

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


Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy

2009-11-25 Thread Vijay K Pandey
Thanks Kris. That's what I thought later on after your first mail on this 
topic. So I did got the JPA entity persisted/merged after retrieving the 
entitymanagerfactory from the working memory's environment and got it done 
through the JPA transaction - I will refactor this to use the JPA command 
service so that I don't have to deal with transaction et all.



-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Kris Verlaenen
Sent: Wednesday, November 25, 2009 10:06 AM
To: Rules Users List; Vijay K Pandey
Cc: Rules Users List
Subject: Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem 
is in pending state - variable persistence strategy



Quoting Vijay K Pandey :



> > c)I would like to change it through Drools Process because that's

> where I have associated the JPA entities - I would not like to update

> it from outside.



Not sure this is a problem.  You merely create an association to these

JPA entities (assuming we implement the pluggable persistence strategy

here as well).  And the engine is only interested in the start and

completion of the work item, not really in anything that happens in

between.  So I don't think updating the JPA entities from outside the

engine should be considered a problem.



In theory you could easily update the work item, we simply don't have a

command for that implemented.  If you would write a command that can

then be executed inside a transaction using the JPA command service,

those changes would be persisted.



Kris



Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

___

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] unable to resolve Type Declaration class

2009-11-25 Thread richarda

Still trying to get this to work.
I have managed to create from a default (new) guvnor setup.

Steps I do..
1. Create fresh guvnor
2. In eclipse create  Message.java file in package com.sample, and create a
jar file
3. In guvnor import the model for the Message.jar file
4. In guvnor create a category
5. Create an import statement for  import com.sample.Message
6. Create a simple technical rule,  something like   when, Message(), then,
System.out.println(".");
7. Build the pkg
8. download the pkg

use the code from previous post to load the pkg...
it works fine..

now, goto guvnor advanced view and change the Configuration from:
import com.sample.Message

to:

import com.sample.Message;

declare Message
  @role( event )
end


build the pkg,
download the pkg,
run the test program...

I get:
org.drools.RuntimeDroolsException: unable to resolve Type Declaration class
'Message'
at 
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
at com.sample.DroolsTest.main(DroolsTest.java:27)


richarda wrote:
> 
> So, my code is doing this:
>  
>  KnowledgeBaseConfiguration conf =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
> conf.setOption(EventProcessingOption.STREAM);
> KnowledgeBuilder builder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
> try {
> File f = new File("/tmp/my.pkg");
> InputStream stream = new FileInputStream(f);
> if (stream == null) {
> jlog.fatal("Unable to find rule pkg");
> } else {
> jlog.info("adding pkg");
>
> builder.add(ResourceFactory.newInputStreamResource(stream),
> ResourceType.PKG);
> }
> } catch (Exception e) {
> e.printStackTrace();
> }
> KnowledgeBase kbase =
> KnowledgeBaseFactory.newKnowledgeBase(conf);
> kbase.addKnowledgePackages(builder.getKnowledgePackages());
> jlog.info("setup creating knowledge session");
> ksession = kbase.newStatefulKnowledgeSession();
> jlog.info(" setup ksession created");
> 
> 
> The pkg was created from Guvnor.
> 
> If in the package declaration area in Guvnor,  (where you put the import
> statements)
> If I put
> declare Signature
>  @role ( event )
> end
> 
> then build the package, save it to disk /tmp/my.pkg
> on startup I get:
> 
> [#|2009-11-24T14:50:38.944+|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
> unable to resolve Type Declaration class 'Signature'
>   at 
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>   at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>   at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
> 
> 
> I need to declare 'Signature' as an 'event'
> Am I doing this wrong?
> 
> If I do this all in Eclipse and load the DRL files manually it all works.
> 

-- 
View this message in context: 
http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26517577.html
Sent from the drools - user mailing list archive at Nabble.com.

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


Re: [rules-users] StatefulKnowledgeSession Vs StatefulSession

2009-11-25 Thread Wolfgang Laun
This works for me:

StatefulKnowledgeSession session;
//...
KnowledgeBase kb = session.getKnowledgeBase();
for( KnowledgePackage kp: kb.getKnowledgePackages() ){
for( Rule r: kp.getRules() ){
System.out.println( "Rule: " + r.getName() );   

}
}

-W

On Wed, Nov 25, 2009 at 5:23 PM, DeepakA  wrote:
>
> So how can I access RuleBase from StatefulKnowledgeSession?
> I cant find a API that links RuleBase and StatefulKnowledgeSession
> interface.
>
> I need to get hold of each individual rule from StatefulKnowledgeSession
>
>
>
>
>
>
>
> DeepakA wrote:
>>
>> I used a KnowledgeBuilder ro read the resources (DSL & DSLR files)
>> Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
>> the KnowledgeBase.
>> The StatefulKnowledgeSession was used to start the process and fire all
>> rules.
>> Then I realized I was not able to access the RuleBase from
>> StatefulKnowledgeSession.
>>
>>
>> So, now I create a RuleBase, then a PackageBuilder, add the resources to
>> the packageBuilder, then add the
>> package to the RuleBase and create a StatefulSession out of the RuleBase.
>> This statefulsession is used to start the process and fire all rules.
>>
>> Can someone explain to me whats the difference in the above 2 methods of
>> firing the rules.
>> Whats the difference between StatefulKnowledgeSession & StatefulSession.
>>
>
> --
> View this message in context: 
> http://old.nabble.com/StatefulKnowledgeSession-Vs-StatefulSession-tp26511606p26515717.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] StatefulKnowledgeSession Vs StatefulSession

2009-11-25 Thread DeepakA

So how can I access RuleBase from StatefulKnowledgeSession?
I cant find a API that links RuleBase and StatefulKnowledgeSession
interface.

I need to get hold of each individual rule from StatefulKnowledgeSession







DeepakA wrote:
> 
> I used a KnowledgeBuilder ro read the resources (DSL & DSLR files)
> Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
> the KnowledgeBase.
> The StatefulKnowledgeSession was used to start the process and fire all
> rules.
> Then I realized I was not able to access the RuleBase from
> StatefulKnowledgeSession.
> 
> 
> So, now I create a RuleBase, then a PackageBuilder, add the resources to
> the packageBuilder, then add the
> package to the RuleBase and create a StatefulSession out of the RuleBase.
> This statefulsession is used to start the process and fire all rules.
> 
> Can someone explain to me whats the difference in the above 2 methods of
> firing the rules.
> Whats the difference between StatefulKnowledgeSession & StatefulSession.
> 

-- 
View this message in context: 
http://old.nabble.com/StatefulKnowledgeSession-Vs-StatefulSession-tp26511606p26515717.html
Sent from the drools - user mailing list archive at Nabble.com.

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


Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy

2009-11-25 Thread Kris Verlaenen
Quoting Vijay K Pandey :

> > c)I would like to change it through Drools Process because that's
> where I have associated the JPA entities - I would not like to update
> it from outside.

Not sure this is a problem.  You merely create an association to these
JPA entities (assuming we implement the pluggable persistence strategy
here as well).  And the engine is only interested in the start and
completion of the work item, not really in anything that happens in
between.  So I don't think updating the JPA entities from outside the
engine should be considered a problem.

In theory you could easily update the work item, we simply don't have a
command for that implemented.  If you would write a command that can
then be executed inside a transaction using the JPA command service,
those changes would be persisted.

Kris

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Flow (human task) and web apps

2009-11-25 Thread Kris Verlaenen
Quoting ramram8 :

> Concerning this point the JNDI seems to be a good idea but in case I
> cant use the JNDI is there any alternative
Any solution that would allow an external application and console to
share the same session would work.

> I used the XML dumper and changed the dynamic process to XML but
> can you
> help with a reference to a sample JAVA code that can be used to
> upload an
> xml file into Guvnor and build the file in order to use it in the GWT
> web
> application
I guess the best way is to look at the Guvnor JUnit tests, there must be
some tests that should features like this.  You could also mount Guvnor
on your file system (using WebDAV), so uploading would be the same as
writing a file to disk.

Kris

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] StatefulKnowledgeSession Vs StatefulSession

2009-11-25 Thread Mark Proctor
DeepakA wrote:
> I used a KnowledgeBuilder ro read the resources (DSL & DSLR files)
> Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
> the KnowledgeBase.
> The StatefulKnowledgeSession was used to start the process and fire all
> rules.
> Then I realized I was not able to access the RuleBase from
> StatefulKnowledgeSession.
>
>
> So, now I create a RuleBase, then a PackageBuilder, add the resources to the
> packageBuilder, then add the
> package to the RuleBase and create a StatefulSession out of the RuleBase.
> This statefulsession is used to start the process and fire all rules.
>   
packagebuilder is the old api, knowledgebuilder is the new one
> Can someone explain to me whats the difference in the above 2 methods of
> firing the rules.
> Whats the difference between StatefulKnowledgeSession & StatefulSession.
>   
statefulession is the old api.

these old apis are kept around for backwards compatability.


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


Re: [rules-users] Question on Rule Flow and Web Console

2009-11-25 Thread Kris Verlaenen
How about simply adding an XOR split node after the second node that
checks the value of the parameter?  Or adding a ruleset node there and
they use rules to create this human task if necessary?

A more advanced way to model this would be to use dynamic or ad-hoc
processes.  At this point you could easily have a rule that describes in
which situation a task should be created (which is already possible now)
but it will also allow you to wait for the completion of these
dynamically created tasks.  But we are currently still working on this
type of processes, so it's still in experimental phase.

Kris

Quoting ramram8 :

> 
> Hi All,
> 
>I have a question about rule flow and web console:
>- Can we create a Rule Flow scenario in which the User tasks in it
> is
> dynamic. I created a Rule Flow usingFluent Api but what will
> happen is
> that in this case I wont have a single Rule Flow scenario with
> dynamic
> number of user tasks I ended up by having multiple scenarios. I used
> also
> the ForEach loop but what happened is that the user tasks are all
> created at
> the same level. 
> 
>what i am looking to is to have according to certain parameter of
> (2) for
> example
> start > task 1 > task 2 > end 
> if the parameter value is (3) then I will have
> start > task 1 > task 2 > task 3 > end
> 
> Can this be achieved in Rule Flow ??? 
> And if it Cant?? is there any Alternative ???
>  
> -- 
> View this message in context:
>
http://old.nabble.com/Question-on-Rule-Flow-and-Web-Console-tp26508838p26508838.html
> Sent from the drools - user mailing list archive at Nabble.com.
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RESTful Example

2009-11-25 Thread Tony Qian



All,

 

First, I apologize long email. I have a few questions on how
to use RESTful web Service on Execution Server. I have read through the
document and followed the instruction. I think I missed a few critical steps.
Here are what I did.

 

1) 
Created package, category, rule, a java class
(Referral as fact).

Class Referral {

   
String homeState;

   
String servviceType;

   
String stateLicenseNumber;

…

}

2) 
Used Test Scenarios tool to test rule.
Everything worked perfectly.

3) 
Installed Execution Server in JBoss.

4) 
Added a mytest.properties file under
\drools-5.0-guvnor-standalone\jboss-4.2.3.GA\server\default\deploy\drools-server.war\WEB-INF\classes\



   
 

   
  http://localhost:8080/DroolsDemo_sfasdfasd.pkg
type='PKG' />

   
 



5)  Add jar file for above java
class in lib directory.

6) 
Created java class to call mytest RESTful
service.

 

PostMethod
method = new 
PostMethod("http://localhost:8080/drools-server/knowledgebase/mytest";);

   
method.setRequestHeader("Cache-Control", "no-cache");

   
method.setRequestHeader("Accept","text/xml");

   
method.setRequestHeader("Content-Encoding","UTF-8");

   
try{

 
File f = new File("Request.xml");

   
method.setRequestBody(new
FileInputStream(f));

   
}catch(Exception e){

 
  }

 

Request.xml content is:

 



  

  

  



  testFact

  

   
FL

   
HH

   


  



  



 

I got RuleBase mytest not known
or is not valid.

 

Here are my questions:

 

1) 
Did I miss any other steps? Anything I did
wrong?

2) 
 If I run execution server on different
server, where I should put pkg file and how to make necessary changes to
mytest.properties?

 

Appreciate your help and Happy
Holidays.

 

Tony

  
_
Windows 7: It works the way you want. Learn more.
http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009v2___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RESTful Example

2009-11-25 Thread Qian, Tony
All,

First, I apologize long email. I have a few questions on how to use RESTful web 
Service on Execution Server. I have read through the document and followed the 
instruction. I think I missed a few critical steps. Here are what I did.


1)  Created package, category, rule, a java class (Referral as fact).

Class Referral {

String homeState;

String servviceType;

String stateLicenseNumber;

...

}

2)  Used Test Scenarios tool to test rule. Everything worked perfectly.

3)  Installed Execution Server in JBoss.

4)  Added a mytest.properties file under 
\drools-5.0-guvnor-standalone\jboss-4.2.3.GA\server\default\deploy\drools-server.war\WEB-INF\classes\





  http://localhost:8080/DroolsDemo_sfasdfasd.pkg 
type='PKG' />





5)  Add jar file for above java class in lib directory.

6)  Created java class to call mytest RESTful service.


PostMethod method = new 
PostMethod("http://localhost:8080/drools-server/knowledgebase/mytest";);
method.setRequestHeader("Cache-Control", "no-cache");
method.setRequestHeader("Accept","text/xml");
method.setRequestHeader("Content-Encoding","UTF-8");
try{

  File f = new File("Request.xml");
method.setRequestBody(new FileInputStream(f));

}catch(Exception e){

}



Request.xml content is:



  
  
  

  testFact
  
FL
HH

  

  





I got RuleBase mytest not known or is not valid.



Here are my questions:



1)  Did I miss any other steps? Anything I did wrong?

2)   If I run execution server on different server, where I should put pkg 
file and how to make necessary changes to mytest.properties?

Sorry for long email. Appreciate your help and Happy Holidays.

Tony


CONFIDENTIALITY NOTICE: The information in 
this electronic transmission and
any documents accompanying it may contain confidential and privileged
information intended for use by the individual or entity that is the intended
recipient. If you have received this message in error or due to an unauthorized
transmission or interception, please delete all copies from your system without
disclosing, copying, or transmitting this message and notify us by telephone
877TELLUS9 or by electronic mail servicecomme...@progressive-medical.com.

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


[rules-users] StatefulKnowledgeSession Vs StatefulSession

2009-11-25 Thread DeepakA

I used a KnowledgeBuilder ro read the resources (DSL & DSLR files)
Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
the KnowledgeBase.
The StatefulKnowledgeSession was used to start the process and fire all
rules.
Then I realized I was not able to access the RuleBase from
StatefulKnowledgeSession.


So, now I create a RuleBase, then a PackageBuilder, add the resources to the
packageBuilder, then add the
package to the RuleBase and create a StatefulSession out of the RuleBase.
This statefulsession is used to start the process and fire all rules.

Can someone explain to me whats the difference in the above 2 methods of
firing the rules.
Whats the difference between StatefulKnowledgeSession & StatefulSession.
-- 
View this message in context: 
http://old.nabble.com/StatefulKnowledgeSession-Vs-StatefulSession-tp26511606p26511606.html
Sent from the drools - user mailing list archive at Nabble.com.

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


[rules-users] Activation groups (xor-group)

2009-11-25 Thread Swindells, Thomas
Please could someone clarify exactly how activation-groups work.
My understanding of them is that if a set of rules are all in the same 
activation group then only one of them will fire.

Is this correct? In particular what happens if a rule becomes deactivated, can 
another rule in the same activation-group then fire?



Thanks,
Thomas


This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools 5.0 Guvnor install

2009-11-25 Thread SzA84

Thanks! That was the problem!



mdesignz wrote:
> 
> Have you tried:./run.sh -b localhost
> and force JBoss to bind to localhost?
> 
> Unless you change JBoss, you need to specify the port:
> http://localhost:8080/drools-guvnor
> 
> On Nov 24, 2009, at 11:46 AM, SzA84 wrote:
> 
>> 
>> Unfortunately that isn't good too.
>> 
>> But I see this message:
>> 19:27:20,921 INFO  [AprLifecycleListener] The Apache Tomcat Native
>> library
>> which allows optimal performance in production environments was not found
>> on
>> the java.library.path
>> I don't know what is it exactly, but may be this is the problem?
>> 
>> 
>> Sahid Khan (সাহিদ) wrote:
>>> 
>>> On Tue, Nov 24, 2009 at 5:40 PM, SzA84 
>>> wrote:
 And it says "you should navigate to http://localhost/drools-jbrms and
 check
 that Guvnor appears", but it doesn't work, although the server is
 running.
 
>>> 
>>> I think request url should be http://localhost/drools-guvnor
>>> 
>>> 
>>> -- 
>>> S.
>>> Argue with idiots, and you become an idiot. - PG
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/Drools-5.0-Guvnor-install-tp26494839p26499921.html
>> Sent from the drools - user mailing list archive at Nabble.com.
>> 
>> 
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> The human mind is an iterative processor, it never does anything right the
> first time.  What it does well is to make improvements on every iteration
> (deMarco)
> 
> 
> 
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Drools-5.0-Guvnor-install-tp26494839p26510432.html
Sent from the drools - user mailing list archive at Nabble.com.


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


[rules-users] Question on Rule Flow and Web Console

2009-11-25 Thread ramram8

Hi All,

   I have a question about rule flow and web console:
   - Can we create a Rule Flow scenario in which the User tasks in it is
dynamic. I created a Rule Flow usingFluent Api but what will happen is
that in this case I wont have a single Rule Flow scenario with dynamic
number of user tasks I ended up by having multiple scenarios. I used also
the ForEach loop but what happened is that the user tasks are all created at
the same level. 

   what i am looking to is to have according to certain parameter of (2) for
example
start > task 1 > task 2 > end 
if the parameter value is (3) then I will have
start > task 1 > task 2 > task 3 > end

Can this be achieved in Rule Flow ??? 
And if it Cant?? is there any Alternative ???
 
-- 
View this message in context: 
http://old.nabble.com/Question-on-Rule-Flow-and-Web-Console-tp26508838p26508838.html
Sent from the drools - user mailing list archive at Nabble.com.

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