Re: [rules-users] Controlling Rule Execution

2013-07-31 Thread Wolfgang Laun
On 31/07/2013, jking527467 jason.k...@openroadsconsulting.com wrote:
 All,

 I'm new to Drools and I'm faced with what seems to be a pretty trivial task
 that's taken a lot longer than expected.

 I'm working mainly with distances and am looking for an plain English
 response to this trivial problem.

Plain English? Here is it in DRL:

rule not active thing
when
Range( $near: near, $far: far )
$a: Actor()
$t: Thing( ! active )
then
end

rule activate near range
extends not active thing
when
eval( isInRange( $a, $t, $near ) )
then
modify( $t ){ setActive( true ) }
end

rule activate far range
extends not active thing
when
not ( $n: Thing( isInRange( $a, $n, $near ) ) )
eval( isInRange( $a, $t, $far ) )
then
modify( $t ){ setActive( true ) }
end


 Here's the problem:

 - Activate all things within x miles.
   - If nothing is within x miles, activate all things within y miles.

 It seems pretty straight forward but here's my dilemma.  If I execute on y
 miles first, everything within x miles will also be activated.  I need to
 ensure the things between x and y miles aren't activated if anything is
 within x miles of a certain fact.

Don't think in terms of executing first and (needlessly) exercising control.#

As you can see from the rules, simply transform your spec into LHS
patterns. Both clauses have their one-to-one correspondence in the
second and third rule, respectively, while the first one simply
addresses the player facts.

-W


 Does this make any sense to anyone?  I'm have a hard time grasping the
 proper approach and have looked into activation groups, etc. but haven't
 had
 any luck.

 Any help is GREATLY appreciated!!!

 Thanks in advance!
 Jason



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Controlling-Rule-Execution-tp4025231.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] NullPointerException when updating a fact

2013-07-31 Thread Davide Sottara
5.6 already solves the NPE with this particular ruleset.
It is ready to be released, one last issue pending.
It will likely be the last of the 5.x series.. anyone willing to give it
a try
is more than welcome
Davide


On 07/30/2013 08:06 AM, Stephen Masters wrote:
 So far I have stuck with 5.3.0. It's not perfect, but I have found it pretty 
 good and reliable.

 I think that 5.4.0 was a reasonable improvement, but I haven't used it in 
 anger. For me, there wasn't enough improvement in it from 5.3 to merit 
 spending time on an upgrade, so I was waiting for 5.5.0. Maybe others could 
 chime in on that one.

 I did spend time upgrading my 5.3 project to 5.5.0, because it looked so 
 promising. But I encountered several critical bugs which meant that large 
 chunks of Guvnor functionality just didn't work. I fell back to 5.3.0 again.

 I'm really hoping to see 5.5.1 before too long, but I think that it has been 
 a couple of weeks away for the past 6 months, so I'm not holding my breath. 
 :)

 Given the extent of change in 6, I wouldn't recommend going anywhere near it 
 unless you're just tinkering with it in your own time to see where things are 
 going. I'm doing that myself at the moment, but it's hard work given the lack 
 of documentation or books. I suspect that we'll be hit by a big wave of books 
 on it before long!

 So I guess that if I was starting a new project for a client, I would 
 probably go with 5.4.0.Final.

 Steve


 On 30 Jul 2013, at 15:18, schenka7 eugen.berenst...@gmail.com wrote:

 Thank you Steve, you are right. It was a bug in the 5.5.0.Final. 
 After I switched to 5.4.0.Final it started to work. 

 I was suspecting that the newer version is the one with the most bug fixes.
 Apparently I was wrong.
 Which version of Drools would you recommend?



 --
 View this message in context: 
 http://drools.46999.n3.nabble.com/NullPointerException-when-updating-a-fact-tp4025181p4025217.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] No errors thrown from KnowledgeAgent

2013-07-31 Thread Davide Sottara
The KA logs to a SystemEventListener, and supports a dedicated event
listener for
additions/updates/etc...

