Re: [rules-users] Best Webserver to put in front of Drools Planner?

2013-01-21 Thread Geoffrey De Smet

  
  

Op 21-01-13 07:47, Michiel Vermandel
  schreef:


  Hi,

I need to make the planning engine to be accessible through a
SOAP webservice.
A SOAP message with planning entity/variable data needs to be
sent, which starts a planning threat.

What is the best approach here?

Camel + JBoss AS 7 :)

Like drools-camel, one day we 'll build drools-planner-camel (direct
integration to expose drools-planner as a SOAP/REST webservice
through camel) that will work on any servlet container, but not any
day soon.


   Just take a Tomcat server
and a custom SOAP Webapp?

Thanks,

Michiel

  
 
-
  http://www.codessentials.com - Your essential software, for
  free!
  Follow us at http://twitter.com/#!/Codessentials
  
  
  
  
  ___
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] Best Webserver to put in front of Drools Planner?

2013-01-21 Thread Michiel Vermandel
@Geoffrey: is there a possibility to get payed support on Drools Planner?

Thanks,

Michiel Vermandel


 
-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials



 From: Geoffrey De Smet 
To: Michiel Vermandel ; Rules Users List 
 
Sent: Monday, January 21, 2013 9:50 AM
Subject: Re: Best Webserver to put in front of Drools Planner?
 



Op 21-01-13 07:47, Michiel Vermandel schreef:

Hi,
>
>I need to make the planning engine to be accessible through a
SOAP webservice.
>A SOAP message with planning entity/variable data needs to be
sent, which starts a planning threat.
>
>What is the best approach here?
Camel + JBoss AS 7 :)

Like drools-camel, one day we 'll build drools-planner-camel (direct
integration to expose drools-planner as a SOAP/REST webservice
through camel) that will work on any servlet container, but not any
day soon.


Just take a Tomcat server and a custom SOAP Webapp?
>
>Thanks,
>
>Michiel
>
>
>
> 
>-
>http://www.codessentials.com - Your essential software, for
  free!
>Follow us at http://twitter.com/#!/Codessentials
>
>
>___
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] [rules-dev] [BAD Bug] incorrect evaluation of LHS using Integer/Number intValue

2013-01-21 Thread Mario Fusco
I just fixed this bug on the master and backported it on the 5.5.x branch.
Wolfgang, thanks again for your help.

Mario

On Sun, Jan 20, 2013 at 9:23 AM, Wolfgang Laun wrote:

> Below is another couple of test cases, showing that the problem is not due
> a getter that isn't called get* - it's a more general problem. As far as I
> can tell this rule pattern, expecting to fire in ascending order of
> Fact.prop, is broken in 5.5.0:
>
> rule "Rule xx"
> when
> $fact: Fact( $prop: prop )
> not Fact(prop < $prop)
> then
> System.out.println("Fact.prop: " + $prop);
> retract($fact);
> end
>
> // Test case using String
>
> rule init
> salience 
> when
> then
> insert( "AAA" );
> insert( "DDD" );
> insert( "EEE" );
> insert( "CCC" );
> insert( "BBB" );
> end
>
> rule "Rule 05"
> when
> $s : String()
> not String( this < $s)
> then
> System.out.println("String found with value: " + $s );
> retract($s);
> end
>
> // Test case using declared type
> declare Fact
>   prop : long
> end
>
> rule init
> salience 999
> when
> then
> insert( new Fact( 1 ) );
> insert( new Fact( 5 ) );
> insert( new Fact( 6 ) );
> insert( new Fact( 4 ) );
> insert( new Fact( 2 ) );
> end
>
> rule "Rule 06"
> salience 100
> when
> $fact : Fact( $prop: prop )
> not Fact( prop < $prop )
> then
> System.out.println("Fact.prop: " + $prop);
> retract($fact);
> end
>
> On 20/01/2013, Wolfgang Laun  wrote:
> > [Sorry - the previous email "escaped" before I was complete.]
> >
> > This is a self-contained DRL demonstrating the erroneous handling of
> > a condition involving Integer.intValue (same: Number.intValue), not
> > and retract, which is meant to sort the integers. This fails with 5.5.0,
> > but works correctly with 5.4.0 and previous versions.
> >
> > rule init
> > salience 
> > when
> > then
> > insert( Integer.valueOf( 10 ) );
> > insert( Integer.valueOf( 50 ) );
> > insert( Integer.valueOf( 60 ) );
> > insert( Integer.valueOf( 40 ) );
> > insert( Integer.valueOf( 20 ) );
> > end
> >
> > rule "Rule 04"
> > when
> > $number : Integer( $i: intValue )
> > not Integer(intValue < $i)
> > then
> > System.out.println("Number found with value: " + $number.intValue());
> > retract($number);
> > end
> >
> >>
> >> On 17/01/2013, Wolfgang Laun  wrote:
> >>> This BAD bug was introduced on the way from 5.4.0 to 5.5.0 (and seems
> >>> to have sneaked into 6.0.0 as well).
> >>>
> >>> Only 5.4.0 and predecessors work as expected.
> >>>
> >>> Damage control? How far can 5.5.0 be trusted?
> >>>
> >>>
> >>> On 17/01/2013, John Smith  wrote:
>  I am new to Drools and am trying to get the sample program to work.
>  This
>  sample is given in the drools documentation
> 
> http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html#d0e9542
> .
>  This drool rule is expected to sort integers. I just changed the
>  numbers
>  from what are given in the sample and they do not get sorted as
>  expected.
>  Tried using drools version 5.5.0, 5.5.1 and the master 6.0.0, but got
>  the
>  same wrong results.
> 
>  Following is the main code:
>  package com.sample;
> 
>  public class Example2 {
>    public static void main(String[] args) throws Exception {
>  Number[] numbers = new Number[] { wrap(5), wrap(6), wrap(4),
>  wrap(1), wrap(2) };
>  new RuleRunner().runRules(new String[] { "Example3.drl" },
>  numbers);
>    }
> 
>    private static Integer wrap(int i) {
>  return new Integer(i);
>    }
>  }
> 
>   The RuleRunner class is the same as given in the example and I do not
>  think
>  I should give that here, since it will clutter the question. It simply
>  creates the KnowledgeBase, stateful session, inserts the facts as
> given
>  in
>  the 'numbers' array above and then calls fireAllRules method on the
>  session.
> 
>  The rule file (Example3.drl) is:
> 
> 
>   rule "Rule 04"
>   dialect "mvel"
> when
>   $number : Number()
>   not Number(intValue < $number.intValue)
> then
>   System.out.println("Number found with value: " +
>  $number.intValue());
>   retract($number);
>   end
> 
> 
>  The output I get is as follows:
>  Loading file: Example3.drl
>  Inserting fact: 5
>  Inserting fact: 6
>  Inserting fact: 4
>  Inserting fact: 1
>  Inserting fact: 2
>  Number found with value: 1
>  Number found with value: 4
>  Number found with value: 2
>  Number found with value: 5
>  Number found with value: 6
> 
>  Not the correct expected ascending sorted order.
> 
>  What might I be doing wrong? I cannot imagine that the drools rule
>  engine
>  would be broken at 

