Re: [rules-users] accessing a drools variable

2010-11-04 Thread Wolfgang Laun
All accesses to a global must be done via setGlobal/getGlobal:
  drools.getWorkingMemory().setGlobal( "prodCat", getName(nameList) );

It's not a Java variable.

-W

On 4 November 2010 20:59, rajivharris  wrote:

>
> Hi ,
>
> Thanks Bruno and Wolfgang for replying.
>
> The getname() is a drools function which i want to invoke at runtime and
> set
> the global variable.
> Code:
> global String prodCat;
>
> rule "Your First Rule"
>
>when
>#conditions
>nameList : ArrayList()
>//prodCat : String()
>eval (nameList.size() > 0)
>then
>#actions
>prodCat = getName(nameList);
>//modify (prodCat);
>System.out.println( "ArrayListSize:" +nameList.size());
>System.out.println( "ProductCategory:" +prodCat);
>
> end
>
> function String getName(List lstName)
> {
>String name= "";
>String prodCat = "";
>
>for (Iterator iterator = lstName.iterator();iterator.hasNext();) {
>Map dsName= (HashMap)iterator.next();
>prodCat = dsName.get("name").toString();
>
>if(prodCat.equalsIgnoreCase("Rajiv"))
>{
>name= "Rajiv";
>break;
>}
>else if(prodCat.equalsIgnoreCase("Robin"))
>{
>name= "Robin";
>}
>}
>return name;
> }
>
> JAVA:
> String prodCat = "dummy";
> StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
> ksession.insert(lstName);
> ksession.setGlobal("prodCat", prodCat);
> ksession.fireAllRules();
> System.out.println("Output:"+ksession.getGlobal("prodCat"));
>
> --Rajiv
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1844248.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] accessing a drools variable

2010-11-04 Thread rajivharris

Hi , 

Thanks Bruno and Wolfgang for replying.

The getname() is a drools function which i want to invoke at runtime and set
the global variable.
Code:
global String prodCat;

rule "Your First Rule"

when
#conditions
nameList : ArrayList()
//prodCat : String()

eval (nameList.size() > 0)
then 
#actions
prodCat = getName(nameList);
//modify (prodCat);
System.out.println( "ArrayListSize:" +nameList.size());
System.out.println( "ProductCategory:" +prodCat);

end

function String getName(List lstName)
{
String name= "";
String prodCat = "";

for (Iterator iterator = lstName.iterator();iterator.hasNext();) {
Map dsName= (HashMap)iterator.next();
prodCat = dsName.get("name").toString();

if(prodCat.equalsIgnoreCase("Rajiv"))
{
name= "Rajiv";
break;
}
else if(prodCat.equalsIgnoreCase("Robin"))
{
name= "Robin";
}   
}
return name;
}

JAVA:
String prodCat = "dummy";
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.insert(lstName);
ksession.setGlobal("prodCat", prodCat);
ksession.fireAllRules();
System.out.println("Output:"+ksession.getGlobal("prodCat"));

--Rajiv
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1844248.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] accessing a drools variable

2010-11-04 Thread Wolfgang Laun
To set a global called "prodName" to the value returned by getName() within
a rule's consequence you should use
   drools.getWorkingMemory().setGlobal( "prodName",  getName() );
-W

On 4 November 2010 18:15, rajivharris  wrote:

>
> Hi,
> I am setting a String variable as global. And trying the access the same in
> my Java program. Can anyone help on how to do this.
>
> code snippet:
> global String prodName;
>
> rule "Your First Rule"
>
>when
>#conditions
>eval (true)
>then
>#actions
>prodName= getName();
>System.out.println( "name:" +prodName);
>
> end
>
> Thanks,
> Rajiv.
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1843203.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] accessing a drools variable

2010-11-04 Thread Bruno Freudensprung

Hi,

I've never tried this but there is a getGlobals() method on the 
StatelessKnowledgeSession and on the StatefulKnowledgeSession (actually 
on KnowledgeRuntime).
Maybe worth giving a try :-).
Best regards,

