[rules-users] Import Error

2007-10-23 Thread Bhattacharya, Sougata

Hi All,
  I have class I could import that class in my java file but when I ma
trying to import that in drl file, I am getting error saying
ImportError

Any one has any idea;


Thanks
Sougata

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.


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


Re: [rules-users] Attribute activations vs object activations

2007-10-23 Thread Joshua Undesser

Mark,

Thank you for the quick response.I understand what you are saying in
terms of efficiency, the problem we have though is that the rule engine is
only one of many client applications to our system, and in terms of
injecting data into our system it is actually a very minor client at that.   
It is really the other clients that are doing the majority (95%) of the
creating, modifying, and deleting.   The rule engine we have set up is more
of a cautionary client that creates Alert objects to notify the users, using
other clients to our system, that something is wrong.   IE don't put a fox
in the same room as a chicken without a person, those types of things (but
obviously more complex than this).   As such, and since we are adhering to
the java bean event model, all modifications that come to our Drools client
are in the form of single value property change events.   That is why I was
using the dynamic ones.   Figured it was the same as me calling update after
every single update anyway.   What I could do though is set up a queue on my
Drools engine client that will store the external incoming property change
events and batch process them say every 2-5 seconds.   

I can see what you are saying though for batch commands, especially if the
right hand side of the rule is creating/modifying tons of objects (internal
drools events).In that case it would be most beneficial to do batch
processing because you are in control of the events.

Also thank you for the heads up on the slot-specific rule activations
functionality.I think this will definitely be a nice addition to the
Drools engine and I look forward to it's release! 

Thanks again!  

Joshua
  







Mark Proctor wrote:
 
 firstly I wouldn't recommend you use the dynamic update stuff its not 
 very efficient. its no less efficient than jess, but the principle 
 itslef is bad. The reason is because each field change results in a 
 notification to the engine, where as you really want to notify the 
 engine after a batch of changes to the instance.
 
 The feature I believe you are after is called slot-specific, so that 
 only fields which are constrained on pick up the notifications if those 
 fields have changed. This is not currently supported - sorry. Will 
 probably be in our next major release in Q1.
 
 Mark
 
 Joshua Undesser wrote:
 I am sorry if this has already been answered, I tried a few different 
 search
 combinations within this user forum and didn't find an answer.

 I am pretty new to Drools, but am no stranger to JESS and CLIPS.   We are
 currently looking at moving over our product implementations from JESS to
 DROOLS.   In looking at what it will take to do the conversion, and 
 working
 with a few sample systems, i've noticed that DROOLS doesn't seem to 
 support
 attribute activations, only object activations.What I mean by this is
 say that I have two rules.

 rule Rule 1
 when
$o : ObjectType (type == OBJECTTYPE.STATIC )
 then
System.out.println(ObjectType is Static);
 end

 rule Rule 2
 when
$o : ObjectType (active == false)
 then
System.out.println(ObjectType not active);
 end


 (My sample system is utilizing the default Drools 4.0 shadow fact 
 support so
 as an ObjectType object is created I am calling memory.insert(obj, 
 true) for
 dynamic updates.)

 If on external property change event occurs on an ObjectType:active
 attribute, both rules fire.  Which to me signifies that if any 
 attribute on
 the ObjectType object happens, all rules that contain ObjectType on 
 the LHS
 of the rule will be re-evaluated (not re-fired, but re-evaluated).  Now I
 realize these rules are simple and that I could code the rules in a 
 way to
 avoid them being fired, but non the less, they would still need to be
 evaluated to the point where the engine realizes it should run.   
 Instead,
 performance-wise, wouldn't it be more beneficial to only re-evaluate the
 rules that contain the attribute that changed that you are interested 
 in?   I.E.  In the above scenario, only RULE 2 would fire because rule 
 1 doesn't
 contain the attribute that changed.  
 The early versions of JESS did not support attribute activations (aka per
 slot activations), which was a major stumbling block.   However ever 
 since
 JESS 5.0, if I remember right, they've been included.  
 So I guess my question is, does DROOLS support attribute activations 
 and I
 am just blind?If Drools does not support this, is it scheduled to be
 supported in the future?   
 Thank you in advance!

 Joshua

 ___
 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: 

[rules-users] Jboss rules: or with binding issue?

2007-10-23 Thread Rahul Phadnis
I am using Jboss Rules 4.0.2 version.

I am trying to using or with binding. However the
following doesn't work
rule RulesTest
# the if part
activation-group  ActivationGroup1
salience 50
when
$eventType: EventType(id ==
Constants.EVENT_DEVCOM_ID) 
$result : Result()
$param  : Parameter($thresh:threshold)
  # difference exceeds threshold value and
