[rules-users] How to write Drools rule basing on a changed property?

2011-11-09 Thread kapokfly
Requirement: 

1) 
 Rule 
 When
 Person.address.address1 is changed 
 THEN 

2) Ideally we should have 2 objects, 1 for the old person instance, the
other for the new person instance so contextually the LHS equals to
oldPerson.address.address1 != newPerson.address.address1. 

A properties change listener might not be the best solution as it might span
multiple calls and the property change could be done on the web layer which
is out of the JBoss Drools knowledge session. 

Ivan

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-changed-property-tp3492926p3492926.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to write Drools rule basing on a changed property?

2011-11-09 Thread Wolfgang Laun
The agent that is responsible for the address change must take care to
provide information about what it does. This could be done by creating an
UpdateEvent fact referencing the Person fact and indicating the attribute
(address). Or a listener reacts to the change and insert the UpdateEvent
fact.

Or you follow your ideally-we-should-have-2 idea.

-W



On 9 November 2011 09:29, kapokfly ivan.jiang...@foxmail.com wrote:

 Requirement:

 1)
 Rule
 When
 Person.address.address1 is changed
 THEN

 2) Ideally we should have 2 objects, 1 for the old person instance, the
 other for the new person instance so contextually the LHS equals to
 oldPerson.address.address1 != newPerson.address.address1.

 A properties change listener might not be the best solution as it might
 span
 multiple calls and the property change could be done on the web layer which
 is out of the JBoss Drools knowledge session.

 Ivan

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-changed-property-tp3492926p3492926.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

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


Re: [rules-users] Data Modeling for medical expert system

2011-11-09 Thread Davide Sottara
Hi Dirk,

you might want to take a look at this: 
http://www.jboss.org/tohu

This is an interesting but rather old project. We're also working on a
slightly refactored version here:
https://github.com/droolsjbpm/drools-chance/tree/master/drools-informer 

The project provides a dynamic question/answer framework and supports GUI
interfaces.

As for the /content/ of the questions, it seems that you need some medical
vocabulary. 
Hand-coding enum-equivalent lists may be an overwhelming task, depending on
how realistic 
your system has to be. We're dealing with similar problems in another
project, including the 
predictive modelling techniques for the actual inference. 
If you want to share thoughts, let me know.

Cheers
Davide


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Data-Modeling-for-medical-expert-system-tp3490855p3492965.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to write Drools rule basing on a changed property?

2011-11-09 Thread kapokfly
Thanks, when I am saying person address is changed, our app only concerns
about its initial value and its final value, any change in the middle, we
don't care. 

Examples: 
   person.address.address1 starts with 'my addr1'
   
   later a couple of changes were made, say its final value is 'my addr1',
we treat it as no change and no middle rules should be fired. 

Even for the 2 objects approach, how I can write the rules to get the old
and new object matched correctly? 

They are both Person instances without any identity to tell which one is the
old which one is the new one, unless I enable some kinds of map/or list in
the rule and one structure to host only new objects and the other one hosts
only the old values?



--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-changed-property-tp3492926p3492979.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Issues with Eclipse Excel Plugin for Drools Decision Tables

2011-11-09 Thread Vincent LEGENDRE
Don't use eclipse to edit Excel files. Use Excel. I've never managed to make 
this OLE editor works well (but it is a long long time I did not retry, 
although I don't think there is any major evolution of this editor since then) .
You can instruct Eclipse to use Excel to edit your .xls files (see 
configuration of File Types in WindowPreferences), or rigth-click + open with 
system editor.
The only thing to remember is to refresh your project if the Excel file is in a 
source folder.

But the OLE Excel Eclipse editor is not a part of drools plugin (not sure your 
question should be here). You can find dozen of OLE editor for Eclipse on the 
net, if you really want to charge you with problems ...

- Mail original -

De: Schlüter Dr. Andreas andreas.schlue...@cirquent.de
À: rules-users@lists.jboss.org
Envoyé: Mardi 8 Novembre 2011 19:43:27
Objet: [rules-users] Issues with Eclipse Excel Plugin for Drools Decision Tables



Hi all,

I am trying out Drools with JBoss Tooling in Eclipse. Actually, much of it does 
not work for me, but since there were not many complaints about that, I think 
it must be due to my missing experience. But now I have a couple of things that 
seem like bugs to me. (BTW, I mainly use Eclipse 3.7, but I also installed 3.6 
to see whether anything is better with that - which generally it isn't. I 
upgraded Jboss tools to one of the newest nightly builds which I do not like, 
but only that solved the issue that the rules language dialects could not be 
found. I am using drools 5.2.0)

I gave up on the Audit trail which always said The selected audit log is 
empty... (but it isn't and this should have been resolved two years ago 
according to some mails, but I simply avoid using that view).

What bothers me most is that the Excel Plugin shows really erratic behavior in 
my Eclipse (both versions of eclipse). It opens the Excel file once (I 
converted to Excel 2003 (*.xls) from my newer version), but on the second time 
it says Cannot create the in-place editor Reason: This is probably because 
there is no OLE editor registered against the type of file you were trying to 
access Details say: File does not exist, is not accessible to user or does not 
have the correct format. result=-2147287008.) Sometimes later on it will work 
again, sometimes it won't and Excel complains about another Application needing 
to complete its OLE requests (until I shut it down using task manager since 
there is no alternative since it does not accept any input anymore). Sometimes 
even saving changes fails, leaving a corrupt file. Is that common behavior that 
others experience as well or is it just a local configuration issue? (Usually, 
I have no issues with my installation and I am not aware of configuring 
anything apart from using the Eclipse update sites.)

Thanks in advance for any hints,

Andreas


___
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] Data Modeling for medical expert system

2011-11-09 Thread Dirk Conzelmann
 Hi Davide and the other users too,

 thank you all for your interesting links. I´ll think
 that 'tohu' really seams the solution for that problem.

 I think it is rather interesting that after spending
 my first weeks on Drools reading the documentation
 I never saw any link pointing to 'tohu'. :)

 Thanks very much, I´ll share my experiences.

 Despite from being interested in this aproach,
 I have to adjust my tasks for being able
 to finish my Bachelor Thesis in the given amount of time.


 On Wed, 9 Nov 2011 00:53:18 -0800 (PST), Davide Sottara wrote:
 Hi Dirk,

 you might want to take a look at this:
 http://www.jboss.org/tohu

 This is an interesting but rather old project. We're also working on 
 a
 slightly refactored version here:
 
 https://github.com/droolsjbpm/drools-chance/tree/master/drools-informer

 The project provides a dynamic question/answer framework and 
 supports GUI
 interfaces.

 As for the /content/ of the questions, it seems that you need some 
 medical
 vocabulary.
 Hand-coding enum-equivalent lists may be an overwhelming task, 
 depending on
 how realistic
 your system has to be. We're dealing with similar problems in another
 project, including the
 predictive modelling techniques for the actual inference.
 If you want to share thoughts, let me know.

 Cheers
 Davide


 --
 View this message in context:
 
 http://drools.46999.n3.nabble.com/rules-users-Data-Modeling-for-medical-expert-system-tp3490855p3492965.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

-- 
 Dirk Conzelmann

   IT-Services

   Telefon: +49.179.2237995
   Email:   i...@dirk-conzelmann.de
   Web: www.dirk-conzelmann.de
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Data Modeling for medical expert system