Bruno.

rajivharris a écrit :
> Hi, 
> I am setting a String variable as global. And trying the access the same in
> my Java program. Can anyone help on how to do this.
>
> code snippet:
> global String prodName;
>
> rule "Your First Rule"
>   
>   when
>   #conditions 
> 
>   eval (true)
>   then 
>   #actions
>   prodName= getName();
>   System.out.println( "name:" +prodName);
>   
> end
>
> Thanks,
> Rajiv.
>   

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


[rules-users] The Field rulesByteArray in Table SessionInfo Always Empty

2010-11-04 Thread Rui Tang
Hi list,

I have a very simple webapp demo based on drools-persistence-jpa.

I can obtain a StatefulKnowledgeSession from this statement:

ksession = JPAKnowledgeService.newStatefulKnowledgeSession(this.kbase,
null, env);

and the SessionInfo will be stored into database correctly, except that the
rulesByteArray field is always empty.

Then I use the following statement to retrieve this ksession, but NPE
occurred.

ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(
command.getSessionId(), this.kbase, null, env);

I've read the code (JPASessionMarshallingHelper.loadSnapshot()) and find
that this should be caused by the empty rulesByteArray filed.

I'm wondering in which case this field is empty, and how to make it work
correct.

Below is the stacktrace:

Caused by: java.lang.IllegalStateException:
java.lang.reflect.InvocationTargetException
at
org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:110)
at
org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:78)
at
org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:118)
at
com.zyeeda.framework.knowledge.internal.DroolsKnowledgeServiceProvider.execute(DroolsKnowledgeServiceProvider.java:165)
at
$KnowledgeService_12c173f2df7.execute($KnowledgeService_12c173f2df7.java)
at
com.zyeeda.framework.resources.SampleFlowResource.start(SampleFlowResource.java:36)
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.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
... 49 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.drools.persistence.jpa.impl.KnowledgeStoreServiceImpl.buildCommanService(KnowledgeStoreServiceImpl.java:95)
... 60 more
Caused by: java.lang.NullPointerException
at java.io.ByteArrayInputStream.(ByteArrayInputStream.java:89)
at
org.drools.persistence.session.JPASessionMarshallingHelper.loadSnapshot(JPASessionMarshallingHelper.java:85)
at
org.drools.persistence.session.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:196)
at
org.drools.persistence.session.SingleSessionCommandService.(SingleSessionCommandService.java:159)

Thank you very much!

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


[rules-users] accessing a drools variable

2010-11-04 Thread rajivharris

Hi, 
I am setting a String variable as global. And trying the access the same in
my Java program. Can anyone help on how to do this.

code snippet:
global String prodName;

rule "Your First Rule"

when
#conditions 

eval (true)
then 
#actions
prodName= getName();
System.out.println( "name:" +prodName);

end

Thanks,
Rajiv.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/accessing-a-drools-variable-tp1843203p1843203.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] case in-sensitive string comparison?

2010-11-04 Thread H.C.

Thanks guys, this could be a workable option. Will do some experimentation.

Thanks!
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1843097.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] case in-sensitive string comparison?

2010-11-04 Thread Wolfgang Laun
If (re)writing the rules to replace String "==" and "!=" with a custom op
for String eq and ne is an option, then it's simple to provide this
operator.

The link is http://members.inode.at/w.laun/drools/CustomOperatorHowTo.html

-W

2010/11/4 Michael Anstis 