You can do:

kagent.setSystemEventListener( new PrintStreamSystemEventListener() );
kagent.addEventListener( new DebugKnowledgeAgentEventListener(  ) );



On 07/30/2013 01:55 AM, De Rooms Brecht wrote:
 Dear Drools users,

 I have been testing with the KnowledgeAgent from version 5.4 and 5.5. It 
 monitors a changeset and is set to incrementally build the 
 knowledgebase. I noticed that it sometimes crashes but never throws out 
 errors. This happens for example when I define a type two times and when 
 I remove a file. Does anyone experience similar behaviour and has an 
 idea of how I could see the errors? I already tried to check the errors 
 by building it myself using a knowledgebuilder before I update the file 
 that the knowledgeAgent monitors but that's quite a dirty solution.

 Kind Regards,
 De Rooms Brecht
 ___
 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] NullPointerException when updating a fact

2013-07-31 Thread Wolfgang Laun
Ids there any 5.6.0-x with x != Final to be downloaded?
-W

On 31/07/2013, Davide Sottara dso...@gmail.com wrote:
 5.6 already solves the NPE with this particular ruleset.
 It is ready to be released, one last issue pending.
 It will likely be the last of the 5.x series.. anyone willing to give it
 a try
 is more than welcome
 Davide


 On 07/30/2013 08:06 AM, Stephen Masters wrote:
 So far I have stuck with 5.3.0. It's not perfect, but I have found it
 pretty good and reliable.

 I think that 5.4.0 was a reasonable improvement, but I haven't used it in
 anger. For me, there wasn't enough improvement in it from 5.3 to merit
 spending time on an upgrade, so I was waiting for 5.5.0. Maybe others
 could chime in on that one.

 I did spend time upgrading my 5.3 project to 5.5.0, because it looked so
 promising. But I encountered several critical bugs which meant that large
 chunks of Guvnor functionality just didn't work. I fell back to 5.3.0
 again.

 I'm really hoping to see 5.5.1 before too long, but I think that it has
 been a couple of weeks away for the past 6 months, so I'm not holding my
 breath. :)

 Given the extent of change in 6, I wouldn't recommend going anywhere near
 it unless you're just tinkering with it in your own time to see where
 things are going. I'm doing that myself at the moment, but it's hard work
 given the lack of documentation or books. I suspect that we'll be hit by a
 big wave of books on it before long!

 So I guess that if I was starting a new project for a client, I would
 probably go with 5.4.0.Final.

 Steve


 On 30 Jul 2013, at 15:18, schenka7 eugen.berenst...@gmail.com wrote:

 Thank you Steve, you are right. It was a bug in the 5.5.0.Final.
 After I switched to 5.4.0.Final it started to work.

 I was suspecting that the newer version is the one with the most bug
 fixes.
 Apparently I was wrong.
 Which version of Drools would you recommend?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NullPointerException-when-updating-a-fact-tp4025181p4025217.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 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] NullPointerException when updating a fact