2011-11-09 Thread Dirk Conzelmann
 Hi Bruno,

 On Tue, 08 Nov 2011 18:46:45 +0100, Bruno Freudensprung wrote:
 Hi Dirk,

 Good to see that I am not the only one fighting with that question 
 :-).
 I guess the general answer is: it depends on how large your enums
 might grow.

 For instance if your application is eventually supposed to help
 diagnosing (say) all MeSH diseases based on all MeSH symptoms, then 
 an
 approach where every symptom and disease is a Java class is not an
 option; this would lead to so many classes that I doubt Drools user
 interface will handle that, or will be useful anyway (drop-down lists
 with thousands of items).
 Yes, Exactly!


 The opposite approach consists in creating a few root Java classes
 like (say) Disease and Symptom and to store the MeSH hierarchy into a
 name attribute.
 The obvious drawback of the approach is that when your end-users will
 have to write the rules, they will be left with problems like:

 when
  Symptom(name == well... what's the name of this MeSH 
 category??)
 then
  Disease(name == hmmm... can't remember the exact name of the
 disease as normalized in MeSH...)
 end

 hehe yes, yes :)


 I've posted a message on this topic (subject: Thoughts about rule
 authoring) and Michael Anstis kindly suggested a technical answer. I 
 am
 afraid it did not fit my needs, but it could fit yours :-).
 Ok, i'll search for that later.


 For the moment I have no solution (like an intermediate approach) to 
 my
 problem: I am stuck with approach #2.
 I have the impression that my problem requires a very tight 
 integration
 between my database (MeSH) and the Drools suggestion engine.

 If you have another approach, I would love to know it ;-).
 Yes, i'll let you know. btw. i received a pretty interesting message 
 from 'davide'
 a few moments ago.

  http://www.jboss.org/tohu
  
 https://github.com/droolsjbpm/drools-chance/tree/master/drools-informer

 Maybe this will help you too :)


 Best regards,

 Bruno.

 Le 08/11/2011 17:43, Dirk Conzelmann a écrit :
   Hi everybody,

   I am using Drools as a part of my Bachelor Thesis.
   My job is to build an expert system for medical diagnoses.

   My Question:
   Is there a best practice known in modeling a variable
   list of questions and answers in Drools?


   Up to now I modeled the list of questions implementing
   Java Classes and Enums for each question/answer pair.

   But to be able to change those options easyly I need
   a higher abstraction level than simple Java Classes and Enums.


   Could someone show me an example how to implement this?


   I hope I have explained my question understandable :)



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

-- 
 Dirk Conzelmann

   IT-Services

   Telefon: +49.179.2237995
   Email:   i...@dirk-conzelmann.de
   Web: www.dirk-conzelmann.de
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Human Task - ERROR : JPAKnowledgeService.newStatefulKnowledgeSession ...

2011-11-09 Thread S.M.H.Jamali
Hello all,

I get an exception while last line of below method executed : 


    public StatefulKnowledgeSession createSession() throws Exception {
        
        /*
         * Create the knowledgebase using the required bpmn and drl files
         */
        KnowledgeBase kbase = readKnowledgeBase(HumanTask.bpmn);
        EntityManagerFactory emf = Persistence.createEntityManagerFactory( 
org.jbpm.persistence.jpa );
        Environment env = KnowledgeBaseFactory.newEnvironment();
        env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
        env.set( EnvironmentName.TRANSACTION_MANAGER, 
TransactionManagerServices.getTransactionManager() );
        env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() );
        
        Properties properties = new Properties();
        properties.put(drools.processInstanceManagerFactory, 
org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory);
        properties.put(drools.processSignalManagerFactory, 
org.jbpm.persistence.processinstance.JPASignalManagerFactory);
        KnowledgeSessionConfiguration config = 
KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
    
        return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, 
env);
            
    }

 
its stack-trace is : 

14:26:13,111 WARN  [JtaTransactionManager] Participating in existing JTA 
transaction, but no JTA TransactionManager or TransactionSychronizationRegistry 
available: 
java.lang.NullPointerException
    at 
org.drools.persistence.jta.JtaTransactionManager.registerTransactionSynchronization(JtaTransactionManager.java:221)
    at 
org.drools.persistence.SingleSessionCommandService.registerRollbackSync(SingleSessionCommandService.java:333)
    at 
org.drools.persistence.SingleSessionCommandService.init(SingleSessionCommandService.java:123)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)...

Can anyone help me to solve this problem ?
Thanks in advance
S.M.H.Jamali___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to write Drools rule basing on a changed property?

2011-11-09 Thread Wolfgang Laun
It seems that this is more of a technical problem on the Java side: how to
register the fact that a certain property of an element has changed. You'll
need somthing like a clone method.

The old version of Person need and should not remain in Working Memory, but
a simple wrapper fact referencing to the cloned Person object (not a fact!)
would be required. Then you might do

   Person( $adress: adress )
   Wrapper( $person: person, eval( $adress != $person.getAddress() ) )

-W






On 9 November 2011 09:57, kapokfly ivan.jiang...@foxmail.com wrote:

 Thanks, when I am saying person address is changed, our app only concerns
 about its initial value and its final value, any change in the middle, we
 don't care.

 Examples:
   person.address.address1 starts with 'my addr1'

   later a couple of changes were made, say its final value is 'my addr1',
 we treat it as no change and no middle rules should be fired.

 Even for the 2 objects approach, how I can write the rules to get the old
 and new object matched correctly?

 They are both Person instances without any identity to tell which one is
 the
 old which one is the new one, unless I enable some kinds of map/or list in
 the rule and one structure to host only new objects and the other one hosts
 only the old values?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-changed-property-tp3492926p3492979.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

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


Re: [rules-users] Bugs in Drools 5.3.0 break Fusion event processing

2011-11-09 Thread Edson Tirelli
   Richard,

   This is great info. Yes, please open JIRA's for all 3 issues and we will
make sure this is fixed for the next release.

   Thank you,
   Edson

2011/11/9 Richard Calmbach rcalm...@gmail.com

 I am making extensive use of the event processing features of the Drools
 rule engine. Upgrading from Drools 5.2.0.Final to Drools 5.3.0.Final broke
 47 of my unit tests and also broke my functional tests. There seem to be
 multiple changes in Drools 5.3.0 that cause incorrect behavior and/or break
 backward compatibility. Here are the results of my investigation so far.

 Issue F1:
 While tracking down the failures of my unit tests, I experimented with the
 Broker example, and while probably not finding the root cause of the broken
 unit tests, I nonetheless came across what clearly seems to be incorrect
 behavior in the DefaultTimerJobInstance.call() method. The bug only reveals
 itself after all input has been processed, so it is masked by the fact that
 running the Broker demo through the entire sequence in stocktickstream.dat
 (1100 lines) takes a long time. In order to reveal the problem more
 quickly, run the demo with only the first 14 lines in stocktickstream.dat.
 Do so for both the 5.2.0 Broker demo (against Drools 5.2.0) and the 5.3.0
 Broker demo (against Drools 5.3.0). The Broker example code in both
 versions is identical, so only the Drools-internal code changes matter.

 When running the 5.2.0 Broker demo to the end, you get one
 java.text.ParseException (given the structure of the example code, that's
 expected, albeit not elegant, and not the focus of our investigation). In
 particular, no matter how many lines stocktickstream.dat contains, you
 always get exactly one ParseException at the end.

 Contrast this with running the 5.3.0 Broker demo: At the end you get N
 occurrences of java.text.ParseException, where N is the number of lines in
 stocktickstream.dat. So for 14 lines you get 14 occurrences of
 ParseException. Looking at two specific methods shows us why:

 Method
 org.drools.examples.broker.events.EventFeeder.FeedJob.execute(JobContext):

 public void execute(JobContext context) {
 this.sink.receive( ((FeedContext) context).event );
 if ( this.source.hasNext() ) {
 ((FeedContext) context).setEvent( this.source.getNext() );
 this.trigger.setNextFireTime( ((FeedContext)
 context).getEvent().getDate() );
 clock.scheduleJob( this,
context,
trigger );
 }
 }

 Note in particular how this method already takes care of scheduling the
 next job execution by updating the next fire time of the job's existing
 FeedTrigger instance. Unfortunately, in Drools 5.3.0,
 DefaultTimerJobInstance.call() does a duplicate scheduling of the same job:

 Method org.drools.time.impl.DefaultTimerJobInstance.call():

 public Void call() throws Exception {
 this.trigger.nextFireTime(); // need to pop
 if ( handle.isCancel() ) {
 return null;
 }
 this.job.execute( this.ctx );
 if ( handle.isCancel() ) {
 return null;
 }

 // our triggers allow for flexible rescheduling
 Date date = this.trigger.hasNextFireTime();
 if ( date != null ) {
 scheduler.internalSchedule( this );
 }

 return null;
 }


 So, every job is duplicated and that's why there are 2*N calls to
 org.drools.examples.broker.events.StockTickPersister.load() instead of N.

 I think the rescheduling inside DefaultTimerJobInstance.call() is
 incorrect. For one, it breaks backward compatibility, and it is unexpected.
 The job should be in charge of deciding whether there is another job to
 schedule or what to do. Implicitly scheduling the next job just by updating
 the trigger time is a little too much magic.

 Issue F2:
 This is the bug that causes my unit tests to fail. I have not pinpointed
 the root cause, but it seems to have to do with the event scheduling Drools
 does as part of its job execution mechanism. Its symptom is a
 NullPointerException during insertion of an event. What makes it so tricky
 is that with the out-of-the-box configuration, Drools catches such
 exceptions in org.drools.time.impl.PseudoClockScheduler.runCallBacks() and
 passes them to the aptly named DoNothingSystemEventListener, which
 literally does nothing, not so much as logging (the methods are empty). So
 you don't actually know that the event insertion failed, you only wonder
 why your mock WorkingMemoryEventListener is telling you that your
 expectations are not met. The stack trace (as copied from the Eclipse Debug
 view, hence the unusual formatting) inside Drools is:

 Date.getMillisOf(Date) line: 939
 Date.compareTo(Date) line: 959
 DefaultTimerJobInstance.compareTo(DefaultTimerJobInstance) line: 38
 DefaultTimerJobInstance.compareTo(Object) line: 13
 