> You could look at using your own custom operator.
>
> Wolfgang Laun linked to an article of his recently explaining the approach.
>
> I'm not sure if custom operators however allow for indexing in the RETE
> network and therefore whether they're any faster than eval.
>
> Wolfgang, Edson, can you advise in your experience?
>
> Thanks,
>
> Mike
>
> On 4 November 2010 16:04, H.C.  wrote:
>
>>
>> We have a requirement to display data as stored (with the right casing)
>> but
>> for evaluation purposes strings should be compared case in-sensitive. We
>> have several hundred rules touching these particular strings and would
>> really like to avoid doing eval( x != null && x.equalsIngoreCase(y) )
>> everywhere. Is there anywhere in drools that we could configure to make
>> string matching case in-sensitive?
>>
>> Since we have to display the data with casing elsewhere, putting
>> x.toLowerCase() in all our getter methods doesn't seem to be an option.
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1842677.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
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] case in-sensitive string comparison?

2010-11-04 Thread Michael Anstis
You could look at using your own custom operator.

Wolfgang Laun linked to an article of his recently explaining the approach.

I'm not sure if custom operators however allow for indexing in the RETE
network and therefore whether they're any faster than eval.

Wolfgang, Edson, can you advise in your experience?

Thanks,

Mike

On 4 November 2010 16:04, H.C.  wrote:

>
> We have a requirement to display data as stored (with the right casing) but
> for evaluation purposes strings should be compared case in-sensitive. We
> have several hundred rules touching these particular strings and would
> really like to avoid doing eval( x != null && x.equalsIngoreCase(y) )
> everywhere. Is there anywhere in drools that we could configure to make
> string matching case in-sensitive?
>
> Since we have to display the data with casing elsewhere, putting
> x.toLowerCase() in all our getter methods doesn't seem to be an option.
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1842677.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


[rules-users] case in-sensitive string comparison?

2010-11-04 Thread H.C.

We have a requirement to display data as stored (with the right casing) but
for evaluation purposes strings should be compared case in-sensitive. We
have several hundred rules touching these particular strings and would
really like to avoid doing eval( x != null && x.equalsIngoreCase(y) )
everywhere. Is there anywhere in drools that we could configure to make
string matching case in-sensitive?

Since we have to display the data with casing elsewhere, putting
x.toLowerCase() in all our getter methods doesn't seem to be an option.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/case-in-sensitive-string-comparison-tp1842677p1842677.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] KnowledgeAgent ChangeSet failing to reload resources

2010-11-04 Thread etfink123

Jason,

Your's sound slightly different in that you have not been able to
successfully fire up your KnowledgeBase at all.

Mine works, but fails once an invalid DRL file is read.

In any case, I am not use PKG for my ChangeSet resources:








I am creating the KA as follows:

KnowledgeAgentConfiguration agentConfig =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
agentConfig.setProperty("drools.agent.newInstance", "false");

agent = KnowledgeAgentFactory.newKnowledgeAgent("MyAgent",
agentConfig);
kaListener = new KnowledgeAgentEventListenerImpl();
agent.addEventListener(kaListener);
   
agent.applyChangeSet(ResourceFactory.newClassPathResource("rules/ChangeSet.xml"));
agent.monitorResourceChangeEvents(true);

ResourceChangeScannerConfiguration scannerConfig =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
scannerConfig.setProperty("drools.resource.scanner.interval", "5");

   
ResourceFactory.getResourceChangeScannerService().configure(scannerConfig);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();

I'll keep you posted if I hear anything.

- Eric

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeAgent-ChangeSet-failing-to-reload-resources-tp1842033p1842540.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] KnowledgeAgent ChangeSet failing to reload resources

2010-11-04 Thread Jason Davidson
Eric,

I've been fighting something similar to your problem as posted
here.


I'm interested in what your KnowledgeAgent setup because I can't get the
agent to detect changes to rule PKG files.  Are you using Spring?

Thanks!
Jason

On Thu, Nov 4, 2010 at 8:41 AM, Fink, Eric [USA]  wrote:

> Greetings.  I am using Drools 5.1.1's KnowledgeAgent ChangeSet
> functionality and have come across an issue.
>
> here is the use case:
>
> Fire up the application with a valid DRL file. Works as designed.
> Update the DRL file. ChangeSet senses updated file, KnowledgeBase is
> updated with updated rules, yadda, yadda. Works as designed.
> Update the DRL file and introduce errors in the LHS of the rule. For
> example, I changed Sensor to Sccensor in the example below and $masterId is
> not defined. The following is reported as expected:
>
> KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
> [2010:11:308 09:11:515:info] KnowledgeAgent performing an incremental build
> of the ChangeSet
> [2010:11:308 09:11:843:debug] KnowledgeAgent has KnowledgeBuilder errors
>  object=Unable to resolve ObjectType 'Sccensor' : [Rule name='18)
> sensorCount derived variable']
> Rule Compilation error : [Rule name='18) sensorCount derived variable']
>bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (7:590)
> : $masterID cannot be resolved
>bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (8:624)
> : $masterID cannot be resolved
>bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (9:769)
> : $masterID cannot be resolved
>
> Update the DRL file to the previously working version. The ChangeSet never
> senses that the file has been updated. It just runs along checking every x
> seconds.
>
> Has anyone experienced this? Is there a listener that should be firing
> somewhere?
>
> Thanks is advance.
>
> - Eric
> ___
> 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] Marshalling Error : JBRULES-2453

2010-11-04 Thread Mark Proctor

On 04/11/2010 08:36, Michael Anstis wrote:
If it's "impossible to debug *with* a test case" imagine how difficult 
it must be without one!

hehe, yes meant without :)

Mark


;-)

On 4 November 2010 04:49, Mark Proctor > wrote:


On 03/11/2010 15:01, drooRam wrote:
> bump
you'll need to make a minimal self contained test that removes
everything but what is necessary to show the problem, then attach
it as
a jira. The marshalling stuff is very cryptic and impossible to debug
with a test case.

Mark

___
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] Starting resource change scanner and notifier in drools-server.

2010-11-04 Thread Jason Davidson
I've move both the changeset.xml and my PKG files to a file location (not on
the class path).  It still doesn't detect when the PKG files have been
updated.

changeset.xml:





  

  

  

  

  

  

  

  

  





Spring config:

  

  

  

  



 



  


 Could it be because I'm using PKGs instead of DRL files?

Thanks!!
Jason

2010/11/3 Mark Proctor 