Re: [rules-users] Best Webserver to put in front of Drools Planner?

2013-01-21 Thread Steven Núñez
Michael,

We have extensive experience in planner and offer paid support. Send me a note 
with you requirements. We are supporting many major Australian corporations 
already.

Regards,

Steve

Managing Director
Illation Pty Ltd

On 21/01/2013, at 20:13, "Michiel Vermandel" 
mailto:mverm...@yahoo.com>> wrote:

@Geoffrey: is there a possibility to get payed support on Drools Planner?

Thanks,

Michiel Vermandel


-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials

From: Geoffrey De Smet mailto:ge0ffrey.s...@gmail.com>>
To: Michiel Vermandel mailto:mverm...@yahoo.com>>; Rules 
Users List mailto:rules-users@lists.jboss.org>>
Sent: Monday, January 21, 2013 9:50 AM
Subject: Re: Best Webserver to put in front of Drools Planner?


Op 21-01-13 07:47, Michiel Vermandel schreef:
Hi,

I need to make the planning engine to be accessible through a SOAP webservice.
A SOAP message with planning entity/variable data needs to be sent, which 
starts a planning threat.

What is the best approach here?
Camel + JBoss AS 7 :)

Like drools-camel, one day we 'll build drools-planner-camel (direct 
integration to expose drools-planner as a SOAP/REST webservice through camel) 
that will work on any servlet container, but not any day soon.

Just take a Tomcat server and a custom SOAP Webapp?

Thanks,

Michiel


-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials



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




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


Re: [rules-users] can't copy files to guvnor using webdav

2013-01-21 Thread Stephen Masters
Thanks Jervis,

In that case, it sounds like the issue might be with the use of the default 
JAAS authenticator. In which case, does using a custom authenticator fix the 
issue?

For instance, I knocked this one up to support single sign-on to Guvnor on RHEL 
from users on Windows 7 (Active Directory):
https://gist.github.com/4545962

I have only tested it on 5.3 though, so I can't be sure whether it resolves the 
5.4 issue.

Steve


On 21 Jan 2013, at 01:10, Jervis Liu  wrote:

> On 2013/1/17 18:46, Stephen Masters wrote:
>> Hi folks,
>> 
>> Just curious, but do you have a link to the Jira relating to this 
>> authentication issue? I'm keen to find the details.
> https://issues.jboss.org/browse/GUVNOR-1986
> 
>> 
>> Thanks,
>> 
>> Steve
>> 
>> 
>> On 17 Jan 2013, at 07:01, Jervis Liu  wrote:
>> 
>>> On 2013/1/16 12:28, Yuri wrote:
 Hmm - I may try that.  So you think I would install 5.3, import one of my 
 5.5 repositories, merge in packages from the other 5.5 repository, and 
 then export that repository to be re-imported in 5.5? 
>>> Yes, it should be doable.
 
 
 On Tue, Jan 15, 2013 at 9:28 PM, Jervis Liu  wrote:
 On 2013/1/16 11:12, Yuri wrote:
> Thanks for the quick reply, Jervis.  We are basically in 
> discovery/presentation mode with our BRMS, and we have several different 
> people doing different things with their own instances of guvnor (not how 
> it's going to be in the end). We're trying to merge the work ppl have 
> been doing into a central guvnor repository, so copying packages from one 
> to the other w/o blowing away the whole repository is the only way we've 
> thought of doing this so far.  Do you have any ideas for a work-around?
 Given the fact the authentication problem has not been fixed yet in Guvnor 
 5.4 and 5.5 (but will be very soon), the only workaround I can think of 
 right now is using Guvnor 5.3. You can merge assets under 5.3. Then 
 upgrade guvnor with the merged repository to 5.4 or 5.5. 
 
 Jervis
 
> Thanks,
> Yuri
> 
> 
> On Tue, Jan 15, 2013 at 8:50 PM, Jervis Liu  wrote:
> On 2013/1/16 2:52, Yuri wrote:
>> Hi Everyone,
>> I am having to move assets from one repository to another, and if WebDav 
>> would work for me, I believe that it would be the easiest solution.  
>> I have the default security setup that comes with guvnor 5.5.0 and JBoss 
>> AS 7, and I absolutely could not figure out any way to connect from 
>> Windows 7.  
> Guvnor 5.4 and 5.5 has a known authentication problem which affects 
> WebDav access. If you just want to move assets from one repo to another, 
> you can try exporting guvnor repository as xml file then importing again, 
> will this approach work for you?
> 
>> I was finally able to connect to webDav with BitKinex, however, I cannot 
>> upload anything - I can download files just fine, but when I try to 
>> upload, I get the following error on my server.  Am I missing something?
>> Thanks,
>> Yuri
>> 
>> Error:
>> 12:08:00,344 ERROR [org.drools.repository.RulesRepository] 
>> (http--127.0.0.1-8080-7) Unable to load a module. : 
>> javax.jcr.PathNotFoundException: MyNewAsset.txt
>> 
>> at 
>> org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2135) 
>> [jackrabbit-core-2.2.8.jar:2.2.8]
>> 
>> at 
>> org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2129) 
>> [jackrabbit-core-2.2.8.jar:2.2.8]
>> 
>> at 
>> org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)[jackrabbit-core-2.2.8.jar:2.2.8]
>> 
>> at 
>> org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91) 
>> [jackrabbit-core-2.2.8.jar:2.2.8]
>> 
>> at 
>> org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2129) 
>> [jackrabbit-core-2.2.8.jar:2.2.8]
>> 
>> at 
>> org.drools.repository.RulesRepository.loadModule(RulesRepository.java:435)[guvnor-repository-5.5.0.Final.jar:5.5.0.Final]
>> 
>> at 
>> org.drools.repository.RulesRepository$Proxy$_$$_WeldClientProxy.loadModule(RulesRepository$Proxy$_$$_WeldClientProxy.java)[guvnor-repository-5.5.0.Final.jar:5.5.0.Final]
>> 
>> at 
>> org.drools.guvnor.server.files.WebDAVImpl.loadPackageFromRepository(WebDAVImpl.java:912)[guvnor-webapp-core-5.5.0.Final.jar:5.5.0.Final]
>> 
>> at 
>> org.drools.guvnor.server.files.WebDAVImpl.getStoredObjectForReadOnlyP

Re: [rules-users] Drools Expert does not sort integers correctly

2013-01-21 Thread Wolfgang Laun
As fas as the released versions 5.5.0 and 5.5.1 are concerned,  CEs
"not" and "exist" using constraints employing the four comparison
operators <, <=, >, >= are not safe to use if a retract changes the
nodes relating to these CEs.

Mario has fixed this, so it'll be gone in 5.6 and later.

-W

On 17/01/2013, John Smith  wrote:
> I am new to Drools and am trying to get the sample program to work. This
> sample is given in the drools documentation
> http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html#d0e9542.
> This drool rule is expected to sort integers. I just changed the numbers
> from what are given in the sample and they do not get sorted as expected.
> Tried using drools version 5.5.0, 5.5.1 and the master 6.0.0, but got the
> same wrong results.
>
> Following is the main code:
> package com.sample;
>
> public class Example2 {
>   public static void main(String[] args) throws Exception {
> Number[] numbers = new Number[] { wrap(5), wrap(6), wrap(4),
> wrap(1), wrap(2) };
> new RuleRunner().runRules(new String[] { "Example3.drl" },
> numbers);
>   }
>
>   private static Integer wrap(int i) {
> return new Integer(i);
>   }
> }
>
>  The RuleRunner class is the same as given in the example and I do not
> think
> I should give that here, since it will clutter the question. It simply
> creates the KnowledgeBase, stateful session, inserts the facts as given in
> the 'numbers' array above and then calls fireAllRules method on the
> session.
>
> The rule file (Example3.drl) is:
>
>
>  rule "Rule 04"
>  dialect "mvel"
>when
>  $number : Number()
>  not Number(intValue < $number.intValue)
>then
>  System.out.println("Number found with value: " + $number.intValue());
>  retract($number);
>  end
>
>
> The output I get is as follows:
> Loading file: Example3.drl
> Inserting fact: 5
> Inserting fact: 6
> Inserting fact: 4
> Inserting fact: 1
> Inserting fact: 2
> Number found with value: 1
> Number found with value: 4
> Number found with value: 2
> Number found with value: 5
> Number found with value: 6
>
> Not the correct expected ascending sorted order.
>
> What might I be doing wrong? I cannot imagine that the drools rule engine
> would be broken at this basic level.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Expert-does-not-sort-integers-correctly-tp4021606.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] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'

2013-01-21 Thread ikbhal
Hi,

Hi
I am using drools 
I am getting this error after i run the rule after 10 times.
Can you please suggest me is there any i can do 
i tried to chagne version of drools-core,api,compiler , but it does not
work.
my pom.xml is

org.drools
drools-core
5.1.1


org.drools
drools-compiler
5.1.1


org.drools
drools-api
5.1.1


org.drools
drools-templates
5.1.1


com.thoughtworks.xstream
xstream
1.3.1


this is the code
public  T runRule(String ruleName, Object facts[], T result, String
resultName)
throws ERPServiceException {

if(ksession == null || ruleMap == null || ruleMap.size() == 0){
throw new 
ERPServiceException(ERPErrorCodes.ERR_NO_DATA_TO_PROCESS);
}
LOGGER.info("inside run rule");

List factHandleList = new ArrayList();
FactHandle factHandle = null;
for(Object fact: facts) {
LOGGER.info("rule fact:" + facts);
factHandle = ksession.insert(fact);
factHandleList.add(factHandle);
}
ksession.setGlobal(resultName, result);  
/* 
 * ksession.addEventListener(kbaseRefresher);
 *ksession.addEventListener(kbaseRefresher);
 */ 
String ruleFullName = null;
RuleEntry ruleEntry = ruleMap.get(ruleName);

if(ruleEntry != null){
Long ruleMetaDataId = ruleEntry.getRuleMetaDataId();
RuleMetaDataEntry metaDataEntry =
ruleMetaDataMap.get(ruleMetaDataId);
if(metaDataEntry != null &&
metaDataEntry.getRuleMetaDataParameterEntries() != null 
&& 
metaDataEntry.getRuleMetaDataParameterEntries().size()<1) {
ruleFullName = metaDataEntry.getName();
}else{
ruleFullName = RULE_NAME_PREFIX + ruleName;
}
LOGGER.info("running rule: "  + ruleFullName);
ksession.fireAllRules(new
RuleNameMatchesAgendaFilter(ruleFullName));
for(FactHandle fhandle: factHandleList){
ksession.retract(fhandle);
}
}
return result;
}