[rules-users] variables confusion Java/MVEL

2011-11-09 Thread elsdestickere
Hi,

I'm confused about when en where to use Java or MVEL in a rule.
In the example below I want to replace  
openRes.getMasterExemplaar().getBruikbareExemplaren() with a variable. 
RHD: works with JAva expression:
ListExemplaar bruikEx =
openRes.getMasterExemplaar().getBruikbareExemplaren();
but I prefer to create the variable in the LHS, but Java doesn't work here.
Should this be a MVEL expression or should JAVA allways be possible?

rule GarandeerReservaties
when
garRes : GarandeerReservatieTaak();
openRes : Reservatie() from
repFact.getReservatieRepository().findVandaagOpenstaandeReservaties();
 ListExemplaar bruikEx
=openRes.getMasterExemplaar().getBruikbareExemplaren();
   eval(Reservatie.getVandaagOpenstaandeReservaties().size()  0 
openRes.getMasterExemplaar().getBruikbareExemplaren().size() != 0) 
then
//ListExemplaar bruikEx =
openRes.getMasterExemplaar().getBruikbareExemplaren();
bruikEx.get(0).setStatus(ExemplaarStatus.MOMENTEEL_GERESERVEERD);
openRes.setStatus(ReservatieStatus.GEGARANDEERD);
System.out.println( Drools +drools.getRule().getName()+: ocr:
+openRes.getAantalVandaagOpenstaandeConcurReservaties() +  bruikex: 
+bruikEx.size() );
end 
(written in Dutch, but I think it will be ok to understand)
br,
Els

--
View this message in context: 
http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632p3493632.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Bugs in Drools 5.3.0 break Fusion event processing

2011-11-09 Thread Vincent LEGENDRE
Just wondering : does these problems happends because you use clocks and jobs, 
or is it general to fusion 5.3 ?
Did not migrate my project on 5.3 for now.
So do you think there is a risk, knowing that I only use very basic fusion 
features ?

- Mail original -

De: Edson Tirelli ed.tire...@gmail.com
À: Rules Users List rules-users@lists.jboss.org
Envoyé: Mercredi 9 Novembre 2011 14:53:00
Objet: Re: [rules-users] Bugs in Drools 5.3.0 break Fusion event processing



Richard,


This is great info. Yes, please open JIRA's for all 3 issues and we will make 
sure this is fixed for the next release.


Thank you,
Edson


2011/11/9 Richard Calmbach  rcalm...@gmail.com 



I am making extensive use of the event processing features of the Drools rule 
engine. Upgrading from Drools 5.2.0.Final to Drools 5.3.0.Final broke 47 of my 
unit tests and also broke my functional tests. There seem to be multiple 
changes in Drools 5.3.0 that cause incorrect behavior and/or break backward 
compatibility. Here are the results of my investigation so far.


Issue F1:
While tracking down the failures of my unit tests, I experimented with the 
Broker example, and while probably not finding the root cause of the broken 
unit tests, I nonetheless came across what clearly seems to be incorrect 
behavior in the DefaultTimerJobInstance.call() method. The bug only reveals 
itself after all input has been processed, so it is masked by the fact that 
running the Broker demo through the entire sequence in stocktickstream.dat 
(1100 lines) takes a long time. In order to reveal the problem more quickly, 
run the demo with only the first 14 lines in stocktickstream.dat. Do so for 
both the 5.2.0 Broker demo (against Drools 5.2.0) and the 5.3.0 Broker demo 
(against Drools 5.3.0). The Broker example code in both versions is identical, 
so only the Drools-internal code changes matter.


When running the 5.2.0 Broker demo to the end, you get one 
java.text.ParseException (given the structure of the example code, that's 
expected, albeit not elegant, and not the focus of our investigation). In 
particular, no matter how many lines stocktickstream.dat contains, you always 
get exactly one ParseException at the end.


Contrast this with running the 5.3.0 Broker demo: At the end you get N 
occurrences of java.text.ParseException, where N is the number of lines in 
stocktickstream.dat. So for 14 lines you get 14 occurrences of ParseException. 
Looking at two specific methods shows us why:


Method 
org.drools.examples.broker.events.EventFeeder.FeedJob.execute(JobContext):


public void execute(JobContext context) {
this.sink.receive( ((FeedContext) context).event );
if ( this.source.hasNext() ) {
((FeedContext) context).setEvent( this.source.getNext() );
this.trigger.setNextFireTime( ((FeedContext) context).getEvent().getDate() );
clock.scheduleJob( this,
context,
trigger );
}
}


Note in particular how this method already takes care of scheduling the next 
job execution by updating the next fire time of the job's existing FeedTrigger 
instance. Unfortunately, in Drools 5.3.0, DefaultTimerJobInstance.call() does a 
duplicate scheduling of the same job:


Method org.drools.time.impl.DefaultTimerJobInstance.call():


public Void call() throws Exception {
this.trigger.nextFireTime(); // need to pop
if ( handle.isCancel() ) {
return null;
}
this.job.execute( this.ctx );
if ( handle.isCancel() ) {
return null;
}


// our triggers allow for flexible rescheduling
Date date = this.trigger.hasNextFireTime();
if ( date != null ) {
scheduler.internalSchedule( this );
}


return null;
}




So, every job is duplicated and that's why there are 2*N calls to 
org.drools.examples.broker.events.StockTickPersister.load() instead of N.


I think the rescheduling inside DefaultTimerJobInstance.call() is incorrect. 
For one, it breaks backward compatibility, and it is unexpected. The job should 
be in charge of deciding whether there is another job to schedule or what to 
do. Implicitly scheduling the next job just by updating the trigger time is a 
little too much magic.


Issue F2:
This is the bug that causes my unit tests to fail. I have not pinpointed the 
root cause, but it seems to have to do with the event scheduling Drools does as 
part of its job execution mechanism. Its symptom is a NullPointerException 
during insertion of an event. What makes it so tricky is that with the 
out-of-the-box configuration, Drools catches such exceptions in 
org.drools.time.impl.PseudoClockScheduler.runCallBacks() and passes them to the 
aptly named DoNothingSystemEventListener, which literally does nothing, not 
so much as logging (the methods are empty). So you don't actually know that the 
event insertion failed, you only wonder why your mock 
WorkingMemoryEventListener is telling you that your expectations are not met. 
The stack trace (as copied from the Eclipse Debug view, hence the unusual 
formatting) inside Drools is:


Date.getMillisOf(Date) line: 939

Re: [rules-users] variables confusion Java/MVEL