>  It won't detect changes on the classpath. Needs to be file or http.
>
> Mark
>
> On 03/11/2010 21:49, Jason Davidson wrote:
>
> Hello,
>
>  Any tips on this?  I'm seeing this same behavior using Drools 5.1.1:
>
>  Spring Beans:
>
>   
>
>   
>
>   
>
>   
>
>   
>
> 
>
>   "classpath:drools-changeset.xml"/>
>
> 
>
>   
>
>  Changeset:
>
> 
> xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>
> xs:schemaLocation='http://drools.org/drools-5.0/change-set
> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd
> ' >
>
> 
>
>   http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> "
>
>type='PKG' basicAuthentication="enabled" username="admin"
> password="admin" />
>
> 
>
> 
>
>
>
>  At startup I see that the KnowledgeAgent registers a listener but never
> detects changes:
>
> [2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
> interval=60
>
> [2010:11:307 15:11:506:info] ResourceChangeScanner created with default
> interval=60
>
> [2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
> interval=10
>
> [2010:11:307 15:11:528:info] ResourceChangeNotification created
>
> [2010:11:307 15:11:528:debug] ResourceChangeNotification monitor added
> monitor=org.drools.io.impl.resourcechangescanneri...@616181be
>
> [2010:11:307 15:11:529:debug] KnowledgeAgent building resource map
>
> [2010:11:307 15:11:529:info] KnowledegAgent has started listening for
> ChangeSet notifications
>
> [2010:11:307 15:11:529:info] KnowledgeAgent created, with configuration:
>
> monitorChangeSetEvents=true scanResources=true scanDirectories=true
> newInstance=true
>
> [2010:11:307 15:11:530:info] KnowledgeAgent applying ChangeSet
>
> [2010:11:307 15:11:531:debug] KnowledgeAgent processing sub
> ChangeSet=[ClassPathResource path='drools-changeset.xml']
>
> [2010:11:307 15:11:919:debug] KnowledgeAgent notifier subscribing to
> resource=[UrlResource path='
> http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> ']
>
> [2010:11:307 15:11:920:debug] ResourceChangeNotification subscribing
> listener=org.drools.agent.impl.knowledgeagenti...@d2a7c1e to
> resource=[UrlResource path='
> http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> ']
>
> [2010:11:307 15:11:920:debug] ResourceChangeScanner subcribing
> notifier=org.drools.io.impl.resourcechangenotifieri...@603a9c52 to
> resource=[UrlResource path='
> http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> ']
>
> [2010:11:307 15:11:920:debug] KnowledgeAgent rebuilding KnowledgeBase using
> ChangeSet
>
>
>  Thanks!
>
> Jason
>
>
>   2010/9/23 Clandes Tino 
>
>>   Hi,
>> I've also faced the same problem.
>> Hope somebody could give a hint.
>>
>> thanks & best,
>> milan
>>
>> --- On *Mon, 20/9/10, Graham Thomson * wrote:
>>
>>
>> From: Graham Thomson 
>> Subject: [rules-users] Starting resource change scanner and notifier in
>> drools-server.
>> To: rules-users@lists.jboss.org
>> Date: Monday, 20 September, 2010, 15:24
>>
>>
>>
>> Hi,
>>
>> I would like to ask for help with setting up drools-server with Guvnor. I
>> am using version 5.1.1 of both.
>>
>> I am trying to set up an instance of drools-server in Tomcat that
>> periodically loads new updates of packages published in Guvnor (both
>> drools-server and Guvnor run in the same instance of Tomcat).
>>
>> My change set definition is as follows:
>>
>> 
>> > xmlns='http://drools.org/drools-5.0/change-set'
>>   
>> 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' basicAuthentication="enabled" username=""
>> password="" />
>> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/> of my packages>/LATEST"
>>   type="PKG" basicAuthentication="enabled" username=""
>> password="" />
>>   
>> 
>>
>> My knowledge-services.xml configuration is as follows (based on the unit
>> test examples highlighted in
>> http://article.gmane.org/gmane.com

Re: [rules-users] Help needed in activationCreated and activationCanceled event

2010-11-04 Thread Michael Anstis
Please don't email me direct. I won't reply in the future. All questions and
answers are of value to the community as a whole.

To quote what I replied to an almost identical request a couple of days ago
and posted to the drools-user mailing list.

"AFAIK, Activation Cancelled events would trigger in reaction to the
revocation of a logically inserted fact that caused an activation to trigger
in the first place. It would not help identifying which pattern in a rule
was not matched causing your rule not to activate".

On 4 November 2010 14:41,  wrote:

> Hi, thanks for helping me out with that code. i have one more question, in
> activation cancelled event, it never gets executed.
>
> @Override
>public void activationCancelled(ActivationCancelledEvent
> event) {
>final Rule rule = event.getActivation().getRule();
>final String ruleName = rule.getName();
>System.out.println("Activation cancelled --> " +
> ruleName);
>rules.add(rule);
>ruleNames.add(ruleName);
>}
>
>
> @Override
>public void activationCreated(ActivationCreatedEvent event)
> {
>final Rule rule = event.getActivation().getRule();
>final String ruleName = rule.getName();
>System.out.println("Activation created --> " +
> ruleName);
>rules.remove(rule);
>ruleNames.remove(ruleName);
>}
>
>
> but my output never show this. i only have Activation created printed in
> console. which rule is not executed, that is not printing at the time when
> it is not activated. Please have a look on this.  My output is
>
> Rules not executed
> - GoodBye-rule
> - Hello World-rule
> - Never fires
> Activation created --> Hello World-rule
> Hello World
> Activation created --> GoodBye-rule
> Goodbye cruel world
> Rules not executed
> - Never fires
>
>
> this is the same code which you sent me. Never fires is the rule which
> never gets executed. we print this from the list of rules we have when we
> load the rule file. even if i skip that activation canceled it prints the
> same result.
>
>
> thanks
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] KnowledgeAgent ChangeSet failing to reload resources

2010-11-04 Thread Fink, Eric [USA]
Greetings.  I am using Drools 5.1.1's KnowledgeAgent ChangeSet functionality 
and have come across an issue.

here is the use case:

Fire up the application with a valid DRL file. Works as designed.
Update the DRL file. ChangeSet senses updated file, KnowledgeBase is updated 
with updated rules, yadda, yadda. Works as designed.
Update the DRL file and introduce errors in the LHS of the rule. For example, I 
changed Sensor to Sccensor in the example below and $masterId is not defined. 
The following is reported as expected:

KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[2010:11:308 09:11:515:info] KnowledgeAgent performing an incremental build of 
the ChangeSet
[2010:11:308 09:11:843:debug] KnowledgeAgent has KnowledgeBuilder errors  
object=Unable to resolve ObjectType 'Sccensor' : [Rule name='18) sensorCount 
derived variable']
Rule Compilation error : [Rule name='18) sensorCount derived variable']
bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (7:590) : 
$masterID cannot be resolved
bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (8:624) : 
$masterID cannot be resolved
bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (9:769) : 
$masterID cannot be resolved

Update the DRL file to the previously working version. The ChangeSet never 
senses that the file has been updated. It just runs along checking every x 
seconds.

Has anyone experienced this? Is there a listener that should be firing 
somewhere? 

Thanks is advance.

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


[rules-users] Configure flow and rule persistence using Execution Server

2010-11-04 Thread raic


Hi,


I'm new to Drools and i'm searching for some information related to flow and
rules persistence. I'm using Guvnor and Execution Server (5.1).

My application connects to the Execution Server via REST using JSON
commands, and I have all rules and flows stored in Guvnor repository.

I found some interesting information about persistence in drools flow
documentation
(http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-flow/html_single/index.html#d0e1699),
but the problem is that I can't do it this way because I can't use this code
in my application for creating KnowledgeSessions because sessions are
defined in the Execution Server.

I assume that I have to define the Entity Manager and environment in
execution server configuration file knowledge-services.xml, but I'm not able
to find something related to it... :(

My knowledge-services.xml looks like this now:







 


  


Can someone help me?

Thanks in advance.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Configure-flow-and-rule-persistence-using-Execution-Server-tp1841598p1841598.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] Temporal operator before[1ms, oo] exhibtis strange behaviour

2010-11-04 Thread Michael Anstis
Hi Wolfgang,

I'd assume your assumption to be correct.

Cloud Mode's definition in the Fusion manual includes:-

"When running in CLOUD mode, the engine sees all facts in the working
memory, does not matter if they are regular facts or events, as a whole" and
"There is no notion of timeThere is no requirement on event ordering.
The engine looks at the events as an unnordered cloud against which the
engine tries to match rules"

So "before" has no meaning.

Edson will have to advise how CLOUD mode affects pattern matching and node
propagation though! My assumption, based on your results, is that patterns
including temporal operators are unmatched by default - but probably a
little more to it than that.

With kind regards,

Mike


2010/11/4 Wolfgang Laun 

> In STREAM mode, the clock may have to have advanced beyond the latest fact
> so
> that certain conditions can be evaluated safely.
>
> For instance, another event could still be inserted at the same
> millisecond. If
> a condition such as
>   not Event( this coincides $event )
> were evaluated prematurely, it would produce an incorrect result.
>
> Is this the explanation?
> -W
>
>
> On 4 November 2010 10:09, Wolfgang Laun  wrote:
>
>> The .drl:
>>
>> declare Leave
>>   @role( event )
>>   @timestamp( timestamp )
>> end
>>
>> rule "XXX Leave not !="
>> when
>> $leave: Leave()
>> not Leave( this != $leave )
>> then
>> System.out.println( "XXX only one Leave - not !=" );
>> end
>>
>> rule "YYY Leave not after"
>> when
>> $leave: Leave()
>> not Leave( this before $leave )
>> then
>> System.out.println( "YYY only one Leave - not before" );
>> end
>>
>>
>> A) The pseudo-clock is advanced according to the timestamp; then
>> exactly one event Leave is inserted; then fireAllRules() is called.
>>
>> 1) Running in CLOUD mode, both rules fire.
>> 2) But running in STREAM mode, ONLY rule XXX fires.
>>
>> B) Like A, but the session clock is advanced by (at least) 1ms
>> prior to calling fireAllRules().
>>
>> 3) Either mode, both rules fire.
>>
>> I think that A2) is incorrect; why should passing another msec change the
>> logic?
>>
>> JIRA?
>>
>> Wolfgang
>>
>>
>>
>>
>
> ___
> 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] Temporal operator before[1ms, oo] exhibtis strange behaviour