2013-07-31 Thread Davide Sottara
Seems they forgot to put 5.6 on CI.. I've asked a few times, with little
success :(
I'll try again.
Otherwise, one would have to download the source code and build it locally

On 07/31/2013 12:53 AM, Wolfgang Laun wrote:
 Ids there any 5.6.0-x with x != Final to be downloaded?
 -W

 On 31/07/2013, Davide Sottara dso...@gmail.com wrote:
 5.6 already solves the NPE with this particular ruleset.
 It is ready to be released, one last issue pending.
 It will likely be the last of the 5.x series.. anyone willing to give it
 a try
 is more than welcome
 Davide


 On 07/30/2013 08:06 AM, Stephen Masters wrote:
 So far I have stuck with 5.3.0. It's not perfect, but I have found it
 pretty good and reliable.

 I think that 5.4.0 was a reasonable improvement, but I haven't used it in
 anger. For me, there wasn't enough improvement in it from 5.3 to merit
 spending time on an upgrade, so I was waiting for 5.5.0. Maybe others
 could chime in on that one.

 I did spend time upgrading my 5.3 project to 5.5.0, because it looked so
 promising. But I encountered several critical bugs which meant that large
 chunks of Guvnor functionality just didn't work. I fell back to 5.3.0
 again.

 I'm really hoping to see 5.5.1 before too long, but I think that it has
 been a couple of weeks away for the past 6 months, so I'm not holding my
 breath. :)

 Given the extent of change in 6, I wouldn't recommend going anywhere near
 it unless you're just tinkering with it in your own time to see where
 things are going. I'm doing that myself at the moment, but it's hard work
 given the lack of documentation or books. I suspect that we'll be hit by a
 big wave of books on it before long!

 So I guess that if I was starting a new project for a client, I would
 probably go with 5.4.0.Final.

 Steve


 On 30 Jul 2013, at 15:18, schenka7 eugen.berenst...@gmail.com wrote:

 Thank you Steve, you are right. It was a bug in the 5.5.0.Final.
 After I switched to 5.4.0.Final it started to work.

 I was suspecting that the newer version is the one with the most bug
 fixes.
 Apparently I was wrong.
 Which version of Drools would you recommend?



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/NullPointerException-when-updating-a-fact-tp4025181p4025217.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 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] uninformative rule parsing/compiling error - org.drools.rule.Rule cannot be cast to org.drools.rule.Query

2013-07-31 Thread Davide Sottara
I could not reproduce the issue..
could you submit a self-contained, obfuscated test case (DRL + classes)?
I suspect you are leaving out some detail which is the real cause of the
error
Thanks
Davide

p.s. I used this mock class:

package vrpn;

public class TrackerRemote {

public TrackerUpdate getUpdate() {

return new TrackerUpdate();

}

public class TrackerUpdate {

}

}


and your rule, removing the message from the RHS



On 07/30/2013 01:51 AM, De Rooms Brecht wrote:
 Op 24/07/2013 14:24, Davide Sottara schreef:
 Two clarifications first:

 1) Which version are you using?
 I am using version 5.5
 2) Is TrackerUpdate a static class inside TrackerRemote?
 In case, could you post the exact import statements you are using?

 the TrackerUpdate is not static, but it's a class defined within the
 TrackerUpdate class.
 /public class TrackerRemote
 
  public class TrackerUpdate {
 public java.util.Date msg_time;
 public int sensor;
 public double[] pos;
 public double[] quat;

 public TrackerUpdate() { /* compiled code */ }
 }/

 The full imports and rule is:
 package derooms.be.testRule
 import derooms.be.server.predefinedtypes.Event;
 import derooms.be.test.Message;
 import vrpn.TrackerRemote;
 /
 rule TrackerRemote.TrackerUpdate
 when
 message:TrackerRemote.TrackerUpdate()
 then
 System.out.println(Tracker:  + message);
 end/

 Sorry that I didn't sent it earlier, I actually sent this e-mail
 already but it didn't came through.

 B

 Thanks
 Davide

 On 07/24/2013 02:14 PM, De Rooms Brecht wrote:
 Dear rules users,

 I am currently writing my own Drools-server since I wanted more
 control than the drools-execution server (and it never worked very
 well here) where I can send rules/facts over JMS/AQMP/STOMP. Rules
 which are sent are saved on the server-side in DRL files that are
 monitored. That way, I can debug easily by changing the sent files.
 However, when I sent the following code, the agent does not provide
 me with an error message at all and hangs:
 /
 //rule TrackerRemote.TrackerUpdate//
 //when//
 //message:TrackerRemote.TrackerUpdate()//
 //then//
 //System.out.println(Tracker:  + message);//
 //end/

 at first I thought it was because TrackerRemote.TrackerUpdate is not
 in that package anymore and thus unknown so I tried to send the rule
 listed below which gives me the nice and expected error:
 Unable to resolve ObjectType 'NotExistingType' : [Rule name='Foo']

 /rule Foo//
 //when //
 //NotExistingType( bloe == test)//
 //then//
 //System.out.println(this should not work);//
 //end/

 when I compile the rule myself with a KnowledgeBuilder:

 KnowledgeBuilder kbuilder =
 KnowledgeBuilderFactory.newKnowledgeBuilder();
 InputStream is = new ByteArrayInputStream(drlstring.getBytes());
 kbuilder.add(
 ResourceFactory.newInputStreamResource(is),ResourceType.DRL );

 I receive the error:
 org.drools.rule.Rule cannot be cast to org.drools.rule.Query
 which I think doesn't tell me anything about the mistake I made in
 my rule, is this a Drools bug and should I post this somewhere?

 Kind Regards,
 De Rooms Brecht


 Full Stack:
 java.lang.ClassCastException: org.drools.rule.Rule cannot be cast to
 org.drools.rule.Query
 at
 org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:175)
 at
 org.drools.rule.builder.PatternBuilder.build(PatternBuilder.java:118)
 at
 org.drools.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:67)
 at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:84)
 at
 org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2706)
 at
 org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:930)
 at
 org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:839)
 at
 org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:831)
 at
 org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:467)
 at
 org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:673)
 at
 org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:45)
 at
 org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
 at
 derooms.be.server.listeners.RulesListener.processMessage(RulesListener.java:33)
 at
 derooms.be.server.listeners.AbstractListener.onMessage(AbstractListener.java:35)
 at
 org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1321)
 at
 org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)
 at
 org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)
 at
 org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
 at
 org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
 at
 