Caused by: java.lang.ExceptionInInitializerError
at
org.drools.concurrent.ExecutorProviderFactory.getExecutorProvider(ExecutorProviderFactory.java:12)
at
org.drools.rule.constraint.MvelConstraint$ExecutorHolder.(MvelConstraint.java:259)
at
org.drools.rule.constraint.MvelConstraint.jitEvaluator(MvelConstraint.java:232)
at
org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:197)
at
org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:157)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at 
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:903)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
at
com.myntra.commons.utils.RuleEngineCache.runRule(RuleEngineCache.java:152)
at
com.myntra.lms.manager.impl.CourierServiceabilityManagerImpl.getCouriers(CourierServiceabilityManagerImpl.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:

[rules-users] Implementation example

2013-01-21 Thread André Fróes
Hello everyone. Is there anywhere I can get a full example of simplest
planner implementation, such as nqueens? (apart of example folder)

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


Re: [rules-users] Implementation example

2013-01-21 Thread André Fróes
ops, just found it:

http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html#d0e9542


2013/1/21 André Fróes 

> Hello everyone. Is there anywhere I can get a full example of simplest
> planner implementation, such as nqueens? (apart of example folder)
>
> Thanks
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Implementation example

2013-01-21 Thread André Fróes
nvm, it was for expert, not planner o.O


2013/1/21 André Fróes 

> ops, just found it:
>
>
> http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html#d0e9542
>
>
> 2013/1/21 André Fróes 
>
>> Hello everyone. Is there anywhere I can get a full example of simplest
>> planner implementation, such as nqueens? (apart of example folder)
>>
>> Thanks
>>
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Implementation example

2013-01-21 Thread Jeremy Ary
Have you tried looking here for something similar or planner-based?

https://github.com/droolsjbpm/drools-planner/tree/master/drools-planner-examples

https://github.com/droolsjbpm/drools-planner/tree/master/drools-planner-webexamples

https://github.com/droolsjbpm/drools/tree/master/drools-examples/src/main/java/org/drools/examples

- J




On Mon, Jan 21, 2013 at 7:09 AM, André Fróes  wrote:

> nvm, it was for expert, not planner o.O
>
>
> 2013/1/21 André Fróes 
>
>> ops, just found it:
>>
>>
>> http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/index.html#d0e9542
>>
>>
>> 2013/1/21 André Fróes 
>>
>>> Hello everyone. Is there anywhere I can get a full example of simplest
>>> planner implementation, such as nqueens? (apart of example folder)
>>>
>>> Thanks
>>>
>>
>>
>
> ___
> 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] Drools 5.4.0.FINAL and OSGI. Unable to instantiate service for Class 'org.drools.concurrent.ExecutorProvider'

2013-01-21 Thread ikbhal
Thanks Per Sterner, i tried to your suggestion,
I removed drools-api dependency from pom.xml
its working.




--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Drools-5-4-0-FINAL-and-OSGI-Unable-to-instantiate-service-for-Class-org-drools-concurren-tp4017660p4021691.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] can't copy files to guvnor using webdav

2013-01-21 Thread Jervis Liu

On 2013/1/21 18:38, Stephen Masters wrote:

Thanks Jervis,

In that case, it sounds like the issue might be with the use of the 
default JAAS authenticator. In which case, does using a custom 
authenticator fix the issue?


For instance, I knocked this one up to support single sign-on to 
Guvnor on RHEL from users on Windows 7 (Active Directory):

https://gist.github.com/4545962

I have only tested it on 5.3 though, so I can't be sure whether it 
resolves the 5.4 issue.
It is likely that a custom authenticator wont work. This is because the 
user and password does not get passed into the authenticator correctly, 
which is caused by a Seam 3 security bug: 
https://issues.jboss.org/browse/SEAMSECURITY-98


Cheers,
Jervis


Steve


On 21 Jan 2013, at 01:10, Jervis Liu > wrote:



On 2013/1/17 18:46, Stephen Masters wrote:

Hi folks,

Just curious, but do you have a link to the Jira relating to this 
authentication issue? I'm keen to find the details.

https://issues.jboss.org/browse/GUVNOR-1986



Thanks,

Steve


On 17 Jan 2013, at 07:01, Jervis Liu > wrote:



On 2013/1/16 12:28, Yuri wrote:
Hmm - I may try that.  So you think I would install 5.3, import 
one of my 5.5 repositories, merge in packages from the other 5.5 
repository, and then export that repository to be re-imported in 5.5?

Yes, it should be doable.



On Tue, Jan 15, 2013 at 9:28 PM, Jervis Liu > wrote:


On 2013/1/16 11:12, Yuri wrote:

Thanks for the quick reply, Jervis.  We are basically in
discovery/presentation mode with our BRMS, and we have
several different people doing different things with their
own instances of guvnor (not how it's going to be in the
end). We're trying to merge the work ppl have been doing into
a central guvnor repository, so copying packages from one to
the other w/o blowing away the whole repository is the only
way we've thought of doing this so far.  Do you have any
ideas for a work-around?

Given the fact the authentication problem has not been fixed
yet in Guvnor 5.4 and 5.5 (but will be very soon), the only
workaround I can think of right now is using Guvnor 5.3. You
can merge assets under 5.3. Then upgrade guvnor with the
merged repository to 5.4 or 5.5.

Jervis


Thanks,
Yuri


On Tue, Jan 15, 2013 at 8:50 PM, Jervis Liu mailto:j...@redhat.com>> wrote:

On 2013/1/16 2:52, Yuri wrote:

Hi Everyone,
I am having to move assets from one repository to
another, and if WebDav would work for me, I believe that
it would be the easiest solution.
I have the default security setup that comes with guvnor
5.5.0 and JBoss AS 7, and I absolutely could not figure
out any way to connect from Windows 7.

Guvnor 5.4 and 5.5 has a known authentication problem
which affects WebDav access. If you just want to move
assets from one repo to another, you can try exporting
guvnor repository as xml file then importing again, will
this approach work for you?


I was finally able to connect to webDav with BitKinex,
however, I cannot upload anything - I can download files
just fine, but when I try to upload, I get the following
error on my server.  Am I missing something?
Thanks,
Yuri

Error:
12:08:00,344 ERROR
[org.drools.repository.RulesRepository]
(http--127.0.0.1-8080-7) Unable to load a module. :
javax.jcr.PathNotFoundException: *MyNewAsset.txt*
at
org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2135)
[jackrabbit-core-2.2.8.jar:2.2.8]
at
org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2129)
[jackrabbit-core-2.2.8.jar:2.2.8]
at

org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)[jackrabbit-core-2.2.8.jar:2.2.8]
at
org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
[jackrabbit-core-2.2.8.jar:2.2.8]
at
org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2129)
[jackrabbit-core-2.2.8.jar:2.2.8]
at

org.drools.repository.RulesRepository.loadModule(RulesRepository.java:435)[guvnor-repository-5.5.0.Final.jar:5.5.0.Final]
at

org.drools.repository.RulesRepository$Proxy$_$$_WeldClientProxy.loadModule(RulesRepository$Proxy$_$$_WeldClientProxy.java)[guvnor-repository-5.5.0.Final.jar:5.5.0.Final]
at

org.drools.guvnor.server.files.WebDAVImpl.loadPackageFromRepository(WebDAVImpl.java:912)[guvnor-webapp-core-5.5.0.Final.jar:5.5.0.Final]
at

org.drools.guvnor.server.files.WebDAVImpl.getStoredObjectForReadOnlyPackages(WebDAVImpl.java:473)[guvnor-webapp-core-5.5.0.Final.jar:5.5.0.Final]
at

org.drools.guvnor.server.files.WebDAVImpl.getStoredObject(WebDAVImpl.

Re: [rules-users] detecting score traps

2013-01-21 Thread Geoffrey De Smet



Op 19-01-13 19:18, Michiel Vermandel schreef:

Hi,

Is there any deterministic way for detecting a score trap in Drools 
Planner?
I have read about the hill-climbing issue and the ways to reduce the 
possibility of this but I think it is still possible to encounter, right?
So it would be great to have some red-light flashing when it happens 
after all :-)

Yes, but they are hard to detect automatically.
One red-light flashing is by using 
BEST_SOLUTION_CHANGED

http://docs.jboss.org/drools/release/5.5.0.Final/drools-planner-docs/html_single/index.html#d0e7101
I 'd like to automate detection of it:
  https://issues.jboss.org/browse/PLANNER-120

If you see this, you probably have a score trap:
https://issues.jboss.org/secure/attachment/12359971/badBecauseScoreTrap.png
Then run the solver again, but terminate it in the middle of that first 
flat line and write the solution.

Then examine that solution for score traps.

Just pushed a new image and some docs explaining score traps better, as 
several users might have encountered it:

https://github.com/droolsjbpm/drools-planner/commit/e9034f4ac60e7a4bd65f7223c5a3dd47e0d7b903

Thanks,

Michiel

-
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials


___
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] solution equals and hashcode are never called.

2013-01-21 Thread Geoffrey De Smet

  
  

Op 19-01-13 21:08, Michiel Vermandel
  schreef:


  
Hi,

  
I am still struggling
to find why my simple unit test cannot be solved to a zero
score solution.
It is easily to see
the solution on sight and if I feed it with the prepared
solution (in a custom solver phase) it "finds" the optimal
solution right away.
  

If you can easily see the solution on sight, you should also be able
to easily see which move it should do to reach that optimal
solution.
What does logging with level TRACE print? Can you find the move it
should do in that log? What score does the log say that move has?

  
I'm trying everything
and try to review everything I have written.
It is during that
review that I noticed that the equals and hashcode methods
of my solution implementation class are never called.
Obviously the
solutionEquals and solutionHashCode methods of my planning
entity are never called either.
  

solutionEquals/HashCode is only called with
, which is worthless when scaling out
(unlike entityTabuSize).
A solution's equals/hashCode is never called.

 should be calling the planning entity's
equals/hashcode, at least in Planner 5.5-.
For Planner 6.0 I am looking into stop relying on the entity's
equals/hashcode, in case users have overwritten the default
java.lang.Object behavior in a way that's incompatible for Planner.

  

  
What should I conclude
out of that?
Is this a crucial
issue? If so, what should I check/change?
  

  
I am running Drools
Planner 5.5.0.Final on java 1.7.0 on a Windows 7 64bit
machine.

  
Thanks,

  
Michiel Vermandel
 
-
  http://www.codessentials.com - Your essential software, for
  free!
  Follow us at http://twitter.com/#!/Codessentials
  
  
  
  
  ___
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] ETA on drools 6?

2013-01-21 Thread kurrent93
Hi

I'm curious, when will drools 6 be released?

Also, about Guvnor-NG. I understand this will be written in Errai. Will it
be possible to host/embed elements as can be done now with Guvnor?

I also understand you will use Git. Will Guvnor also support databases, eg,
postgresql?

Is there any developer documentation for the next Guvnor?

Thanks and regards,
Anton





--
View this message in context: 
http://drools.46999.n3.nabble.com/ETA-on-drools-6-tp4021695.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] DSL Enumerations

2013-01-21 Thread rjr201
Hi,