it is still day time
context: (or DevContext(difference  $thresh,
dayTime == true) 
 DevContext(difference  $thresh, sleepy
== false, dayTime == false) ) 
  
then
# do something here

end

I get rule compilation errors:
SEVERE: CheckedDroolsException
org.drools.CheckedDroolsException: There were errors
in the rule source: [320,18]: unknown:320:18
mismatched token:
[EMAIL PROTECTED],12142:12143='or',34,320:18]; expecting type
ID[321,15]: unknown:321:15 mismatched token:
[EMAIL PROTECTED],12215:12227='DevContext',7,321:15]; expecting
type RIGHT_PAREN[321,86]: unknown:321:86 mismatched
token: [EMAIL PROTECTED],12286:12286=')',12,321:86]; expecting
type THEN
at
org.drools.compiler.RuleBaseLoader.makeRuleBase(RuleBaseLoader.java:6

Is this a known bug ?

I can work around by using the alternate syntax
suggested in the documentation which is:

or $context : DevContext(difference  $thresh, dayTime
== true) 
   $context : DevComContext(difference  $thresh,
sleepy == false, dayTime == false) ) 

Rahul.


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


[rules-users] DSL regex support

2007-10-23 Thread Adam Lewandowski
I just upgraded to 4.0.3 and want to take advantage of regex support for 
my DSL. Specifically, I want to be able to use a character class at the 
start of my expander expression to allow the first character to be case 
insensitive. For example (in the expander definition):


[when][Ff]act value is {value}= SomeFact( value == {value})

So that the rule could be written as Fact value is... or fact value 
is. But I think this conflicts with a syntax that the parser uses 
to add constraints to the previous declaration (according to the 
reference docs, section 6.7.4). If I try to use the same character class 
construct anywhere other than the first character it works fine.
Is there some escape sequence I can use to get what I'm looking for? 
Simply escaping the [ and ] with \ didn't work.


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


Re: [rules-users] infinite loop controlling

2007-10-23 Thread Mark Proctor
for individual rules you'd have to manage it yourself. there is a 
generic firelimit which can be applied, but it tracks all rules.

Paul Browne wrote:

Mark,

I'm interested in this (for another mad reason).

I'm guessing that you're refering to AgendaEventListener; Are you 
suggesting using an implementation of this listener that has a counter 
to check if a rule is fired too many times , then calls 
workingmemory.halt() if required?


Or is there a better way of doing this?

Thanks

Paul


Mark Proctor wrote:
There is no out of the box way to do this, you could add an event 
listener and check yourself for recursion and halt the session if it 
is spotted.


Mark
Isabelle Hupont wrote:

Hi!

I'm developing a software where the user creates his own rules, 
saves then,

and finally fires them in order to preprocess a set of data.
I have implemented a method for controlling infinite loops (its 
simply a

timer). I would like to notify to the user the rule that has caused the
infinite loop, in order to change it. My code is the following:

public void fireRules(Instances instances) {

try {
assertInstances(instances);

// Worker thread to execute task that may hang.
WorkerThread workerThread = new WorkerThread();

// Wait for timeout or task end.
synchronized (this) {
workerThread.start();
   try {
this.wait(6);
} catch (InterruptedException e) {
log.error(e.getLocalizedMessage(),e);
}
if (!workerThread.isWorkDone()) {
// If work is not done then 
workingMemory.fireAllRules()

// hasn't finished (the timeout has expired).
workingMemory.halt();
// Here comes the code for 
capturing

rule that has code the loop
throw new PersistenceException(Operation 
timeout. Please modify rule

XXX);
}
}

cleanWorkingMemory();
} catch (PersistenceException e) {
log.error(e.getLocalizedMessage(),e);
}
   log.debug(Rule firing finished);
}

private class WorkerThread extends Thread {
private boolean workDone = false;
   public boolean isWorkDone() {
synchronized (SingletonInferenceEngine.this) {
return workDone;
}
}
   public void run() {
workingMemory.fireAllRules();
synchronized (SingletonInferenceEngine.this) {
workDone = true;
SingletonInferenceEngine.this.notifyAll();
}
}
}

Can you help me?
Thanks in advance!
  



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



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





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


[rules-users] Drools 4.0.3 Released

2007-10-23 Thread Fernando Meyer
http://blog.athico.com/2007/10/drools-403-released.html

We just released Drools v4.0.3 http://labs.jboss.com/drools/downloads.html.
This is a minor release with a few improvements on existing features and
some bug fixes.

Release Notes - JBoss Drools - Version 4.0.3