2010-11-04 Thread Wolfgang Laun
In STREAM mode, the clock may have to have advanced beyond the latest fact
so
that certain conditions can be evaluated safely.

For instance, another event could still be inserted at the same millisecond.
If
a condition such as
  not Event( this coincides $event )
were evaluated prematurely, it would produce an incorrect result.

Is this the explanation?
-W

On 4 November 2010 10:09, Wolfgang Laun  wrote:

> The .drl:
>
> declare Leave
>   @role( event )
>   @timestamp( timestamp )
> end
>
> rule "XXX Leave not !="
> when
> $leave: Leave()
> not Leave( this != $leave )
> then
> System.out.println( "XXX only one Leave - not !=" );
> end
>
> rule "YYY Leave not after"
> when
> $leave: Leave()
> not Leave( this before $leave )
> then
> System.out.println( "YYY only one Leave - not before" );
> end
>
>
> A) The pseudo-clock is advanced according to the timestamp; then
> exactly one event Leave is inserted; then fireAllRules() is called.
>
> 1) Running in CLOUD mode, both rules fire.
> 2) But running in STREAM mode, ONLY rule XXX fires.
>
> B) Like A, but the session clock is advanced by (at least) 1ms
> prior to calling fireAllRules().
>
> 3) Either mode, both rules fire.
>
> I think that A2) is incorrect; why should passing another msec change the
> logic?
>
> JIRA?
>
> Wolfgang
>
>
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Temporal operator before[1ms, oo] exhibtis strange behaviour