2011-11-09 Thread Wolfgang Laun
You cannot create variables on the Left Hand Side; there you can only bind
(!)
variable names (!) to matched facts or their attributes.
-W

On 9 November 2011 15:14, elsdestickere elsdestick...@yahoo.com wrote:

 Hi,

 I'm confused about when en where to use Java or MVEL in a rule.
 In the example below I want to replace  
 openRes.getMasterExemplaar().getBruikbareExemplaren() with a variable.
 RHD: works with JAva expression:
ListExemplaar bruikEx =
 openRes.getMasterExemplaar().getBruikbareExemplaren();
 but I prefer to create the variable in the LHS, but Java doesn't work here.
 Should this be a MVEL expression or should JAVA allways be possible?

 rule GarandeerReservaties
when
garRes : GarandeerReservatieTaak();
openRes : Reservatie() from
 repFact.getReservatieRepository().findVandaagOpenstaandeReservaties();
 ListExemplaar bruikEx
 =openRes.getMasterExemplaar().getBruikbareExemplaren();
   eval(Reservatie.getVandaagOpenstaandeReservaties().size()  0 
 openRes.getMasterExemplaar().getBruikbareExemplaren().size() != 0)
then
//ListExemplaar bruikEx =
 openRes.getMasterExemplaar().getBruikbareExemplaren();
bruikEx.get(0).setStatus(ExemplaarStatus.MOMENTEEL_GERESERVEERD);
openRes.setStatus(ReservatieStatus.GEGARANDEERD);
System.out.println( Drools +drools.getRule().getName()+: ocr:
 +openRes.getAantalVandaagOpenstaandeConcurReservaties() +  bruikex: 
 +bruikEx.size() );
 end
 (written in Dutch, but I think it will be ok to understand)
 br,
 Els

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632p3493632.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

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


[rules-users] newbie: Can rules planner provide me with the single-steps to the optimal binpacking solution ?

2011-11-09 Thread Itai Frenkel
Hello,

I would like to solve a 2D binpacking problem. I have an existing bin-packing 
solution and would like to make it more optimized. Each change (movement of 
items between bins) has a certain cost, and I would like to have a list of the 
least-cost path. There is more than one solution that is optimal.

Given an existing bin-packing solution I can tell if it is the optimal 
solution, and if not I can have a gross estimate to the distance to the optimal 
solution (although it is not guaranteed to be less than the actual distance).

It sounds to me that I need something like the A-Star algorithm. Can Drools 
help me in solving this problem ?

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


Re: [rules-users] Issues with Eclipse Excel Plugin for Drools Decision Tables

2011-11-09 Thread Andreas Schlüter
Thanks for the feedback, I'll do it as you propose (although it is convenient
for debugging the decision table to be able to stay in Eclipse). 
It looked to me as if it were part of the drools tooling since the editor
opened up directly after creation of the decision table using the drools
plugin, but you are right, it is probably not an issue of the JBoss tool
itself.

Andreas 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Issues-with-Eclipse-Excel-Plugin-for-Drools-Decision-Tables-tp3491115p3493768.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rule Flow: Diverge/Converge Issue with one-to-many paths being exected

2011-11-09 Thread dcrissman
Drools Version: 5.1 (We are looking into upgrading, but not an option at this
time)

I have need of a rule flow that will allow a diverge on one-to-many paths
and then converge and continue on only once the paths that were executed
have all finish.

Say I have path A, B,  C. The constraints on the diverge node indicate that
A  C should be executed simultaneously, but B should not. Then the converge
node should wait for A and C to finish, but not care about B as it was not
executed by the diverge.

Initial attempt was to use Diverge(OR) and Converge(AND). The problem is
that the Converge (I think) waits on B indefinitely and so the process exits
out with no error message.

It looks like n-of-m is kind of what I want, except I have no way to know
how many paths the Diverge kicked off.

Any thoughts on how this could be done?

Much Appreciated!

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Flow-Diverge-Converge-Issue-with-one-to-many-paths-being-exected-tp3493775p3493775.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule Flow: Diverge/Converge Issue with one-to-many paths being exected

2011-11-09 Thread Swindells, Thomas
Can you split it into two separate diverges?
Diverge to B first and always follow the other path which then does the A  C,
Similarly at the other end wait for A C and then a second wait to add in the 
condition for B.

Thomas

 -Original Message-
 From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
 boun...@lists.jboss.org] On Behalf Of dcrissman
 Sent: 09 November 2011 15:05
 To: rules-users@lists.jboss.org
 Subject: [rules-users] Rule Flow: Diverge/Converge Issue with one-to-many
 paths being exected

 Drools Version: 5.1 (We are looking into upgrading, but not an option at this
 time)

 I have need of a rule flow that will allow a diverge on one-to-many paths and
 then converge and continue on only once the paths that were executed
 have all finish.

 Say I have path A, B,  C. The constraints on the diverge node indicate that A
  C should be executed simultaneously, but B should not. Then the converge
 node should wait for A and C to finish, but not care about B as it was not
 executed by the diverge.

 Initial attempt was to use Diverge(OR) and Converge(AND). The problem is
 that the Converge (I think) waits on B indefinitely and so the process exits
 out with no error message.

 It looks like n-of-m is kind of what I want, except I have no way to know how
 many paths the Diverge kicked off.

 Any thoughts on how this could be done?

 Much Appreciated!

 --
 View this message in context: http://drools.46999.n3.nabble.com/Rule-Flow-
 Diverge-Converge-Issue-with-one-to-many-paths-being-exected-
 tp3493775p3493775.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


**
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.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

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


Re: [rules-users] Rule Flow: Diverge/Converge Issue with one-to-many paths being exected

2011-11-09 Thread dcrissman

Swindells, Thomas wrote:
 
 Can you split it into two separate diverges?
 Diverge to B first and always follow the other path which then does the A
  C,
 Similarly at the other end wait for A C and then a second wait to add in
 the condition for B.
 
 Thomas
 

I am not sure I entirely follow your suggestion. A, B,  C could fire in any
combination, but always at least one.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Flow-Diverge-Converge-Issue-with-one-to-many-paths-being-exected-tp3493775p3493884.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] newbie: Can rules planner provide me with the single-steps to the optimal binpacking solution ?

2011-11-09 Thread Geoffrey De Smet

Drools Planner can solve this problem for you.
Here's a presentation that shows the code for a 3D bin packing problem:
  
http://www.slideshare.net/ge0ffrey/judcon-london-2011-bin-packing-with-drools-planner-by-example
To try it yourself, download the planner zip and run the example 
CloudBalance.


Note that A* can't solve bin packing in scalable manner, because bin 
packing is np complete.
Each change (movement of items between bins) has a certain cost, and I 
would like to have a list of the least-cost path.
The roaddef2012 machinereassignement example (new on master) has the 
same problem.
The trick is that each Assignment holds the time, changeCost, the 
originalBin and the newBin. The newBin is the planning variable.
Then just add score rules that add the changeCost to the score when 
originalBin != newBin.


Op 09-11-11 15:45, Itai Frenkel schreef:


Hello,

I would like to solve a 2D binpacking problem. I have an existing 
bin-packing solution and would like to make it more optimized. Each 
change (movement of items between bins) has a certain cost, and I 
would like to have a list of the least-cost path. There is more than 
one solution that is optimal.


Given an existing bin-packing solution I can tell if it is the optimal 
solution, and if not I can have a gross estimate to the distance to 
the optimal solution (although it is not guaranteed to be less than 
the actual distance).


It sounds to me that I need something like the A-Star algorithm. Can 
Drools help me in solving this problem ?


Thanks,

Itai


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


--
With kind regards,
Geoffrey De Smet

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


Re: [rules-users] Rule Flow: Diverge/Converge Issue with one-to-many paths being exected

2011-11-09 Thread FrankVhh
Hi,

I do not reallt know whether there is a native way in jBPM to implement the
m out of n-case you are describing. Anyway, imho, the easiest way to
roundtrip this is probably this:

Create a series of simple decision gateways: If(A has to execute), fire A;
else do nothing; If (B has to execute); fire B; else do nothing;...
Each time a task is not to be execute, the token will follow an empty
path. You can use the or convergence to join the branches together again and
lead them to the next divergence.

Hope this helps.

Regards,
Frank 


dcrissman wrote:
 
 
 Swindells, Thomas wrote:
 
 Can you split it into two separate diverges?
 Diverge to B first and always follow the other path which then does the A
  C,
 Similarly at the other end wait for A C and then a second wait to add in
 the condition for B.
 
 Thomas
 
 
 I am not sure I entirely follow your suggestion. A, B,  C could fire in
 any combination, but always at least one.
 


--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Flow-Diverge-Converge-Issue-with-one-to-many-paths-being-exected-tp3493775p3493922.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to write Drools rule basing on a changed property?

2011-11-09 Thread kapokfly
Yes, that is a Map base approach I am thinking. 

Now more questions:
 
global MapObject, Object oldObjectContext

WHEN
  $person: Person() 
  eval(((Person)oldObjectContext[$name]).jobTitle == $person.name)
THEN

Q1: without eval, the compiler will report error
Q2: without type cast, the compiler will also report error

Any suggestion how we can make it easier? 

Thanks...

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-write-Drools-rule-basing-on-a-changed-property-tp3492926p3493956.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] rule does not fire at first event

2011-11-09 Thread ukriegel
Hi there,
we use drools fusion 5.3. Final.
In a drl-file, a fact and an event and the following rules are declared

package ... etc

declare ActivityState
@role(fact)
state : StateType
end


rule set initial state
dialect java
salience 100
when not (exists KFActivityState())
then
ActivityState $actState = new ActivityState();
$actState.setState(StateType.STANDBY);
insert($actState);  
System.out.println(ActivityState inserted + new Date());
end




declare Command
@role (event)
end


rule request information
dialect java
when Command(commandType == CommandType.REQUEST_INFORMATION) from
entry-point XXX
 $s: ActivityState(state == ComponentStateType.ACTIVE||state ==
ComponentStateType.PASSIVE||state == ComponentStateType.STANDBY)
then
 System.out.println(Send Report);
end


The rule request information doesn't fire with the first command event, but
from the second one it fires always.

What's wrong with my code?

Thanks in advance

Ulrich

--
View this message in context: 
http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp3494056p3494056.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Security test cases for Drools

2011-11-09 Thread kapokfly
Not sure if anyone can share their experiences what kind of test cases on
Drools security should be developed and ensured? 

As the rule is just a piece of codes in String format which can be hooked
into JVM, we can assume that might open some holes and necessary security
test cases need to be designed against. 

Anyone can share their experiences on this? 

Thanks... 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Security-test-cases-for-Drools-tp3494072p3494072.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] integrate guvnor UI into your own application

2011-11-09 Thread kapokfly
Anyone tried to integrate the guvnor UI into your own application? 

Basically we want to have a integrated, uniformed UI with our application
rather than a separate one like Drools Guvnor does...

--
View this message in context: 
http://drools.46999.n3.nabble.com/integrate-guvnor-UI-into-your-own-application-tp3494093p3494093.html
Sent from the Drools: User forum mailing list archive at Nabble.com.

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


Re: [rules-users] Human Task - ERROR : JPAKnowledgeService.newStatefulKnowledgeSession ...

2011-11-09 Thread Mauricio Salatino
You will need to solve that problem. looks like a configuration problem,
can you share the persistence.xml file? did you configure persistence with
JTA?
Cheers

2011/11/9 S.M.H.Jamali cpp...@yahoo.com

 Hello all,

 I get an exception while last line of below method executed :

 public StatefulKnowledgeSession createSession() throws Exception {

 /*
  * Create the knowledgebase using the required bpmn and drl files
  */
 KnowledgeBase kbase = readKnowledgeBase(HumanTask.bpmn);
 EntityManagerFactory emf = Persistence.createEntityManagerFactory(
 org.jbpm.persistence.jpa );
 Environment env = KnowledgeBaseFactory.newEnvironment();
 env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
 env.set( EnvironmentName.TRANSACTION_MANAGER,
 TransactionManagerServices.getTransactionManager() );
 env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() );

 Properties properties = new Properties();
 properties.put(drools.processInstanceManagerFactory,
 org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory);
 properties.put(drools.processSignalManagerFactory,
 org.jbpm.persistence.processinstance.JPASignalManagerFactory);
 KnowledgeSessionConfiguration config =
 KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);

 return JPAKnowledgeService.newStatefulKnowledgeSession(kbase,
 config, env);

 }

 its stack-trace is :

 14:26:13,111 WARN  [JtaTransactionManager] Participating in existing JTA
 transaction, but no JTA TransactionManager or
 TransactionSychronizationRegistry available:
 java.lang.NullPointerException
 at
 org.drools.persistence.jta.JtaTransactionManager.registerTransactionSynchronization(JtaTransactionManager.java:221)
 at
 org.drools.persistence.SingleSessionCommandService.registerRollbackSync(SingleSessionCommandService.java:333)
 at
 org.drools.persistence.SingleSessionCommandService.init(SingleSessionCommandService.java:123)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)...

 Can anyone help me to solve this problem ?
 Thanks in advance
 S.M.H.Jamali

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




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

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


Re: [rules-users] integrate guvnor UI into your own application

2011-11-09 Thread Esteban Aliverti
If your application is a web application then you can try this solution:
http://ilesteban.wordpress.com/2010/11/23/guvnor-embed-assets-editor-in-your-application/

Best Regards,



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


On Wed, Nov 9, 2011 at 5:48 PM, kapokfly ivan.jiang...@foxmail.com wrote:

 Anyone tried to integrate the guvnor UI into your own application?

 Basically we want to have a integrated, uniformed UI with our application
 rather than a separate one like Drools Guvnor does...

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/integrate-guvnor-UI-into-your-own-application-tp3494093p3494093.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.

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

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


Re: [rules-users] Security test cases for Drools

2011-11-09 Thread Edson Tirelli
   Against external attacks, Drools supports knowledge base signing and
checking using standard asymmetric keys infrastructure. Regarding the web
application,  I will let one of the guvnor guys to talk about. Against
internal attacks, i.e., someone deliberately adding a malicious rule into
the application, the only way is through company policies and processes
that ensure a workflow for rule approval. Drools offers audit logs
(runtime) and standard versioning history (in guvnor, authoring time) to
track changes.

   Edson


On Wed, Nov 9, 2011 at 11:42 AM, kapokfly ivan.jiang...@foxmail.com wrote:

 Not sure if anyone can share their experiences what kind of test cases on
 Drools security should be developed and ensured?

 As the rule is just a piece of codes in String format which can be hooked
 into JVM, we can assume that might open some holes and necessary security
 test cases need to be designed against.

 Anyone can share their experiences on this?

 Thanks...

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Security-test-cases-for-Drools-tp3494072p3494072.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
  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] rule does not fire at first event

2011-11-09 Thread Mauricio Salatino
Are you calling the fireAllRules() method after inserting the events? or
using fireUntilHalt()?
You can activate the log to see what is happening with:
KnowledgeRuntimeLoggerFactory.newConsoleLogger(session);

Cheers

On Wed, Nov 9, 2011 at 1:37 PM, ukriegel
ulrich.krie...@isst.fraunhofer.dewrote:

 Hi there,
 we use drools fusion 5.3. Final.
 In a drl-file, a fact and an event and the following rules are declared

 package ... etc

 declare ActivityState
@role(fact)
state : StateType
 end


 rule set initial state
dialect java
salience 100
when not (exists KFActivityState())
then
ActivityState $actState = new ActivityState();
$actState.setState(StateType.STANDBY);
insert($actState);
System.out.println(ActivityState inserted + new Date());
 end




 declare Command
@role (event)
 end


 rule request information
dialect java
when Command(commandType == CommandType.REQUEST_INFORMATION) from
 entry-point XXX
 $s: ActivityState(state ==
 ComponentStateType.ACTIVE||state ==
 ComponentStateType.PASSIVE||state == ComponentStateType.STANDBY)