I'm creating a DSL with dropdown boxes that are populated by enumerations. I
have so far had success in making one drop down box dependent on the value
of another dropdown box on the same [when] line:

[when]For every {objectType:ENUM:Object.type} with
{attribute:ENUM:Object.attribute} equal to {value:ENUM:Object.value} =
{objectType}({attribute} == "{value}")

In the above example whatever value is chosen for objectType will dictate
the values in the attribute dropdown which in turn dictates the values in
the Value dropdown. 

My question is this: Is it possible to have a dropdown box reliant on the
value of a dropdown box on a /different / line of the rule?

I've tried a few different ways but am having no luck. 

Thanks for any help anyone can give me on this.
Rich. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/DSL-Enumerations-tp4021696.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] ETA on drools 6?

2013-01-21 Thread Mark Proctor

On 21 Jan 2013, at 15:49, kurrent93  wrote:

> Hi
> 
> I'm curious, when will drools 6 be released?
some time in march.
> 
> Also, about Guvnor-NG. I understand this will be written in Errai. Will it
> be possible to host/embed elements as can be done now with Guvnor?
> 
> I also understand you will use Git. Will Guvnor also support databases, eg,
> postgresql?
no, git will be the only backend. Although DB's will be used for searching, via 
lucene.
> 
> Is there any developer documentation for the next Guvnor?
not yet, we are trying to get an alpha together, over next week or so.

As soon as anything is out, it will be on the blog.
> 
> Thanks and regards,
> Anton
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/ETA-on-drools-6-tp4021695.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] ETA on drools 6?

2013-01-21 Thread kurrent93
Thanks Mark

Your work and effort is greatly appreciated.




On Mon, Jan 21, 2013 at 6:50 PM, Mark Proctor [via Drools] <
ml-node+s46999n4021698...@n3.nabble.com> wrote:

>
> On 21 Jan 2013, at 15:49, kurrent93 <[hidden 
> email]>
> wrote:
>
> > Hi
> >
> > I'm curious, when will drools 6 be released?
> some time in march.
> >
> > Also, about Guvnor-NG. I understand this will be written in Errai. Will
> it
> > be possible to host/embed elements as can be done now with Guvnor?
> >
> > I also understand you will use Git. Will Guvnor also support databases,
> eg,
> > postgresql?
> no, git will be the only backend. Although DB's will be used for
> searching, via lucene.
> >
> > Is there any developer documentation for the next Guvnor?
> not yet, we are trying to get an alpha together, over next week or so.
>
> As soon as anything is out, it will be on the blog.
>
> >
> > Thanks and regards,
> > Anton
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://drools.46999.n3.nabble.com/ETA-on-drools-6-tp4021695.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > ___
> > rules-users mailing list
> > [hidden email] 
> > https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ___
> rules-users mailing list
> [hidden email] 
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
> http://drools.46999.n3.nabble.com/ETA-on-drools-6-tp4021695p4021698.html
>  To unsubscribe from ETA on drools 6?, click 
> here
> .
> NAML
>




--
View this message in context: 
http://drools.46999.n3.nabble.com/ETA-on-drools-6-tp4021695p4021699.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] Best Webserver to put in front of Drools Planner?

2013-01-21 Thread Geoffrey De Smet

  
  

Op 21-01-13 10:13, Michiel Vermandel
  schreef:


  @Geoffrey: is there a
possibility to get payed support on Drools Planner?
  

Hi Michiel,

Red Hat sells support subscriptions on the product releases of a
subset of its community projects, such as Drools.
We're now preparing to offer a tech-preview subscription on Drools
Planner later this year, as part of the product BRMS.
If you're interested in such a subscription, please contact your
local sales office.
  http://www.redhat.com/contact/sales.html

As Products of Interest select "JBoss Enterprise BRMS".

  
Thanks,

Michiel Vermandel

  
 
-
  http://www.codessentials.com - Your essential software, for
  free!
  Follow us at http://twitter.com/#!/Codessentials


  
 
 From:
Geoffrey De Smet 
To:
Michiel Vermandel ; Rules
Users List  
Sent:
Monday, January 21, 2013 9:50 AM
Subject:
Re: Best Webserver to put in front of Drools Planner?
   


   
Op 21-01-13
  07:47, Michiel Vermandel schreef:


  Hi,

I need to make the planning engine to be accessible
through a SOAP webservice.
A SOAP message with planning entity/variable data
needs to be sent, which starts a planning threat.

What is the best approach here?

Camel + JBoss AS 7 :)

Like drools-camel, one day we 'll build
drools-planner-camel (direct integration to expose
drools-planner as a SOAP/REST webservice through camel)
that will work on any servlet container, but not any day
soon.


   Just take a
Tomcat server and a custom SOAP Webapp?

Thanks,

Michiel

  
 
-
  http://www.codessentials.com - Your essential
  software, for free!
  Follow us at http://twitter.com/#!/Codessentials
  
  
  
  
  ___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



  



  

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



  

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


[rules-users] multi-tier decision application in drools server

2013-01-21 Thread Yuri
Hi Everyone,
I am trying to use drools 5.5.0 to provide approval/denial for a case.  The
best way to represent our business logic is through a workflow where the
user-inserted facts get processed in a particular step, and the RHS of the
rules in that step insert new facts for the next step in the flow, until,
at the end, a decision fact is generated.  Looking at the Drools Expert
tutorial, this is very similar to the driver license application, except
that mine has a jbpm flow.  As such, I have been using a stateless session
to get my rules to work.
Until recently, I have been working on this problem as a local drools
expert solution, referencing the rules engine and the rules package
directly.  However, the final step was going to be to move this solution to
drools server so that the business logic could be accessed through a
RESTful interface.  I assumed that the main functionality available in the
drools rules engine would remain in drools server. However, when I saw the
following post, I became concerned that perhaps the functionality I took
for granted in Drools Expert does not exist in Drools Server.  The post was
recent and has not gotten a response, but if the response is indeed that
stateless sessions do not work with rule flows in drools server, I was
wondering if anyone had a suggestion for how I would tackle my workflow
problem.  Is there another way in drools server (other than salience) to
get different sets of rules to execute in a particular order and come up
with an answer at the end of the work flow?

