Two Day Drools and jBPM Workshop (Argentina June)
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        http://blog.athico.com/2011/05/2-day-drools-and-jbpm-workshop.html
Thanks to OSDE we now have a 2 day workshop planned in Argetina for 
June, with nearly all the core drools and jbpm developers. A MUST attend 
event for any developer in South America.
We are just finalising locations, agendas and speakers, we'll give more 
firm details later, but initially the line up is as follows:
Where: Argentina (Buenos Aries)
Date: 16-17 June (Thu/Fri)
Speakers:
Mark Proctor - Group Lead and Drools co-founder
Kris Verlaenen - jBPM Lead
Edson Tirelli - Drools tech Lead
Geoffrey De Smet - Planner Lead
Michael Anstis - Business Tooling tech lead
Ray Ploski - Solutions Architect
Guest Speakers (so far)
Salatino Mauricio (Plugtree)
While us core developers will be focusing on Drools and jBPM, Ray will 
be there to do talks on AS7, Seam and Infinispan.
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        new binding - what't its purpose?
                                
                                
                                
                                    
                                        by Wolfgang Laun
                                    
                                
                                
                                         rule  exornot
  when
       Number( $iCount: intValue )  from accumulate ( Fact( x > 0 ), $c:
count(1) )
  then
       System.out.println( "count = " + $c );
  end
There's no way $c can be used in RHS code (5.3.0, current).
Is this the intended behaviour? Where can it be used?
-W
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        ResourceFactory: make setFactoryService() public?
                                
                                
                                
                                    
                                        by Laird Nelson
                                    
                                
                                
                                        Would you consider making the setFactoryService() method in ResourceFactory be
public?
My Drools-as-a-JEE-compliant-resource-adapter project currently needs to
invoke this through a setAccessible() hack:
http://code.google.com/p/drools-jca/source/browse/trunk/drools-jca/src/ma...
This is because I'm attempting to (ultimately) override the usage of Threads
and re-express the asynchronous intent of the KnowledgeAgent by using
container APIs such as Timer, WorkManager, etc.
My project does this successfully, but I had to hack access to this method
to do it.
There is a constructor in ProcessChangeSet as well that I think should be
public.  Currently I get at it like this:
final Constructor<ProcessChangeSet> c =
ProcessChangeSet.class.getDeclaredConstructor(LinkedBlockingQueue.class,
ResourceChangeNotifierImpl.class, SystemEventListener.class);
assert c != null;
c.setAccessible(true);
Looking forward to the discussion,
Laird
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Project Idea - Guvnor Refactoring
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        Eclipse refactoring can work in headless mode. We already have some code 
to analyse drls and get used classes and fields.
1) store all used classes and fields in a database
2) when a class refactoring is attempted use the database in 1) to 
select all the potentially impacted files and put them into a headless 
eclipse project
3) apply the refactoring and show the results to the user who may 
decline/accept(with commit comments) them. Accepting them results in 
each changed file being committed and the version increased.
4) allow additional work hooks, like deployment migration 
wizards/scripts to know what has changed as part of that patch.
Any volunteers?
I think the used fields currently only works on direct field accessors, 
bonus points will be needed to analyse expressions to also get the used 
classes and fields.
Simples :)
Mark
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        Re: [rules-dev] [rules-users] Facing Problem in BRL
                                
                                
                                
                                    
                                        by Wolfgang Laun
                                    
                                
                                
                                        There is some code in 5.1.1