2010-11-04 Thread Wolfgang Laun
The .drl:

declare Leave
  @role( event )
  @timestamp( timestamp )
end

rule "XXX Leave not !="
when
$leave: Leave()
not Leave( this != $leave )
then
System.out.println( "XXX only one Leave - not !=" );
end

rule "YYY Leave not after"
when
$leave: Leave()
not Leave( this before $leave )
then
System.out.println( "YYY only one Leave - not before" );
end


A) The pseudo-clock is advanced according to the timestamp; then
exactly one event Leave is inserted; then fireAllRules() is called.

1) Running in CLOUD mode, both rules fire.
2) But running in STREAM mode, ONLY rule XXX fires.

B) Like A, but the session clock is advanced by (at least) 1ms
prior to calling fireAllRules().

3) Either mode, both rules fire.

I think that A2) is incorrect; why should passing another msec change the
logic?

JIRA?

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


Re: [rules-users] Marshalling Error : JBRULES-2453

2010-11-04 Thread Michael Anstis
If it's "impossible to debug *with* a test case" imagine how difficult it
must be without one!

;-)

On 4 November 2010 04:49, Mark Proctor  wrote:

> On 03/11/2010 15:01, drooRam wrote:
> > bump
> you'll need to make a minimal self contained test that removes
> everything but what is necessary to show the problem, then attach it as
> a jira. The marshalling stuff is very cryptic and impossible to debug
> with a test case.
>
> Mark
>
> ___
> 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