http://drools.46999.n3.nabble.com/Ruleflow-not-working-with-stateless-session-in-drools-server-5-5-0-Final-td4021624.html

Best,
Yuri

PS. I have been able to reproduce the scenario described by the user in the
post above.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Planner - NurseRostering: MaxWorkingWeekendsInFourWeeks

2013-01-21 Thread John Poole
The parameters for MaxWorkingWeekendsInFourWeeks is in some of the
input files for the NurseRostering example, but it doesn't seem to be
the rules(drl) file.
Is it implemented elsewhere? I've tried doing is like this, but it
doesn't work as a HARD constraint. I'm running it as SOFT now, but  it
would nice to compare it to a better version.

//Rules for workingweekends
rule "insertWorkingWeekends"
when
MinMaxContractLine(contractLineType ==
ContractLineType.TOTAL_WORKING_WEEKENDS_IN_FOUR_WEEKS, enabled ==
true,
$contract : contract)
$employee : Employee(contract == $contract)
ShiftAssignment(employee == $employee, $shiftDateDayIndex :
shiftDate.dayIndex, weekend == true)
then
insertLogical(new WorkingWeekend($employee, $shiftDateDayIndex/7));
end

// Maximum working weekends in four weeks
rule "insertWorkingWeekendsInFourWeeks"
   // salience 1 // Do these rules first (optional, for performance)
when
MinMaxContractLine(contractLineType ==
ContractLineType.TOTAL_WORKING_WEEKENDS_IN_FOUR_WEEKS, enabled ==
true,
$contract : contract)
$employee : Employee(contract == $contract)
WorkingWeekend(employee == $employee, $week: week)
$workingWeekendTotal : Number() from accumulate(
$workingWeekend : WorkingWeekend(employee == $employee,
week >= $week, week-$week < 3 ),
count($workingWeekend)
)
then
insertLogical(new WorkingWeekendTotalFourWeeks($employee,
$workingWeekendTotal.intValue(), $week));
end


// Maximum working weekends in four weeks
rule "maxWorkingWeekendsInFourWeeks"
when
$contractLine : MinMaxContractLine(
contractLineType ==
ContractLineType.TOTAL_WORKING_WEEKENDS_IN_FOUR_WEEKS, maximumEnabled
== true,
$contract : contract, $maximumValue : maximumValue
)
$employee : Employee(contract == $contract)
WorkingWeekendTotalFourWeeks(employeeContract == $contract,
total > $maximumValue,
 employee==$employee, $total : total, $week : week)
then
insertLogical(new
IntConstraintOccurrence("maxWorkingWeekendsInFourWeeks",
ConstraintType.NEGATIVE_SOFT,
($total - $maximumValue) * $contractLine.getMaximumWeight(),
$employee, $week));
end
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] hot deployment behavior

2013-01-21 Thread William Guinn
Would someone be so kind to describe exactly what happens when we hot deploy a 
rule change to a stateful session. It looks like the old version of the rule is 
deleted, in turn forcing a retraction of any RHS that was logically inserted 
(all our inserts are logical) as a consequence of this rule (and any cascading 
effects) that has no other LHS to support its existence. Then the new rule is 
inserted, the agenda is rebuilt based on the current working memory contents, 
and the rule is automatically fired (in our case recreating everything it just 
deleted)

Do I have this right?

Is there a way to change the behavior to be less invasive? This "rebuild" can 
take minutes, and I am not running at high volume yet.

For example what if the updated rule logically has no impact on existing 
working memory contents, let's say it's a maintenance change for future facts 
or new conditions? If the operation did not delete and rebuild everything, 
rather if it determined the impact of the change, and only replaced 
retracted/deleted what is affected by the logic change, would this be faster?

Bottom line it would be highly desirable for this to be minimally invasive.

thanks

[cid:image001.gif@01CDF7F0.4B5CB130]
Bill Guinn   |  Sr. Vice President, and CTO
SUMMUS Software, Inc.
3179 Skyway Court, Fremont, CA 94539
510.780.3895 office  |  916.715.6433 mobile
@summussoftware twitter
william.gu...@summussoftware.com

[cid:image002.png@01CDF7F0.4B5CB130]  [cid:image003.jpg@01CDF7F0.4B5CB130] 





NOTICE TO RECIPIENT: THIS E-MAIL (INCLUDING ANY ATTACHMENTS) IS MEANT FOR ONLY 
THE INTENDED RECIPIENT OF THE TRANSMISSION, MAY CONTAIN CONFIDENTIAL 
INFORMATION, AND IS PROTECTED BY LAW. IF YOU RECEIVED THIS E-MAIL IN ERROR, 
PLEASE IMMEDIATELY NOTIFY THE SENDER OF THE ERROR BY RETURN E-MAIL, DELETE THIS 
COMMUNICATION AND SHRED ANY ATTACHMENTS. UNAUTHORIZED REVIEW, USE, 
DISSEMINATION, DISTRIBUTION, COPYING OR TAKING OF ANY ACTION BASED ON THIS 
COMMUNICATION IS STRICTLY PROHIBITED.
<><><>___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] hot deployment behavior

2013-01-21 Thread Mark Proctor
You have it right.

If any rule is modified, it's effective removed and added.  Removal of a rule, 
remove's all it's matches, activations and logical inserts.

There is no way to preserve this information for a rule that modified.

It would be very hard to determine what information is or is not safe to 
preserve.

If the rule is a very minor change then add a new rule instead, it will re-use 
all the available sharing (matched information). It can build up a second set 
of justifiers for the logical insertions. Then you can remove the old role.