Re: [rules-users] No errors thrown from KnowledgeAgent

2013-07-31 Thread De Rooms Brecht

Hello David and thanks for responding.
I know it supports these event listeners and I use them. In my program, 
I have two knowledge agents and the first one (preprocessing) will read 
the file, preprocess a DRL and then write a second modified DRL file in 
a folder that is monitored by the second one. When I modify the original 
DRL file *(1.* in prints below*)* monitored by the preprocessing agent, 
everything works fine and the rule is triggered*(**2.)*. However, when I 
delete a file *(**3.)*, the knowledgeAgent just blocks after 
AfterChangeSetAppliedEvent and does not do anything anymore.. If I send 
new data in the knowledgeAgent it does not react anymore.


I would expect to get a stacktrace of what went wrong but I do not get 
any info besides of the systemeventlistener or knowledgeagentlistener. 
Is there any way I can get a stacktrace?

Kind Regards,
De Rooms Brecht

_*1. Resources Changed = Modified:  [[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]*_
/eventListener 1::: 
==[BeforeResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]//
//eventListener 1::: 
==[AfterResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]//
//eventListener 1::: ==[AfterChangeSetProcessedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 1::: ==[ResourceCompilationFailedEvent: 
org.drools.builder.impl.KnowledgeBuilderImpl@70d0d127]//
//eventListener 1::: ==[KnowledgeBaseUpdatedEvent: 
org.drools.impl.KnowledgeBaseImpl@49669be]//
//eventListener 1::: ==[AfterChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 2::: ==[BeforeChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\packaged\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 2::: 
==[BeforeResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\packaged\test.brules.testRule.drl']]//
//eventListener 2::: 
==[AfterResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\packaged\test.brules.testRule.drl']]//
//eventListener 2::: ==[AfterChangeSetProcessedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\packaged\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 2::: ==[KnowledgeBaseUpdatedEvent: 
org.drools.impl.KnowledgeBaseImpl@11c834d1]/


_*2. Rules are triggered when the PKG file its knowledge is updated:*_
/Changed This Rule::: Got Event: TestEvent( number=5, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=4, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=2, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=1, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=2, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=1, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=2, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=1, 
message=doesDynamicEventTypeWork? )//

//
//eventListener 2::: ==[AfterChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\packaged\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 1::: ==[BeforeChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
resourcesAdded=[], resourcesModified=[], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 1::: ==[BeforeChangeSetProcessedEvent: 
ChangeSetImpl{resourcesRemoved=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
resourcesAdded=[], resourcesModified=[], knowledgeDefinitionsRemoved=[]}]/



_*3. *__*Resources Changed = *__*Removed:   [[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]*_
/eventListener 1::: 
==[BeforeResourceProcessedEvent(RESOURCE_MODIFIED): [FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]//
//eventListener 1::: 
==[AfterResourceProcessedEvent(RESOURCE_MODIFIED): [FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]//
//eventListener 1::: ==[AfterChangeSetProcessedEvent: 

Re: [rules-users] No errors thrown from KnowledgeAgent

2013-07-31 Thread De Rooms Brecht
The bug was caused by one of the InputStreams that was not closed 
properly which caused the knowledgeAgent to block.

I think my issues are solved now.

Thanks for looking into this.
Kind Regards,

Op 31/07/2013 14:19, De Rooms Brecht schreef:

Hello David and thanks for responding.
I know it supports these event listeners and I use them. In my 
program, I have two knowledge agents and the first one (preprocessing) 
will read the file, preprocess a DRL and then write a second modified 
DRL file in a folder that is monitored by the second one. When I 
modify the original DRL file *(1.* in prints below*)* monitored by the 
preprocessing agent, everything works fine and the rule is 
triggered*(**2.)*. However, when I delete a file *(**3.)*, the 
knowledgeAgent just blocks after AfterChangeSetAppliedEvent and does 
not do anything anymore.. If I send new data in the knowledgeAgent it 
does not react anymore.


I would expect to get a stacktrace of what went wrong but I do not get 
any info besides of the systemeventlistener or knowledgeagentlistener. 
Is there any way I can get a stacktrace?

Kind Regards,
De Rooms Brecht

_*1. Resources Changed = Modified:  [[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]*_
/eventListener 1::: 
==[BeforeResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]//
//eventListener 1::: 
==[AfterResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]//
//eventListener 1::: ==[AfterChangeSetProcessedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 1::: ==[ResourceCompilationFailedEvent: 
org.drools.builder.impl.KnowledgeBuilderImpl@70d0d127]//
//eventListener 1::: ==[KnowledgeBaseUpdatedEvent: 
org.drools.impl.KnowledgeBaseImpl@49669be]//
//eventListener 1::: ==[AfterChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 2::: ==[BeforeChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\packaged\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 2::: 
==[BeforeResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\packaged\test.brules.testRule.drl']]//
//eventListener 2::: 
==[AfterResourceProcessedEvent(RESOURCE_REMOVED): [FileResource 
file='knowledge\packaged\test.brules.testRule.drl']]//
//eventListener 2::: ==[AfterChangeSetProcessedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\packaged\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 2::: ==[KnowledgeBaseUpdatedEvent: 
org.drools.impl.KnowledgeBaseImpl@11c834d1]/


_*2. Rules are triggered when the PKG file its knowledge is updated:*_
/Changed This Rule::: Got Event: TestEvent( number=5, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=4, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=2, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=1, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=2, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=1, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=2, 
message=doesDynamicEventTypeWork? )//
//Changed This Rule::: Got Event: TestEvent( number=1, 
message=doesDynamicEventTypeWork? )//

//
//eventListener 2::: ==[AfterChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[], resourcesAdded=[], 
resourcesModified=[[FileResource 
file='knowledge\packaged\test.brules.testRule.drl']], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 1::: ==[BeforeChangeSetAppliedEvent: 
ChangeSetImpl{resourcesRemoved=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
resourcesAdded=[], resourcesModified=[], 
knowledgeDefinitionsRemoved=[]}]//
//eventListener 1::: ==[BeforeChangeSetProcessedEvent: 
ChangeSetImpl{resourcesRemoved=[[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']], 
resourcesAdded=[], resourcesModified=[], knowledgeDefinitionsRemoved=[]}]/



_*3. *__*Resources Changed = *__*Removed:   [[FileResource 
file='knowledge\realtimeKnowledge\test.brules.testRule.drl']]*_
/eventListener 1::: 
==[BeforeResourceProcessedEvent(RESOURCE_MODIFIED): [FileResource 

Re: [rules-users] decision and prediction based on the same set of rules

2013-07-31 Thread Sean Su
I agree with your points, Steve.

I know this solution will require certain statements on the RHS which I
am trying to avoid due to the fact that the business team is authorizing
the rules. But I will keep that as an option.

Thanks

Sean


On Tue, Jul 30, 2013 at 5:36 PM, Stephen Masters stephen.mast...@me.comwrote:

 Something to consider, which I have used for some rules is that instead of
 those rules making a 'decision' they can insert a restriction fact.

 You can then create technical rules, which match on those restriction
 facts.

 Also, it's very simple to write code to look at the facts in the working
 memory, so you can establish what date range a restriction applies to. Much
 easier than examining the LHS of rules.

 Steve


 On 30 Jul 2013, at 20:49, Sean Su sean.x...@gmail.com wrote:

  Our rules will be using Date heavily when making decisions. When the
 LHS involving dates is evaluated true, decision will be made.
 
  Meanwhile, from prediction point of view, we want to know when the LHS
 would be evaluated to false, with the changes made to the date fields
 (forward to the future). Therefore this becomes prediction - what is the
 future date that would cause the LHS to be false.
 
  Question to the list:
  has anyone explored the possibility of using the same set of rules to
 achieve both tasks?
 
  If there is no tools automatically doing this in Drools (I doubt there
 is), I am thinking to build a tool to parse the rules and then
 auto-generate the prediction rules based on the decision rules. Is this
 the right direction?
 
  Any inputs will be appreciated.
 
  thanks
 
  Sean
  ___
  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] decision and prediction based on the same set of rules

2013-07-31 Thread Stephen Masters
btw - If you ever find the statements being written by the business team to be 
a bit weird, and overly technical, just create a simple DSL phrase to hide what 
is actually happening.

This way, you can have a statement Reject the request, which might in reality 
perform multiple actions, such as inserting and modifying facts.


On 31 Jul 2013, at 14:36, Sean Su sean.x...@gmail.com wrote:

 I agree with your points, Steve.
 
 I know this solution will require certain statements on the RHS which I am 
 trying to avoid due to the fact that the business team is authorizing the 
 rules. But I will keep that as an option.
 
 Thanks
 
 Sean
 
 
 On Tue, Jul 30, 2013 at 5:36 PM, Stephen Masters stephen.mast...@me.com 
 wrote:
 Something to consider, which I have used for some rules is that instead of 
 those rules making a 'decision' they can insert a restriction fact.
 
 You can then create technical rules, which match on those restriction facts.
 
 Also, it's very simple to write code to look at the facts in the working 
 memory, so you can establish what date range a restriction applies to. Much 
 easier than examining the LHS of rules.
 
 Steve
 
 
 On 30 Jul 2013, at 20:49, Sean Su sean.x...@gmail.com wrote:
 
  Our rules will be using Date heavily when making decisions. When the LHS 
  involving dates is evaluated true, decision will be made.
 
  Meanwhile, from prediction point of view, we want to know when the LHS 
  would be evaluated to false, with the changes made to the date fields 
  (forward to the future). Therefore this becomes prediction - what is the 
  future date that would cause the LHS to be false.
 
  Question to the list:
  has anyone explored the possibility of using the same set of rules to 
  achieve both tasks?
 
  If there is no tools automatically doing this in Drools (I doubt there is), 
  I am thinking to build a tool to parse the rules and then auto-generate the 
  prediction rules based on the decision rules. Is this the right direction?
 
  Any inputs will be appreciated.
 
  thanks
 
  Sean
  ___
  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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] Scheduling Application and Optaplanner

2013-07-31 Thread marchias
Just started researching OptaPlanner. Loaded examples in Eclipse and got them
running. I'm interested in extending the Nurse rostering example to work
with a scheduling application I have written. I have some interesting
constraints though that wanted to reach out to the community with to make
sure they can be accomodated. My scheduling app has a hierachical entity
setup with Organizations and child locations. An employee can be configured
to work at multiple locations and are also assigned a Primary location
which means they should be picked up on shifts at that location before an
employee that does not have that location as primary. Also I have a priority
group or ranking (1-10) which would be considered in sorting employees as
well. Shifts are location, date/time and skill specific with a configured
amount of resources needed.

Shift Examples

Location 1 = 2 nurses, (Monday Wednesay Friday), 7AM - 11PM
Location 1 = 1 nurse, (Sunday,Tuesday,Thursday,Saturday), 7AM - 11PM

Constraints for an employee

Max Hours/Week: 0.00
Min Hours/Week: 0.00
Max Hours/Day:  0.00
Min Hours/Day:  0.00
Max Days/Week:  0.00
Max Consecutive Days:   0.00
Max Shifts/Day: 0.00
Max Shifts/Month:   2.00
Max Weekend Shifts/Month0.00
Max Consecutive Shifts of Duration  0.00 consecutive 0.00 hr shifts





--
View this message in context: 
http://drools.46999.n3.nabble.com/Scheduling-Application-and-Optaplanner-tp4025244.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] decision and prediction based on the same set of rules

2013-07-31 Thread Sean Su
yeah, that is what we are doing to the complicated statements. We may end
up doing this for the prediction part.


On Wed, Jul 31, 2013 at 10:33 AM, Stephen Masters stephen.mast...@me.comwrote:

 btw - If you ever find the statements being written by the business team
 to be a bit weird, and overly technical, just create a simple DSL phrase to
 hide what is actually happening.

 This way, you can have a statement Reject the request, which might in
 reality perform multiple actions, such as inserting and modifying facts.


 On 31 Jul 2013, at 14:36, Sean Su sean.x...@gmail.com wrote:

 I agree with your points, Steve.

 I know this solution will require certain statements on the RHS which I
 am trying to avoid due to the fact that the business team is authorizing
 the rules. But I will keep that as an option.

 Thanks

 Sean


 On Tue, Jul 30, 2013 at 5:36 PM, Stephen Masters 
 stephen.mast...@me.comwrote:

 Something to consider, which I have used for some rules is that instead
 of those rules making a 'decision' they can insert a restriction fact.

 You can then create technical rules, which match on those restriction
 facts.

 Also, it's very simple to write code to look at the facts in the working
 memory, so you can establish what date range a restriction applies to. Much
 easier than examining the LHS of rules.

 Steve


 On 30 Jul 2013, at 20:49, Sean Su sean.x...@gmail.com wrote:

  Our rules will be using Date heavily when making decisions. When the
 LHS involving dates is evaluated true, decision will be made.
 
  Meanwhile, from prediction point of view, we want to know when the LHS
 would be evaluated to false, with the changes made to the date fields
 (forward to the future). Therefore this becomes prediction - what is the
 future date that would cause the LHS to be false.
 
  Question to the list:
  has anyone explored the possibility of using the same set of rules to
 achieve both tasks?
 
  If there is no tools automatically doing this in Drools (I doubt there
 is), I am thinking to build a tool to parse the rules and then
 auto-generate the prediction rules based on the decision rules. Is this
 the right direction?
 
  Any inputs will be appreciated.
 
  thanks
 
  Sean
  ___
  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 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