then
 System.out.println(Send Report);
 end


 The rule request information doesn't fire with the first command event, but
 from the second one it fires always.

 What's wrong with my code?

 Thanks in advance

 Ulrich

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp3494056p3494056.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

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


Re: [rules-users] integrate guvnor UI into your own application

2011-11-09 Thread kapokfly
Nice, will give a try. 

Another 2 questions you might be able to help:
1) The Guvnor UI is basing on technical models which is hard for a business
user to understand, especially when the current technical models
implementation is not so good (for example, not straightforward relationship
etc), is it possible to plugin another translation layer which allows
business user to see a nice business model and define rules as they like,
the system internally map to the technical models? 

2) Looks like the Guvnor UI editor does not support field expression in
value field, for example, person.name == person.aliasName, are we able to
enhance that? 

With your experience, do you see any major functionality Drools Guvnor is
missing? 

Thanks again...

--
View this message in context: 
http://drools.46999.n3.nabble.com/integrate-guvnor-UI-into-your-own-application-tp3494093p3494161.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Security test cases for Drools

2011-11-09 Thread kapokfly
Thanks Edson.

We are developing a web based UI (if possible embed guvnor into our
application) and open the ability to customers to define their own rules, so
a company policy on this won't work. 

Will evaluate other concern points and have more discussions on this. 

Ivan

--
View this message in context: 
http://drools.46999.n3.nabble.com/Security-test-cases-for-Drools-tp3494072p3494170.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Issues with Eclipse Excel Plugin for Drools Decision Tables

2011-11-09 Thread Andreas Schlüter
Actually, your proposal does not work as expected: 
While Eclipse is open, it locks the file. If I edit it with Excel, be it
directly from the OS or via configuration of the filetype, I therefore
cannot save it. 

So it is like change the excel file-startup eclipse -click refresh -
get compilation Error - shutdown eclipse - correct error in excel -
startup eclipse - click refresh -...

Is this really the way it is supposed to work? Is anybody at all using the
Excel spreadsheet feature in a real application? How do they do it? I am
using OOTB Eclipse, Drools, etc., and this is the first effect that I
receive. How can that be the case if people are using this?

Probably I need a commercial training course to start using the Eclipse
Drools editors, does anyone have a recommendation where to get this? (Or is
it just an Eclipse training course?)

Thanks again,

Andreas  



--
View this message in context: 
http://drools.46999.n3.nabble.com/Issues-with-Eclipse-Excel-Plugin-for-Drools-Decision-Tables-tp3491115p3494332.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Enumerations for nested classes

2011-11-09 Thread gab
Hi all,
I have a problem with data enumeration for nested classes in BRLs.

I have two classes, Promotion and Program. Promotion has a property named
program of type Program, which has a string property called code.
I did a couple of enumeration in this way:

[Program.code] = ['ABC=First Program','XYZ=Second Program']
[Promotion.program.code] = ['ABC=First Program','XYZ=Second Program']

With decision table they work as expected, but in BRL rules only the first
works (the one with no nested classes), while in the other case the
drop-down list doesn't appear and it's shown only a free editable field.

How can it be? Should I write something in a different way? Is it a bug?

I'm using version 5.2.


Thanks in advance.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Enumerations-for-nested-classes-tp3494392p3494392.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Issues with Eclipse Excel Plugin for Drools Decision Tables

2011-11-09 Thread Vincent LEGENDRE
Eclipse does not lock files, none of them, including xls ... 
May be you have an excel process still in execution (not killed by buggy 
OLEEditor) that keeps some locks ?

OOTB Eclipse ? don't know what it is, but may be the problem is here ? 

I do use Excel spreadsheet in real applications. But in real applications, real 
users are not under eclipse...
And me, under Eclipse, never experienced such boring procedures, as soon as I 
banned OLEEditor ... and put my XLS outside source code to avoid refreshing 
(put them in a resource dir, something external to intern code, because rules 
are evolving).

And once again, XLS eclipse editor is part of eclipse, not drools plugin. In 
fact, I am pretty sure that this OLE Editor is more there as a demo to embed 
OLE components (still not understand the utility to transform something 
portable to win-specific ...), rather than a real supported feature ... but it 
is my opinion.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Enumerations for nested classes

2011-11-09 Thread Vincent LEGENDRE
bug : https://issues.jboss.org/browse/GUVNOR-1573
fixed in 5.3

But I think you does not need your second enum. Guvnor will infer that (in 5.3).


- Mail original -
De: gab acque_profo...@yahoo.it
À: rules-users@lists.jboss.org
Envoyé: Mercredi 9 Novembre 2011 19:26:00
Objet: [rules-users] Enumerations for nested classes

Hi all,
I have a problem with data enumeration for nested classes in BRLs.

I have two classes, Promotion and Program. Promotion has a property named
program of type Program, which has a string property called code.
I did a couple of enumeration in this way:

[Program.code] = ['ABC=First Program','XYZ=Second Program']
[Promotion.program.code] = ['ABC=First Program','XYZ=Second Program']

With decision table they work as expected, but in BRL rules only the first
works (the one with no nested classes), while in the other case the
drop-down list doesn't appear and it's shown only a free editable field.

How can it be? Should I write something in a different way? Is it a bug?

I'm using version 5.2.


Thanks in advance.


--
View this message in context: 
http://drools.46999.n3.nabble.com/Enumerations-for-nested-classes-tp3494392p3494392.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

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


Re: [rules-users] Data Modeling for medical expert system

2011-11-09 Thread Davide Sottara
Tohu is a relatively old, unofficial and inactive project. We're refactoring
that as drools-informer,
but that's work in progress and I'm not sure the jQuery web client that
comes with tohu would still work. So I'd recommend to stick to tohu for your
thesis (especially giving your time constraints :))

Feel free to contact me (dso...@gmail.com) if you have questions. I'm
sort-of-in-co-charge of monitoring drools research and I normally tutor
bachelor/master students at the university. So, I'd be happy to share advice
in exchange for information on where and how drools is being used as a
research platform ;)

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Data-Modeling-for-medical-expert-system-tp3490855p3494429.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] integrate guvnor UI into your own application

2011-11-09 Thread Michael Anstis
1) You can put a bridge\adapter layer in between your object model and that
used in Guvnor, but there is nothing in Guvnor itself.

2) Guvnor does support field expressions in the BRL (Business Rule - Guided
Editor). When defining a field constraint select Expression. There were
some good improvements for 5.2 and 5.3.

On 9 November 2011 17:07, kapokfly ivan.jiang...@foxmail.com wrote:

 Nice, will give a try.

 Another 2 questions you might be able to help:
 1) The Guvnor UI is basing on technical models which is hard for a business
 user to understand, especially when the current technical models
 implementation is not so good (for example, not straightforward
 relationship
 etc), is it possible to plugin another translation layer which allows
 business user to see a nice business model and define rules as they like,
 the system internally map to the technical models?

 2) Looks like the Guvnor UI editor does not support field expression in
 value field, for example, person.name == person.aliasName, are we able to
 enhance that?

 With your experience, do you see any major functionality Drools Guvnor is
 missing?

 Thanks again...

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/integrate-guvnor-UI-into-your-own-application-tp3494093p3494161.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

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


Re: [rules-users] variables confusion Java/MVEL

2011-11-09 Thread Els Destickere

Thanks for the insight,
br,
Els

--- On Wed, 11/9/11, Wolfgang Laun wolfgang.l...@gmail.com wrote:

From: Wolfgang Laun wolfgang.l...@gmail.com
Subject: Re: [rules-users] variables confusion Java/MVEL
To: Rules Users List rules-users@lists.jboss.org
Date: Wednesday, November 9, 2011, 3:35 PM

You cannot create variables on the Left Hand Side; there you can only bind (!)
variable names (!) to matched facts or their attributes.
-W 

On 9 November 2011 15:14, elsdestickere elsdestick...@yahoo.com wrote:

Hi,



I'm confused about when en where to use Java or MVEL in a rule.