Mark
On 21 Jan 2013, at 23:59, William Guinn  
wrote:

> Would someone be so kind to describe exactly what happens when we hot deploy 
> a rule change to a stateful session. It looks like the old version of the 
> rule is deleted, in turn forcing a retraction of any RHS that was logically 
> inserted (all our inserts are logical) as a consequence of this rule (and any 
> cascading effects) that has no other LHS to support its existence. Then the 
> new rule is inserted, the agenda is rebuilt based on the current working 
> memory contents, and the rule is automatically fired (in our case recreating 
> everything it just deleted) 
> 
> Do I have this right? 
> 
> Is there a way to change the behavior to be less invasive? This "rebuild" can 
> take minutes, and I am not running at high volume yet. 
> 
> For example what if the updated rule logically has no impact on existing 
> working memory contents, let’s say it’s a maintenance change for future facts 
> or new conditions? If the operation did not delete and rebuild everything, 
> rather if it determined the impact of the change, and only replaced 
> retracted/deleted what is affected by the logic change, would this be faster? 
> 
> Bottom line it would be highly desirable for this to be minimally invasive. 
> 
> thanks
>  
> 
> Bill Guinn   |  Sr. Vice President, and CTO 
> SUMMUS Software, Inc.
> 3179 Skyway Court, Fremont, CA 94539
> 510.780.3895 office  |  916.715.6433 mobile
> @summussoftware twitter
> william.gu...@summussoftware.com
>  
>   
>  
>  
> 
> NOTICE TO RECIPIENT: THIS E-MAIL (INCLUDING ANY ATTACHMENTS) IS MEANT FOR 
> ONLY THE INTENDED RECIPIENT OF THE TRANSMISSION, MAY CONTAIN CONFIDENTIAL 
> INFORMATION, AND IS PROTECTED BY LAW. IF YOU RECEIVED THIS E-MAIL IN ERROR, 
> PLEASE IMMEDIATELY NOTIFY THE SENDER OF THE ERROR BY RETURN E-MAIL, DELETE 
> THIS COMMUNICATION AND SHRED ANY ATTACHMENTS. UNAUTHORIZED REVIEW, USE, 
> DISSEMINATION, DISTRIBUTION, COPYING OR TAKING OF ANY ACTION BASED ON THIS 
> COMMUNICATION IS STRICTLY PROHIBITED.
> ___
> 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] Implementing Refraction with Drools

2013-01-21 Thread magaram
I believe we can inject in Refraction capabilities into Drools Rule Engine
using a simple Agenda Filter. I have tested this with test cases against
JRules and Drools and get similar results. Without the Refraction Agenda
Filter it loops infinitely as expected. 

Please try it out and tell me what you think. I believe refraction is a much
needed feature of a forward chaining rule engine for commercial purposes.
Any feedback is deeply appreciated.

Here is what the code looks like

-Agenda Filter---


package test;

import java.util.ArrayList;
import java.util.List;

import org.drools.runtime.rule.Activation;
import org.drools.runtime.rule.AgendaFilter;

/**
* This custom agenda filter injects refraction behavior into the rule engine
* @author Mukundan Agaram
*
*/
public class RefractionAgendaFilter implements AgendaFilter {
private List encounteredActivations = new ArrayList();

@Override
public boolean accept(Activation act) 
{
//Check for a Refraction
if (encounteredActivations.contains(act))
{
//Remove from encountered activations for future firing
encounteredActivations.remove(act);
//return false so the rule is not selected as part of the refraction
return false;
}
//Otherwise add the rule to check for potential refractions in the future
encounteredActivations.add(act);
//select the rule to be part of the agenda
return true;
}

}

-DRL
//created on: Jan 15, 2013
package test
dialect "mvel"

rule testFooBar1
salience 100
when
$foo : Foo()
$bar : Bar(y > 0)
then
$foo.setX(($foo.getX() + $bar.getY()));
System.out.println("Fired "+drools.getRule().getName())
update($foo);
end

rule testFooBar2
salience 150
when
$foo : Foo(x >= 6)
then
System.out.println("Fired "+drools.getRule().getName())
end

rule testFooBar3
salience 50
when
$foo : Foo(x >= 7)
then
System.out.println("Fired "+drools.getRule().getName())
end

Runtime execution code--

package test;

import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;

public class TestFooBarMain {

private static void test()
{
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add( ResourceFactory.newClassPathResource( "TestFooBar.drl",
TestFooBarMain.class ),

ResourceType.DRL );

if ( kbuilder.hasErrors() ) {

System.out.println( kbuilder.getErrors().toString() );

}
else
{
System.out.println("DRL parsing - success!");
}


KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); 
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

Foo foo1 = new Foo();
foo1.setX(6);

Bar bar1 = new Bar();
bar1.setY(3);

ksession.insert(foo1);
ksession.insert(bar1);

ksession.fireAllRules(new RefractionAgendaFilter());
}



/**
* @param args
*/
public static void main(String[] args) {
test();

}

}

Facts-
package test;

public class Foo {

private int x;
private int y;

public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}

package test;

public class Bar {

public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}

private int x;
private int y;
}



Thanks,
Mukundan Agaram




--
View this message in context: 
http://drools.46999.n3.nabble.com/Implementing-Refraction-with-Drools-tp4021705.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] Implementing Refraction with Drools

2013-01-21 Thread Davide Sottara
Recently, Esteban covered the topic quite extensively, you can start from
there:

http://ilesteban.wordpress.com/2012/11/16/about-drools-and-infinite-execution-loops/

Best
Davide

Unfortunately, I'm afraid your proposal doesn't scale as well as impacting
performance and
expected behavior negatively



--
View this message in context: 
http://drools.46999.n3.nabble.com/Implementing-Refraction-with-Drools-tp4021705p4021706.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