org/drools/eclipse/rulebuilder/editors/RuleEditor.java
that creates a file "drools.package" with
     if ( !file.exists() ) {
                    String defaultHeader = "//This is a package
configuration file";
                    defaultHeader += "\n//Add imports, globals etc here
which will be used by all the rule assets in this folder.";
                    InputStream is = new ByteArrayInputStream(
defaultHeader.getBytes() );
Note the missing newline at the end of defaultHeader.
-W
2011/5/18 Michael Anstis <michael.anstis(a)gmail.com>
> //Add imports, globals etc here which will be used by all the rule assets
>  in this folder.
>
> should be on one line, or add another comment marker at the start of the
> second line, e.g.:-
>
>
> //Add imports, globals etc here which will be used by all the rule assets
> in this folder.
>
> //Add imports, globals etc here which will be used by all the rule assets
> // in this folder.
>
> 2011/5/18 Abhay B. Chaware <Abhay.Chaware(a)kpitcummins.com>
>
>  I was able to reproduce your error … J  try adding a new line ( enter )
>> after the comment in the  drools.package …. Or just remove the commented
>> line “//Add imports, globals etc here which will be used by all the rule
>> assets in this folder.”
>>
>>
>>
>> Your rule name is getting ‘commented out’ ………
>>
>>
>>
>> -abhay
>>
>> *-----------------------*
>>
>> * *
>>
>> * *
>>
>> * *
>>
>> *From:* rules-users-bounces(a)lists.jboss.org [mailto:
>> rules-users-bounces(a)lists.jboss.org] *On Behalf Of *Michael Anstis
>> *Sent:* Wednesday, May 18, 2011 2:53 PM
>>
>> *To:* Rules Users List
>> *Subject:* Re: [rules-users] Facing Problem in BRL
>>
>>
>>
>> This looks rogue:-
>>
>> //Add imports, globals etc here which will be used by all the rule assets
>> in this folder
>>
>> Can you post the content of your drools.packages file?
>>
>> On 18 May 2011 10:19, Sumeet Karawal <sumeet.karawal(a)tcs.com> wrote:
>>
>> This is the output that I get :
>>
>> //This is a package configuration file
>>
>> package com.rules;
>>
>> import com.model.PersonDetails;
>>
>> //Add imports, globals etc here which will be used by all the rule assets
>> in this folder.rule "example"
>>        dialect "mvel"
>>        when
>>                $person : PersonDetails( age < "20" )
>>
>>        then
>>                $person.setDiscount( 10 );
>> end
>>
>> java.lang.RuntimeException: [8,1]: [ERR 102] Line 8:1 mismatched input
>> 'WHEN'
>>
>>   Regards,
>> Sumeet Karawal
>> Mailto: sumeet.karawal(a)tcs.com
>>
>>
>>
>>  From:       "Abhay B. Chaware" <Abhay.Chaware(a)kpitcummins.com>
>>
>>  To:         Rules Users List <rules-users(a)lists.jboss.org>
>>
>>  Date:       05/18/2011 02:47 PM
>>
>>
>>  Subject:    Re: [rules-users] Facing Problem in BRL
>>
>>  Sent by:    rules-users-bounces(a)lists.jboss.org
>>
>>
>>
>>
>>
>>
>> Can you write the outputDRL to System.out and check if the generated DRL
>> syntax is correct ?
>>
>> System.out.println(outputDRL);
>>
>> Before instantiating KnowledgeBuilder
>>
>>
>>
>>
>> -----Original Message-----
>> From: rules-users-bounces(a)lists.jboss.org [
>> mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Sumeet Karawal
>> Sent: Wednesday, May 18, 2011 2:42 PM
>> To: Rules Users List
>> Subject: Re: [rules-users] Facing Problem in BRL
>>
>> I tried to use this also but now I am getting different error:
>> java.lang.RuntimeException: [8,1]: [ERR 102] Line 8:1 mismatched input
>> 'WHEN'
>>
>>
>> Also, what is the significance of the first line. I have copied it as the
>> same.
>>
>> My code is :
>>
>>      String curDir = System.getProperty("user.dir");
>>                 String fileName = curDir + "\\src\\com\\rules
>> \\drools.package";
>>                 String rulePackageContent = FileUtils.readFileToString(new
>> File
>> (fileName));
>>                 fileName = curDir + "\\src\\com\\rules\\example.brl";
>>                 String brl = FileUtils.readFileToString(new
>> File(fileName));
>>                 BRLPersistence read = BRXMLPersistence.getInstance();
>>                 BRLPersistence write = BRDRLPersistence.getInstance();
>>                 String outputDRL = rulePackageContent + write.marshal
>> (read.unmarshal
>> (brl));
>>                 KnowledgeBuilder builder = KnowledgeBuilderFactory.
>> newKnowledgeBuilder();
>>                 builder.add(ResourceFactory.newReaderResource(new
>> StringReader
>> (outputDRL)), ResourceType.DRL);
>>
>>
>>    if (builder.hasErrors()) {
>>      throw new RuntimeException (builder.getErrors().toString ());
>>    }
>>    KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
>>    knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages ());
>>
>> I don't know where I am getting this wrong.
>>
>> Regards,
>> Sumeet Karawal
>> Mailto: sumeet.karawal(a)tcs.com
>>
>>
>>
>>  From:       "Abhay B. Chaware" <Abhay.Chaware(a)kpitcummins.com>
>>
>>
>>  To:         Rules Users List <rules-users(a)lists.jboss.org>
>>
>>
>>  Date:       05/18/2011 01:09 PM
>>
>>
>>  Subject:    Re: [rules-users] Facing Problem in BRL
>>
>>
>>  Sent by:    rules-users-bounces(a)lists.jboss.org
>>
>>
>>
>>
>>
>>
>>
>> I haven't been able to get "ResourceType.BRL" to work. This is how I do
>> it ..
>>
>> String curDir = System.getProperty("user.dir");
>> String fileName = curDir + "\\src\\main\\rules\\drools.package";
>> String rulePackageContent = FileUtils.readFileToString(new
>> File(fileName));
>>
>> fileName = curDir + "\\src\\main\\rules\\eligibility.brl";
>> String brl = FileUtils.readFileToString(new File(fileName));
>> BRLPersistence read = BRXMLPersistence.getInstance();
>> BRLPersistence write = BRDRLPersistence.getInstance();
>> String outputDRL = rulePackageContent +
>> write.marshal(read.unmarshal(brl));
>>
>> KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
>> kbuilder.add(ResourceFactory.newReaderResource(new StringReader
>> (outputDRL)), ResourceType.DRL);
>>
>>
>> Try this.
>>
>>
>> -abhay
>>
>> -----Original Message-----
>> From: rules-users-bounces(a)lists.jboss.org [
>> mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Sumeet Karawal
>> Sent: Wednesday, May 18, 2011 11:47 AM
>> To: Rules Users List
>> Subject: Re: [rules-users] Facing Problem in BRL
>>
>> This is the brl that I have created:
>>
>>
>> (Embedded image moved to file: pic18001.jpg)
>>
>>
>> Regards,
>> Sumeet Karawal
>> Mailto: sumeet.karawal(a)tcs.com
>>
>>
>>
>>  From:       "Abhay B. Chaware" <Abhay.Chaware(a)kpitcummins.com>
>>
>>
>>  To:         Rules Users List <rules-users(a)lists.jboss.org>
>>
>>
>>  Date:       05/18/2011 11:42 AM
>>
>>
>>  Subject:    Re: [rules-users] Facing Problem in BRL
>>
>>
>>  Sent by:    rules-users-bounces(a)lists.jboss.org
>>
>>
>>
>>
>>
>>
>>
>> Could you post your rule content here ?
>>
>>
>> -----Original Message-----
>> From: rules-users-bounces(a)lists.jboss.org [
>> mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Sumeet Karawal
>> Sent: Wednesday, May 18, 2011 11:38 AM
>> To: rules-users(a)lists.jboss.org
>> Subject: [rules-users] Facing Problem in BRL
>>
>>
>> Hi,
>>
>> I am using Drools-Expert. I am having a class "Person" with data members
>> as
>> age and discount.
>> I am trying to create a .brl. I have these statements in drools.package
>> package com.rules;
>>
>> import com.model.PersonDetails;
>>
>>
>> and in the example.brl I am providing the details of when and then
>> conditions
>>
>> but on execution I am getting the following error :
>>
>> java.lang.RuntimeException: [4] Unable to expand: PersonDetails( age <
>> "20" )[6] Unable to expand:
>> PersonDetails fact0 = new
>> PersonDetails
>> ();[7] Unable to expand:
>> fact0.setDiscount
>> ( 10 );[8] Unable to
>> expand:
>>                                   insert(fact0 );
>>
>>
>> It would be helpful is somebody guide me on how execute it.
>>
>> Also, I am creating the knowledgebase as:
>>
>> private static KnowledgeBase createKnowledgeBase() {
>>  KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
>>    builder.add (ResourceFactory.newClassPathResource(
>> "com/rules/example.brl"),ResourceType.BRL);
>>    if (builder.hasErrors()) {
>>      throw new RuntimeException (builder.getErrors().toString ());
>>    }
>>    KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
>>    knowledgeBase.addKnowledgePackages(builder.getKnowledgePackages ());
>>    return knowledgeBase;}
>>
>>
>> Thanks & Regards,
>> Sumeet Karawal
>> CEG - Open Source Technology Group
>> Tata Consultancy Services
>> Ph:- +912267782556
>> Cell:- +919833236440
>> Mailto: sumeet.karawal(a)tcs.com
>> Website: http://www.tcs.com
>> ____________________________________________
>> Experience certainty.
>>          IT
>> Services
>>
>> Business Solutions
>>
>> Outsourcing
>> ____________________________________________
>>
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain
>> confidential or privileged information. If you are
>> not the intended recipient, any dissemination, use,
>> review, distribution, printing or copying of the
>> information contained in this e-mail message
>> and/or attachments to it are strictly prohibited. If
>> you have received this communication in error,
>> please notify us by reply e-mail or telephone and
>> immediately and permanently delete the message
>> and any attachments. Thank you
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain
>> confidential or privileged information. If you are
>> not the intended recipient, any dissemination, use,
>> review, distribution, printing or copying of the
>> information contained in this e-mail message
>> and/or attachments to it are strictly prohibited. If
>> you have received this communication in error,
>> please notify us by reply e-mail or telephone and
>> immediately and permanently delete the message
>> and any attachments. Thank you
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain
>> confidential or privileged information. If you are
>> not the intended recipient, any dissemination, use,
>> review, distribution, printing or copying of the
>> information contained in this e-mail message
>> and/or attachments to it are strictly prohibited. If
>> you have received this communication in error,
>> please notify us by reply e-mail or telephone and
>> immediately and permanently delete the message
>> and any attachments. Thank you
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain
>> confidential or privileged information. If you are
>> not the intended recipient, any dissemination, use,
>> review, distribution, printing or copying of the
>> information contained in this e-mail message
>> and/or attachments to it are strictly prohibited. If
>> you have received this communication in error,
>> please notify us by reply e-mail or telephone and
>> immediately and permanently delete the message
>> and any attachments. Thank you
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> This message contains information that may be privileged or confidential
>> and is the property of the KPIT Cummins Infosystems Ltd. 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. KPIT Cummins Infosystems Ltd. does not accept any liability
>> for virus infected mails.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                                
                                 
                                        
                                
                         
                        
                                
                                
                                        
                                                
                                        
                                        
                                        writing unit tests
                                
                                
                                
                                    
                                        by Mark Proctor
                                    
                                
                                
                                        It's great when people attach unit tests to jiras, it would be ever 
better if they are just cut nad paste single files, rather than entire 
projects, which take more time for us to fiddle with. Also please do try 
and pair your actual program "main" examples down to minimal unit tests 
of the actual problem. If you suspect the problem is MVEL, then please 
do a minimal MVEL test, without Drools.
Put static classes in the same file, put rules in a concatenated string. 
This means testing is as easy as cut and paste for us, and it can be 
easily added to existing test classes. For example, from MiscTest.
     public static class A {
         private String field1;
         private String field2;
         public A(String field1,
                  String field2) {
             this.field1 = field1;
             this.field2 = field2;
         }
         public String getField1() {
             return field1;
         }
         public void setField1( String field1 ) {
             this.field1 = field1;
         }
         public String getField2() {
             return field2;
         }
         public void setField2( String field2 ) {
             this.field2 = field2;
         }
         public String toString() {
             return "A) " + field1 + ":" + field2;
         }
     }
     @Test
     public void testExistsIterativeModifyBug() {
         // JBRULES-2809
         // This bug occurs when a tuple is modified, the remove/add 
puts it onto the memory end
         // However before this was done it would attempt to find the 
next tuple, starting from itself
         // This meant it would just re-add itself as the blocker, but 
then be moved to end of the memory
         // If this tuple was then removed or changed, the blocked was 
unable to check previous tuples.
         String str = "";
         str += "package org.simple \n";
         str += "import " + A.class.getCanonicalName() + "\n";
         str += "global java.util.List list \n";
         str += "rule xxx \n";
         str += "when \n";
         str += "  $f1 : A() \n";
         str += "    exists A(this != $f1, eval(field2 == 
$f1.getField2())) \n";
         str += "    eval( !$f1.getField1().equals(\"1\") ) \n";
         str += "then \n";
         str += "  list.add($f1); \n";
         str += "end  \n";
         KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
         StatefulKnowledgeSession ksession = 
kbase.newStatefulKnowledgeSession();
         List list = new ArrayList();
         ksession.setGlobal( "list",
                             list );
         A a1 = new A( "2",
                       "2" );
         A a2 = new A( "1",
                       "2" );
         A a3 = new A( "1",
                       "2" );
         FactHandle fa1 = (FactHandle) ksession.insert( a1 );
         FactHandle fa2 = (FactHandle) ksession.insert( a2 );
         FactHandle fa3 = (FactHandle) ksession.insert( a3 );
         // a2, a3 are blocked by a1
         // modify a1, so that a1,a3 are now blocked by a2
         a1.setField2( "1" ); // Do
         ksession.update( fa1,
                          a1 );
         a1.setField2( "2" ); // Undo
         ksession.update( fa1,
                          a1 );
         // modify a2, so that a1,a2 are now blocked by a3
         a2.setField2( "1" ); // Do
         ksession.update( fa2,
                          a2 );
         a2.setField2( "2" ); // Undo
         ksession.update( fa2,
                          a2 );
         // modify a3 to cycle, so that it goes on the memory end, but 
in a previous bug still blocked a1
         ksession.update( fa3,
                          a3 );
         a3.setField2( "1" ); // Do
         ksession.update( fa3,
                          a3 );
         ksession.fireAllRules();
         assertEquals( 1,
                       list.size() ); // a2 should still be blocked by 
a1, but bug from previous update hanging onto blocked
         ksession.dispose();
     }
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        More "improvements"?
                                
                                
                                
                                    
                                        by Wolfgang Laun
                                    
                                
                                
                                        Overnight, a "stale mail bale" (2009) has flopped into my mailbox.
I still can't operate pull-down lists on https://issues.jboss.org, but I
could - with the very same system - 3 days ago.
-W
                                
                         
                        
                                
                                14 years, 5 months
                        
                        
                 
         
 
        
            
        
        
        
            
        
        
        
                
                        
                        
                                
                                
                                        
                                                
                                        
                                        
                                        duplicate class?
                                
                                
                                
                                    
                                        by Wolfgang Laun
                                    
                                
                                
                                        Does it make sense to have an exact copy of a class, like this:
diff
drools-core/src/test/java/org/drools/reteoo/test/parser/DroolsParserException.java
drools-compiler/src/main/java/org/drools/compiler/DroolsParserException.java
17c17
< package org.drools.reteoo.test.parser;
---
> package org.drools.compiler;
All right, they are in different packages and even different (sub-)projects,
but still...
                                
                         
                        
                                
                                14 years, 5 months