We would like to really thanks all the contributors that helped on getting
this release out. From those contributing patches and docs, to those testing
and reporting bugs and providing feedback. The list is a bit long to post
all names here and I may incur in a mistake forgetting someone, so our open
public thank you to you all!

Follows the release notes.

Happy Drooling
Drools Team
Bug


   - [JBRULES-1264 http://jira.jboss.com/jira/browse/JBRULES-1264] -
   NPE at BaseObjectClassFieldExtractor.getLongValue with null fields
   - [JBRULES-1266 http://jira.jboss.com/jira/browse/JBRULES-1266] -
   Composite facts types (OR, AND) not rendering correctly
   - [JBRULES-1272 http://jira.jboss.com/jira/browse/JBRULES-1272] -
   DSL : String index out of range: -1
   - [JBRULES-1279 http://jira.jboss.com/jira/browse/JBRULES-1279] -
   Memory leak in release 4.0.2
   - [JBRULES-1281 http://jira.jboss.com/jira/browse/JBRULES-1281] -
   ExecutorService cannot be shared
   - [JBRULES-1282 http://jira.jboss.com/jira/browse/JBRULES-1282] -
   Problems uploading models etc. into the BRMS
   - [JBRULES-1283 http://jira.jboss.com/jira/browse/JBRULES-1283] -
   Unable to serialize rule base ( NotSerializableException:
   org.drools.base.FireAllRulesRuleBaseUpdateListener)
   - [JBRULES-1295 http://jira.jboss.com/jira/browse/JBRULES-1295] -
   DSL Mapping files does not support comments and empty lines

Feature Request

   - [JBRULES-1252 http://jira.jboss.com/jira/browse/JBRULES-1252] -
   DrlDumper does not dump import functions

Task

   - [JBRULES-1260 http://jira.jboss.com/jira/browse/JBRULES-1260] -
   Include eclipse JDT library in drools-eclipse IDE plugin
   - [JBRULES-1293 http://jira.jboss.com/jira/browse/JBRULES-1293] -
   Backport for Eclipse 3.3
   - [JBRULES-1294 http://jira.jboss.com/jira/browse/JBRULES-1294] -
   Upgrade to MVEL 1.2.10



-- 
Fernando Meyer http://fmeyer.org
JBoss Rules Core Developer
[EMAIL PROTECTED]
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rules firing with an update of another object

2007-10-23 Thread Fabrice Granzotto
Hi everybody!

Here is my code and my rule. The problem is that the rule doesn?t detect that
my item ?chocolate? contained in the container has moved to the
?office?.

I know that if I update the item instead the container it?s working, but I was
wondering if there is a solution to detect this movement by this way? Do you
have a solution?

Thanks!

***CODE ***
session = ruleBase.newStatefulSession();
Location kitchen=new Location(kitchen);
Location office=new Location(office);
Container container1=new Container(container1,kitchen);
session.insert(container1);
Item chocolate=new Item(chocolate, container1);
session.insert(chocolate);
session.fireAllRules();
//No rules fired = OK
container1.setLocation(office);
session.update(session.getFactHandle(container1), container1);
session.fireAllRules();
//Once again, no rules fired = Not OK... I want detect this movement

***RULE ***
rule An item is in the office
salience 0
when
$itemA : Item($cont : container, $cont.location.name==office)
then
System.out.println(item in office);
end
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rules firing with an update of another object

2007-10-23 Thread Edson Tirelli
   Hi Fabrice,

   That is how it is supposed to work... no automatic way of doing it in
another way.

   []s
   Edson

2007/10/23, Fabrice Granzotto [EMAIL PROTECTED]:

 Hi everybody!

 Here is my code and my rule. The problem is that the rule doesn?t detect
 that
 my item ?chocolate? contained in the container has moved to the
 ?office?.

 I know that if I update the item instead the container it?s working, but I
 was
 wondering if there is a solution to detect this movement by this way? Do
 you
 have a solution?

 Thanks!

 ***CODE ***
 session = ruleBase.newStatefulSession();
 Location kitchen=new Location(kitchen);
 Location office=new Location(office);
 Container container1=new Container(container1,kitchen);
 session.insert(container1);
 Item chocolate=new Item(chocolate, container1);
 session.insert(chocolate);
 session.fireAllRules();
 //No rules fired = OK
 container1.setLocation(office);
 session.update(session.getFactHandle(container1), container1);
 session.fireAllRules();
 //Once again, no rules fired = Not OK... I want detect this movement

 ***RULE ***
 rule An item is in the office
 salience 0
 when
 $itemA : Item($cont : container,
 $cont.location.name==office)
 then
 System.out.println(item in office);
 end
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users