In the example below I want to replace  

openRes.getMasterExemplaar().getBruikbareExemplaren() with a variable.

RHD: works with JAva expression:

        ListExemplaar bruikEx =

openRes.getMasterExemplaar().getBruikbareExemplaren();

but I prefer to create the variable in the LHS, but Java doesn't work here.

Should this be a MVEL expression or should JAVA allways be possible?



rule GarandeerReservaties

    when

        garRes : GarandeerReservatieTaak();

        openRes : Reservatie() from

repFact.getReservatieRepository().findVandaagOpenstaandeReservaties();

     ListExemplaar bruikEx

=openRes.getMasterExemplaar().getBruikbareExemplaren();

       eval(Reservatie.getVandaagOpenstaandeReservaties().size()  0 

openRes.getMasterExemplaar().getBruikbareExemplaren().size() != 0)

    then

        //ListExemplaar bruikEx =

openRes.getMasterExemplaar().getBruikbareExemplaren();

        bruikEx.get(0).setStatus(ExemplaarStatus.MOMENTEEL_GERESERVEERD);

        openRes.setStatus(ReservatieStatus.GEGARANDEERD);

        System.out.println( Drools +drools.getRule().getName()+: ocr:

+openRes.getAantalVandaagOpenstaandeConcurReservaties() +  bruikex: 

+bruikEx.size() );

end

(written in Dutch, but I think it will be ok to understand)

br,

Els



--

View this message in context: 
http://drools.46999.n3.nabble.com/variables-confusion-Java-MVEL-tp3493632p3493632.html


Sent from the Drools: User forum mailing list archive at Nabble.com.

___

rules-users mailing list

rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users




-Inline Attachment Follows-

___
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] [Planner] CachedMoveFactory drive to Corrupted undo move

2011-11-09 Thread npiedeloup
Hello,

I'm almost new to Drools Planner, and i run into some problems.
One of them, I really want to understand is that my Planner works well until
i try to use a CachedMoveFactory instead of my MoveFactory, then i've got
Corrupted undo move at step 2.

Assigment are my PlanningEntity, Day are facts

My MoveFactory is like this : 
for (final Assigment assigment: mySolution.getAllAssigments()) {
for (final Day day : mySolution.getAllDays()) {
moveList.add(new PlanMove(assigment, day));
}
}
And my doMove is like :
final FactHandle factHandle = workingMemory.getFactHandle(assigment);
assigment.setDay(toDay);
workingMemory.update(factHandle, assigment);

The UndoMove is really simple (new PlanMove(assigment, fromDay)) , so I
pretty sure this part is correct. 


I have add a false day(future=true) which mean not plannified yet and all
assigment start at this day.
I have a rule like :
rule notPlannified
when
$assigment: Assigment( day.future  )
then
insertLogical(new IntConstraintOccurrence(notPlannified,
ConstraintType.NEGATIVE_SOFT, 50, $assigment));   
end

My logs show : 
INFO  Phase construction heuristic finished: step total (0), time spend
(255), best score (0hard/-18750soft).
DEBUG Step index (0), time spend (2175), score (0hard/-18700soft), new
best score (0hard/-18700soft), accepted move size (1000) for picked step
([A148@[UNAFFECT]] == [12/11]).

Someone can explain me what I miss ?

Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Planner-CachedMoveFactory-drive-to-Corrupted-undo-move-tp3495070p3495070.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Bugs in Drools 5.3.0 break Fusion event processing

2011-11-09 Thread Richard Calmbach
Edson: Thanks for the quick reply. I created these JIRA issues:

F1: Duplicate job scheduling in
org.drools.time.impl.DefaultTimerJobInstance.call()
- https://issues.jboss.org/browse/JBRULES-3284

F2: NullPointerException in
org.drools.time.impl.DefaultTimerJobInstance.compareTo(DefaultTimerJobInstance)
- https://issues.jboss.org/browse/JBRULES-3285

F3: org.drools.time.TimerService.scheduleJob(Job, JobContext, Trigger)
suddenly requires non-null JobContext
- https://issues.jboss.org/browse/JBRULES-3286

While you are working on the event scheduling system, you may also want to
look at these two earlier bug reports for Drools 5.2.0:

Long.MAX_VALUE duration for A and not(B after A) type rules causes
invalid session clock time in rule RHS when running with pseudo clock
- https://issues.jboss.org/browse/JBRULES-3100

A and not(B after A) type rules don't fire when session clock has
negative values (pre Unix epoch)
- https://issues.jboss.org/browse/JBRULES-3103

I have not checked their status in Drools 5.3.0, but the description should
tell you whether they still apply.

FWIW, among all of these, F2 (JBRULES-3285) has the highest priority (as
it's breaking my unit tests), followed by F1 (JBRULES-3284). Thanks!

Vincent: Yes, I think there is risk. Even if you don't use jobs explicitly,
Drools uses the same event scheduling system for both internal events and
application-defined events and jobs. The main problem is this: How do you
establish correctness of your code and the overall system? Well, you make
sure your unit tests and functional tests pass. As it stands, I cannot get
my tests to pass with Drools 5.3.0, so I cannot put Drools 5.3.0 in
production. No matter which version you use, only good test coverage will
give you the assurance that your system is functioning properly. I
encourage you to try out Drools 5.3.0 (in a test environment) and to report
any issues you run into. It can only help make Drools better.

2011/11/9 Vincent LEGENDRE vincent.legen...@eurodecision.com

 Just wondering : does these problems happends because you use clocks and
 jobs, or is it general to fusion 5.3 ?
 Did not migrate my project on 5.3 for now.
 So do you think there is a risk, knowing that I only use very basic fusion
 features ?

 --
 *De: *Edson Tirelli ed.tire...@gmail.com
 *À: *Rules Users List rules-users@lists.jboss.org
 *Envoyé: *Mercredi 9 Novembre 2011 14:53:00
 *Objet: *Re: [rules-users] Bugs in Drools 5.3.0 break Fusion event
 processing



Richard,

This is great info. Yes, please open JIRA's for all 3 issues and we
 will make sure this is fixed for the next release.

Thank you,
Edson

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


[rules-users] How to dynamically invoke a field or property into a fact and set rule on that field or property

2011-11-09 Thread srinivasasanda
Hello
 I have a problem  please any one help me
 i have a field product type depending on product type i want to create
new field or property or fact, and on the new field i want to give rules...
   please send me some example or link to lean and practice
   if we dynamically invoke the fact or add a property will it shows a
pattern which is declaring that the rule is   looking for a that fact .

In advance thanks if any one help ... thanks a lot .. 

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-dynamically-invoke-a-field-or-property-into-a-fact-and-set-rule-on-that-field-or-property-tp3495811p3495811.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] RulesRepository usage - jar incompatibility issue

2011-11-09 Thread Praveen
Hi,

I am trying to use RulesRepository to create a package and copy required
assets (by using their uuid) into the created package.

Below is the code snippet and the corresponding stack trace of the run-time
exception being thrown.
I would like to know the appropriate lucene-core jar to be used to get rid
of the below exception.
I have tried lucene-core 2.3, 2.4, 2.9 and 3.4 till now, none solved this.

static Repository repository;
/**
 * @param args
 * @throws RepositoryException 
 * @throws LoginException 
 */
public static void main(String[] args) throws LoginException,
RepositoryException {

repository=getRepositoryHandle();
Session session=repository.login();
RulesRepository rulesRepository=new RulesRepository(session);   
PackageItem 
packageItem=rulesRepository.createPackage(newPackage,
newPackageDescription);
String
hello=rulesRepository.copyAsset(f51858e0-b9b2-44c7-863c-44e5680bb1b3,
newPackage, newPackage);
System.out.println(packageItem);
System.out.println(hello);

}

private static Repository getRepositoryHandle(){
if (repository == null)
repository = new
TransientRepository(classpath:repository.xml,praveen/repository);
return repository;  
}



Exception in thread main java.lang.NoClassDefFoundError:
org/apache/lucene/search/SortComparatorSource
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at
org.apache.jackrabbit.core.config.BeanConfig.newInstance(BeanConfig.java:177)
at
org.apache.jackrabbit.core.config.RepositoryConfigurationParser$1.getQueryHandler(RepositoryConfigurationParser.java:631)
at
org.apache.jackrabbit.core.config.RepositoryConfig.getQueryHandler(RepositoryConfig.java:1032)
at 
org.apache.jackrabbit.core.SearchManager.init(SearchManager.java:174)
at
org.apache.jackrabbit.core.RepositoryImpl.getSystemSearchManager(RepositoryImpl.java:630)
at
org.apache.jackrabbit.core.RepositoryImpl.access$100(RepositoryImpl.java:124)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.getSearchManager(RepositoryImpl.java:1860)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doPostInitialize(RepositoryImpl.java:2095)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.initialize(RepositoryImpl.java:2000)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:533)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:342)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:605)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:232)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:280)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:376)
at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:111)
at TestRepository.main(TestRepository.java:22)

Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Where-in-DB-does-Guvnor-store-description-of-rules-tp3489816p3495831.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to dynamically invoke a field or property into a fact and set rule on that field or property

2011-11-09 Thread Mauricio Salatino
Hi there,
can you elaborate a little bit more on what are you trying to achieve.
It's almost impossible to help with that generic description.

You can write rules on your products that create and insert new facts
pretty easily

Rule categorize product
  no-loop
  when
 $p:Product(name == Product1)
  then
 $p.setCategory(category1);
 update($p);
end

This rule will enrich your original product with a category depending on
the product name. Are you looking to something similar to this?

Cheers

On Thu, Nov 10, 2011 at 2:05 AM, srinivasasanda srinivasasa...@gmail.comwrote:

 Hello
 I have a problem  please any one help me
 i have a field product type depending on product type i want to create
 new field or property or fact, and on the new field i want to give rules...
   please send me some example or link to lean and practice
   if we dynamically invoke the fact or add a property will it shows a
 pattern which is declaring that the rule is   looking for a that fact .

 In advance thanks if any one help ... thanks a lot ..

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-dynamically-invoke-a-field-or-property-into-a-fact-and-set-rule-on-that-field-or-property-tp3495811p3495811.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

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


[rules-users] A little suggestion about the 'ResourceFactory', 'DrlParser' API

2011-11-09 Thread Miles Wen
Would you please provide a method in 'org.drools.io.ResourceFactory' like
this:

public static Resource newReaderResource(InputStream stream, String
encoding);

then I can use this method to load drl files as a stream while explicitly
specify its ecoding?

And in line: 287 of class 'org.drools.compiler.DrlParser':

lexer = new DRLLexer( new ANTLRInputStream( is ) );

no encoding specified as well. The ANTLRInputStream has constructors which
allows you to specify the encoding, otherwise it would figure out the
encoding according to the environment, which is unpredictable some times.

I'm using drools 5.3.0, the newest version. Thosse problems exists for
quite a while during previous versions. I'm fainting to see they are almost
there after upgraded to the new version.

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


Re: [rules-users] How to dynamically invoke a field or property into a fact and set rule on that field or property

2011-11-09 Thread srinivasasanda
My requirement is if i select the product type mobile, or dth, or some other
, 
then i will check one more rule if customer credit total is above 1000 etc..
then i want create a new fact or field . and on that field i want to keep
rule and give some discount constraint as new rule

I am new to drools please help me i have some problem,

After creating a pojo class jar, uploads into guvnor , and write rules on
that, how can we add new fact at runtime dynamically , where does it comes
in guvnor to write rule on new facts generated dynamically. 
plz can give some brush up on this. 

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-dynamically-invoke-a-field-or-property-into-a-fact-and-set-rule-on-that-field-or-property-tp3495811p3495891.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] How to dynamically invoke a field or property into a fact and set rule on that field or property

2011-11-09 Thread Mauricio Salatino
I suggest you to start simple.
Just create a java project add the drools dependencies (knowledge-api,
drools-core and drools-compiler), define your POJO classes that will
represent your Domain model, for example: Product, Discount, Category, etc
and then you can start writing your rules. When you get a set of rules
ready you can use the drools APIs to create your knowledge session that
will allow you to insert facts and evaluate them with your defined rules.
You can check the documentation page for more information on how to do that
or you can also check out the examples located here:

https://github.com/Salaboy/Drools_jBPM5-Training-Examples/tree/master/drools5

That shows how to create simple maven java projects that contains a set of
rules to evaluate very simple scenarios.

Cheers

On Thu, Nov 10, 2011 at 3:16 AM, srinivasasanda srinivasasa...@gmail.comwrote:

 My requirement is if i select the product type mobile, or dth, or some
 other
 ,
 then i will check one more rule if customer credit total is above 1000
 etc..
 then i want create a new fact or field . and on that field i want to keep
 rule and give some discount constraint as new rule

 I am new to drools please help me i have some problem,

 After creating a pojo class jar, uploads into guvnor , and write rules on
 that, how can we add new fact at runtime dynamically , where does it comes
 in guvnor to write rule on new facts generated dynamically.
 plz can give some brush up on this.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-dynamically-invoke-a-field-or-property-into-a-fact-and-set-rule-on-that-field-or-property-tp3495811p3495891.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

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


Re: [rules-users] rule does not fire at first event

2011-11-09 Thread ukriegel
After insertion of the event, fireAllRules() is called.

In fact, there is in addition a default rule

rule default

dialect java
when Command() from entry-point XXX
then
System.out.println(No reaction on Command +new Date());
end

which fires with the same timestamp as the rule which creates the fact
ActivityState

--
View this message in context: 
http://drools.46999.n3.nabble.com/rule-does-not-fire-at-first-event-tp3494056p3495981.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [Planner] CachedMoveFactory drive to Corrupted undo move

2011-11-09 Thread Geoffrey De Smet


Op 09-11-11 23:31, npiedeloup schreef:
 Hello,

 I'm almost new to Drools Planner, and i run into some problems.
 One of them, I really want to understand is that my Planner works well until
 i try to use a CachedMoveFactory instead of my MoveFactory, then i've got
 Corrupted undo move at step 2.

 Assigment are my PlanningEntity, Day are facts

 My MoveFactory is like this :
   for (final Assigment assigment: mySolution.getAllAssigments()) {
   for (final Day day : mySolution.getAllDays()) {
   moveList.add(new PlanMove(assigment, day));
   }
   }
This is good if the number of assignments and days don't change during 
planning.
 And my doMove is like :
   final FactHandle factHandle = workingMemory.getFactHandle(assigment);
   assigment.setDay(toDay);
   workingMemory.update(factHandle, assigment);
You're only updating the planning entity (assignment) which is a good thing,
as it allows delta score calculation to work efficiently.
Notice that, during planning, you aren't updating the day or any other 
problem fact, which is a good thing.
 The UndoMove is really simple (new PlanMove(assigment, fromDay)) , so I
 pretty sure this part is correct.


 I have add a false day(future=true) which mean not plannified yet and all
 assigment start at this day.
 I have a rule like :
 rule notPlannified
  when
   $assigment: Assigment( day.future  )
The day.future is unusual. It might be ok, but to exclude it from the 
possible causes, could you:
Add a method boolean isDayFuture() on the class Assignment and then do
$assigment: Assigment( dayFuture == true )



  then
  insertLogical(new IntConstraintOccurrence(notPlannified,
 ConstraintType.NEGATIVE_SOFT, 50, $assigment));
 end

 My logs show :
 INFO  Phase construction heuristic finished: step total (0), time spend
 (255), best score (0hard/-18750soft).
 DEBUG Step index (0), time spend (2175), score (0hard/-18700soft), new
 best score (0hard/-18700soft), accepted move size (1000) for picked step
 ([A148@[UNAFFECT]] ==  [12/11]).

 Someone can explain me what I miss ?

 Thanks.

 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/Planner-CachedMoveFactory-drive-to-Corrupted-undo-move-tp3495070p3495070.html
 Sent from the Drools: User forum mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


-- 
With kind regards,
Geoffrey De Smet


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