[rules-users] Rule Templates - Conditionally Generate Rule based on Values in Data

2013-06-18 Thread Jason Allen
All,

I saw this question was asked a couple of months ago with no reply, but thought 
I would try again.

In using a Rule Template, I'm trying to determine a way to dynamically generate 
rules based on a value in the data.

There is a data set, that has various pieces data, depending on a column value, 
the rule that is generated is relatively different.  Different enough that I 
wouldn't want the generated a rule for each row of data, because many of the 
rules generated would never fire.

In the drools expert docs, it lists under 6.1.7 Rule Templates the ability to 
conditionally generate rules based on the values in the data, but I can't 
seem to find the syntax for how to do that.

Does anyone know the answer to this?

I would picture it looking something like this

if (@{RevenueCode} == NR)
rule RevenueMapperRule_1
when
claim1 : ClaimFact (ProgramType in (FC, FCP, FALSE, FALSE),
ProcedureCode == NR,
(serviceBegin = 01-Oct-2003  
serviceBegin = 31-Dec-2030),
modifier1 in (U),
typeofBill == 3);
then
claim1.setResultSPCCode(507.11);
list.add(claim1);
end
end if

Essentially, the only time this rule would be generated is if RevenueCode in 
the Rules Spreadsheet had a value of NR.

If this is not possible, how should I be thinking about this problem?  Feels 
weird to generate a bunch of rules that will never fire, simply because there 
is no way to conditionally generate a rule.  Maybe the answer is to create 
separate rule files and template definitions?  That also feels like an over 
complication.

Thoughts?

Thanks in advance!

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

[rules-users] Rule Templates and Array Handling

2013-06-14 Thread Jason Allen
Hi All,

I'm trying to determine if it's possible to process arrays of data using Rule 
Templates.  An example of what I'm trying to accomplish.

Spreadsheet of rules, with one of the columns being valid colors.  Valid colors 
contains comma separated data and is variable length.

For example

It might contain: Blue, Green, Red or Blue, or Red, Green, Purple, Silver 
 Any number of entries.

I then need to process incoming fact values against this list of colors, using 
either CONTAINS or IN.

For example:

template header
desc
valid_colors[]

package org.drools.examples.templates

global com.sample.Product product;

template ColorTestTemplate

rule ColorRule_@{row.rowNumber}
when
product1 : Product (Color in @{valid_colors});
then
product1.setDesc(@{desc});
end
end template

I know the following doesn't work: product1 : Product (Color in 
@{valid_colors});

However, I wanted to depict what I'm trying to accomplish.

The challenge is with valid_colors being a variable length array, I can't refer 
to the individual values using constants i.e. valid_colors0, valid_colors1, 
valid_colors3, etc to build my array list.

ie Color in (@{valid_colors0}, @{valid_colors1}, @{valid_colors2})

Is there a way to iterate through a variable length array in a template?

Any thoughts on how I could build an array list i.e. (Blue, Green, Red) 
when the column contains a variable length array?

Thanks in advance,
Jason___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Rule Templates and Array Handling

2013-06-14 Thread Jason Allen
Thanks for the reply Wolfgang.

I chose to use the template because I liked the idea of separating the rule 
definition from the rule data.  Just seemed intuitive to me.  Overall, I'm new 
to Drools, so not sure if that is the best choice or not.

I think your approach works if my spreadsheet has all the items separated with 
commas and double quotes.  Because then it's just referring to the field as a 
simple string field, not an array of values.

When the field is in the spreadsheet as: Austria, Germany, Switzerland it needs 
to be handled as an array, otherwise it will build the generated rule as: 
Country(name in (Austria, Germany, Switzerland)) and fail compile because it's 
missing the quotes.  If you use @{country}) it will put (Austria, Germany, 
Switzerland), when you really need (Austria, Germany, Switzerland)

Maybe I'll just embed the double quotes in the spreadsheet and call it a day, 
instead of fighting the field as an array of values.

If you have any other thoughts, let me know!

Thanks,
Jason.


On Jun 14, 2013, at 1:33 PM, Wolfgang Laun wolfgang.l...@gmail.com wrote:

 In the spreadsheet (with class Country) you would have a column such as:
 CONDITION
 Country
 name in ( $param )
 Test whether name is one from a given set
  Austria, Germany, Switzerland
  France, Canada, Belgium
 
 This is the generated rule:
 
 rule InTest_18
   when
   $country: Country(name in ( Austria,Germany,Switzerland ))
   then
   System.out.println( German is spoken );
 end
 
 You should be able to retrofit the template from this. (Why do you
 need a template when you have a spreadsheet?)
 
 -W
 
 
 
 On 14/06/2013, Jason Allen jason.al...@data-sign.com wrote:
 Hi All,
 
 I'm trying to determine if it's possible to process arrays of data using
 Rule Templates.  An example of what I'm trying to accomplish.
 
 Spreadsheet of rules, with one of the columns being valid colors.  Valid
 colors contains comma separated data and is variable length.
 
 For example
 
 It might contain: Blue, Green, Red or Blue, or Red, Green, Purple,
 Silver  Any number of entries.
 
 I then need to process incoming fact values against this list of colors,
 using either CONTAINS or IN.
 
 For example:
 
 template header
 desc
 valid_colors[]
 
 package org.drools.examples.templates
 
 global com.sample.Product product;
 
 template ColorTestTemplate
 
 rule ColorRule_@{row.rowNumber}
 when
  product1 : Product (Color in @{valid_colors});
 then
  product1.setDesc(@{desc});
 end
 end template
 
 I know the following doesn't work: product1 : Product (Color in
 @{valid_colors});
 
 However, I wanted to depict what I'm trying to accomplish.
 
 The challenge is with valid_colors being a variable length array, I can't
 refer to the individual values using constants i.e. valid_colors0,
 valid_colors1, valid_colors3, etc to build my array list.
 
 ie Color in (@{valid_colors0}, @{valid_colors1}, @{valid_colors2})
 
 Is there a way to iterate through a variable length array in a template?
 
 Any thoughts on how I could build an array list i.e. (Blue, Green,
 Red) when the column contains a variable length array?
 
 Thanks in advance,
 Jason
 ___
 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] Rule Templates and Array Handling

2013-06-14 Thread Jason Allen
Thanks Wolfgang.

I think I see what you're saying.  If I need to do any complex prep, simply 
process it first, then build a collection of POJO objects for expansion by the 
drools template.

I also understand what you're saying about spreadsheets.  Most of this is just 
proof of concept I'm doing…I think you're right in maintaining the rule data 
somewhere else…i.e. database.

Thanks again for your help.

-Jason

On Jun 14, 2013, at 3:01 PM, Wolfgang Laun wolfgang.l...@gmail.com wrote:

 If you are expanding the template with data taken from anywhere
 you have the option of processing that data before you pass it
 to the expander. Section 2.5.2., Expanding a Template, explains
 how to do this. This is the option you have for implementing
 specific processing.
 
 The problem with data in a spreadsheet is that it doesn't have
 much of a data type along with it, so an entry such as x,y,z
 could be any of these: one string value, a list of numbers, a list
 of three string values, with quotes omitted, a list of enums, and so on.
 
 -W
 
 
 
 On 14/06/2013, Jason Allen jason.al...@data-sign.com wrote:
 Thanks for the reply Wolfgang.
 
 I chose to use the template because I liked the idea of separating the rule
 definition from the rule data.  Just seemed intuitive to me.  Overall, I'm
 new to Drools, so not sure if that is the best choice or not.
 
 I think your approach works if my spreadsheet has all the items separated
 with commas and double quotes.  Because then it's just referring to the
 field as a simple string field, not an array of values.
 
 When the field is in the spreadsheet as: Austria, Germany, Switzerland it
 needs to be handled as an array, otherwise it will build the generated rule
 as: Country(name in (Austria, Germany, Switzerland)) and fail compile
 because it's missing the quotes.  If you use @{country}) it will put
 (Austria, Germany, Switzerland), when you really need (Austria,
 Germany, Switzerland)
 
 Maybe I'll just embed the double quotes in the spreadsheet and call it a
 day, instead of fighting the field as an array of values.
 
 If you have any other thoughts, let me know!
 
 Thanks,
 Jason.
 
 
 On Jun 14, 2013, at 1:33 PM, Wolfgang Laun wolfgang.l...@gmail.com wrote:
 
 In the spreadsheet (with class Country) you would have a column such as:
 CONDITION
 Country
 name in ( $param )
 Test whether name is one from a given set
 Austria, Germany, Switzerland
 France, Canada, Belgium
 
 This is the generated rule:
 
 rule InTest_18
 when
 $country: Country(name in ( Austria,Germany,Switzerland ))
 then
 System.out.println( German is spoken );
 end
 
 You should be able to retrofit the template from this. (Why do you
 need a template when you have a spreadsheet?)
 
 -W
 
 
 
 On 14/06/2013, Jason Allen jason.al...@data-sign.com wrote:
 Hi All,
 
 I'm trying to determine if it's possible to process arrays of data using
 Rule Templates.  An example of what I'm trying to accomplish.
 
 Spreadsheet of rules, with one of the columns being valid colors.  Valid
 colors contains comma separated data and is variable length.
 
 For example
 
 It might contain: Blue, Green, Red or Blue, or Red, Green, Purple,
 Silver  Any number of entries.
 
 I then need to process incoming fact values against this list of colors,
 using either CONTAINS or IN.
 
 For example:
 
 template header
 desc
 valid_colors[]
 
 package org.drools.examples.templates
 
 global com.sample.Product product;
 
 template ColorTestTemplate
 
 rule ColorRule_@{row.rowNumber}
 when
product1 : Product (Color in @{valid_colors});
 then
product1.setDesc(@{desc});
 end
 end template
 
 I know the following doesn't work: product1 : Product (Color in
 @{valid_colors});
 
 However, I wanted to depict what I'm trying to accomplish.
 
 The challenge is with valid_colors being a variable length array, I
 can't
 refer to the individual values using constants i.e. valid_colors0,
 valid_colors1, valid_colors3, etc to build my array list.
 
 ie Color in (@{valid_colors0}, @{valid_colors1}, @{valid_colors2})
 
 Is there a way to iterate through a variable length array in a template?
 
 Any thoughts on how I could build an array list i.e. (Blue, Green,
 Red) when the column contains a variable length array?
 
 Thanks in advance,
 Jason
 ___
 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] Jboss Business Rules Management System (BRMS)

2013-05-17 Thread Jason Barto
Take a look at the jars in the brms install dir. The versions are usually
embedded in the filenames.
On May 17, 2013 12:57 PM, Michael Anstis michael.ans...@gmail.com wrote:

 Which version of BRMS?


 On 17 May 2013 12:54, abhinay_agarwal abhinay_agar...@infosys.com wrote:

 May I know which version of drools is bundled in Jboss Business Rules
 Management System (BRMS) ?

 Thanks,
 Abhinay



 --
 View this message in context:
 http://drools.46999.n3.nabble.com/Jboss-Business-Rules-Management-System-BRMS-tp4023870.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] Drools Fusion Dropping Events?

2013-05-16 Thread Jason Barto
Wolfgang,
the code to reproduce is below.  I'm hoping to process between 20k and 50k
events through Drools per second thus the extreme high-throughput testing.
I could settle for a single Drools node handling only say 5K per second IFF
I could cluster Drools but I've not yet found a way to distribute workload
across an active-active Drools cluster (seems there is no such thing?).

Since you're recommendation I've shifted to using Drools 5.3 just FYI:


### Average.java ###
package drools53fusioneval;

import java.io.IOException;
import java.util.Random;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseConfiguration;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.conf.EventProcessingOption;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.WorkingMemoryEntryPoint;

class AvgDFEChannel implements org.drools.runtime.Channel {

@Override
public void send(Object o) {
System.err.println(Recieved channel message:  + o);
}
}

public class Average {

public static void main(String[] args) throws InterruptedException,
IOException {
KnowledgeBaseConfiguration kbconfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kbconfig.setOption(EventProcessingOption.STREAM);

KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(kbconfig);

KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add(ResourceFactory.newClassPathResource(drools53fusioneval/basic.drl),
ResourceType.DRL);
if (kbuilder.hasErrors()) {
System.err.println(kbuilder.getErrors().toString());
}
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());

final StatefulKnowledgeSession session =
kbase.newStatefulKnowledgeSession();
session.registerChannel(heartbeat, new AvgDFEChannel());
WorkingMemoryEntryPoint ep01 =
session.getWorkingMemoryEntryPoint(ep01);

new Thread() {
public void run() {
session.fireUntilHalt();
}
}.start();

Thread.sleep(5000); // give the engine time to get setup

Server hiwaesdk = new Server(hiwaesdk);
session.insert(hiwaesdk);

long LIMIT = 1;
long sentCount = 0;
int batchSize = 1;
Random rnd = new Random(System.nanoTime());
int temp = 0;
long startTS = System.nanoTime();
while (sentCount  LIMIT) {
for (int i = 0; i  batchSize; i++) {
temp = rnd.nextInt(212);
IntEvent evt = new IntEvent (temp);
ep01.insert(evt);
sentCount++;
}
Thread.sleep (0x1);
}
double duration = (System.nanoTime() - startTS)/100.0;
System.out.println(LIMIT + events generated in + duration +
milliseconds);
System.out.println(Last temperature submitted: + temp);
for (int i = 0; i  5; i++) {
System.out.println (Sec + i +: + hiwaesdk.currentTemp +,
+ hiwaesdk.readingCount);
Thread.sleep (1000);
}
System.exit(0);
}
}


### basic.drl ###
package drools53fusioneval

declare IntEvent
@role ( event )
end

rule number rule
when
$e : IntEvent () from entry-point ep01
$s : Server (hostname == hiwaesdk)
then
$s.currentTemp = $e.data;
$s.readingCount++;
end




On Thu, May 16, 2013 at 4:25 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote:

 What you describe is definitely not expected behaviour - it's more
 like that race condition (or another one) already being in 5.3. Posting
 your code might be a good idea ;-)
 -W

 On 16/05/2013, Jason Barto jason.p.ba...@gmail.com wrote:
  I've been working to load test Drools 5.3 to determine if its a fit for a
  project.  As part of the test I programmatically insert events as rapidly
  as possible; an example, my earlier test inserted 10k events in about
  300ms.  There is currently a single rule which reads the event and stores
  the event's value into the only fact in Drools. I'm very happy to report,
  and I'm sure it will be no surprise to anyone, that the engine processes
  all the events in roughly 1 sec. However I have noticed that any large
  number of events (~1000) usually sees that a small number of events
 don't
  get processed. I think after 10k events as many as 7 appear to have gone
  unprocessed. If 100 events are inserted, rather than 10k, no events get
  disregarded.  Being new to Drools I can easily accept that my java code
 or
  DRL code is off or unoptimized in some way. However not knowing how
 Drools
  does its magic I'm currently inclined to think that Drools gets swamped
  (10k in 300ms is a lot) and a few events get dropped so Drools can keep
  operating. Is this a known

Re: [rules-users] NPE from reteoo.AccumulateNode

2013-05-15 Thread Jason Barto
Davide and Wolfgang, thank you both for your time and feedback into my
questions as well as to other's questions. I'm rather interested in
learning more about the internals of drools in the hopes of making
contribution when and where possible. I'd imagine there's a developer guide
that talks to fusion's architecture that would act as a companion to
reviewing the source code?

Sincerely,
Jason
On May 14, 2013 8:25 PM, Davide Sottara dso...@gmail.com wrote:

  Confirmed as a race condition, hopefully it will be fixed in 5.6
 Thanks Jason and Wolfgang
 Davide

 On 05/14/2013 06:43 AM, Jason Barto wrote:

 Thanks Wolfgang. I'll change over to the 5.3 libraries and carry on with
 my testing. I'll also enter this issue into jira if it doesn't yet exist.

 Sincerely,
 Jason
 On May 14, 2013 11:30 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote:

 Looks like a bug in Drools to me. It has the classic hallmark of a
 race condition: the NPE does not happen with every run (on my system),
 perhaps only with 85%.

 Moreover, with 5.4.0 I get a similar NPE and also:
 Exception in thread main java.util.NoSuchElementException
 at java.util.LinkedList.remove(LinkedList.java:788)
 at java.util.LinkedList.removeFirst(LinkedList.java:134)
 at
 org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:344)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:342)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:123)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:53)
 at overrun.Main.main(Main.java:64)

 5.3.0 is the last version without this bug.

 -W


 On 14/05/2013, jpbarto jason.p.ba...@gmail.com wrote:
  First the specifics: JDK 1.6, Mac OSX, using Drools 5.5 Final
 
  The full source code and rules are pasted below but here's the gist, I
 have
  a stateful knowledge session to which I am inserting events and running
 an
  accumulate on the input events.  I have a for loop generating the events
  and
  inserting them as rapidly as possible.  In the rules I use an
 accumulator
  to
  calculate the average of the values contained within the events.  The
  behavior I'm observing is that if I insert ~120 events without any
 waiting
  I
  receive an NPE.  If I Thread.sleep for even just 1ms the test goes off
  without a hitch.  Have I uncovered a bug which should be logged in
 JIRA?  I
  would check through JIRA to see if something similar has been logged but
  I'm
  so unfamiliar with the codebase, not to mention it could all just be
 user
  error.
 
  The NPE is as follows:
  Exception in thread main java.lang.NullPointerException
at
  org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:1050)
at
 
 org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:345)
at
 
 org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259)
at
 
 org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:676)
at
 
 org.drools.reteoo.ReteooWorkingMemory$EvaluateResultConstraints.execute(ReteooWorkingMemory.java:590)
at
 
 org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:350)
at
 
 org.drools.rule.SlidingLengthWindow.assertFact(SlidingLengthWindow.java:119)
at
 org.drools.rule.BehaviorManager.assertFact(BehaviorManager.java:94)
at org.drools.reteoo.WindowNode.assertObject(WindowNode.java:167)
at
 
 org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
 
 org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
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.NamedEntryPoint.insert(NamedEntryPoint.java:127)
at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:55)
at drools5fusioneval.Average.main(Average.java:66)
 
  ### Average.java ###
  package drools5fusioneval;
 
  import java.io.IOException;
  import java.util.Random;
  import org.drools.KnowledgeBase;
  import org.drools.KnowledgeBaseConfiguration;
  import org.drools.KnowledgeBaseFactory;
  import org.drools.builder.KnowledgeBuilder;
  import org.drools.builder.KnowledgeBuilderFactory;
  import org.drools.builder.ResourceType;
  import org.drools.conf.EventProcessingOption;
  import org.drools.io.ResourceFactory;
  import org.drools.runtime.StatefulKnowledgeSession;
  import org.drools.runtime.rule.WorkingMemoryEntryPoint

[rules-users] Drools Fusion Dropping Events?

2013-05-15 Thread Jason Barto
I've been working to load test Drools 5.3 to determine if its a fit for a
project.  As part of the test I programmatically insert events as rapidly
as possible; an example, my earlier test inserted 10k events in about
300ms.  There is currently a single rule which reads the event and stores
the event's value into the only fact in Drools. I'm very happy to report,
and I'm sure it will be no surprise to anyone, that the engine processes
all the events in roughly 1 sec. However I have noticed that any large
number of events (~1000) usually sees that a small number of events don't
get processed. I think after 10k events as many as 7 appear to have gone
unprocessed. If 100 events are inserted, rather than 10k, no events get
disregarded.  Being new to Drools I can easily accept that my java code or
DRL code is off or unoptimized in some way. However not knowing how Drools
does its magic I'm currently inclined to think that Drools gets swamped
(10k in 300ms is a lot) and a few events get dropped so Drools can keep
operating. Is this a known or expected behavior from Drools? If not I am
happy to post my code, it is similar to the other code sets I've posted in
the last few days. I'm still new to Drools and trying to learn its behavior
so any insight or enlightenment is greatly appreciated.

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

Re: [rules-users] NPE from reteoo.AccumulateNode

2013-05-14 Thread Jason Barto
Thanks Wolfgang. I'll change over to the 5.3 libraries and carry on with my
testing. I'll also enter this issue into jira if it doesn't yet exist.

Sincerely,
Jason
On May 14, 2013 11:30 AM, Wolfgang Laun wolfgang.l...@gmail.com wrote:

 Looks like a bug in Drools to me. It has the classic hallmark of a
 race condition: the NPE does not happen with every run (on my system),
 perhaps only with 85%.

 Moreover, with 5.4.0 I get a similar NPE and also:
 Exception in thread main java.util.NoSuchElementException
 at java.util.LinkedList.remove(LinkedList.java:788)
 at java.util.LinkedList.removeFirst(LinkedList.java:134)
 at
 org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:344)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:342)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:123)
 at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:53)
 at overrun.Main.main(Main.java:64)

 5.3.0 is the last version without this bug.

 -W


 On 14/05/2013, jpbarto jason.p.ba...@gmail.com wrote:
  First the specifics: JDK 1.6, Mac OSX, using Drools 5.5 Final
 
  The full source code and rules are pasted below but here's the gist, I
 have
  a stateful knowledge session to which I am inserting events and running
 an
  accumulate on the input events.  I have a for loop generating the events
  and
  inserting them as rapidly as possible.  In the rules I use an accumulator
  to
  calculate the average of the values contained within the events.  The
  behavior I'm observing is that if I insert ~120 events without any
 waiting
  I
  receive an NPE.  If I Thread.sleep for even just 1ms the test goes off
  without a hitch.  Have I uncovered a bug which should be logged in JIRA?
  I
  would check through JIRA to see if something similar has been logged but
  I'm
  so unfamiliar with the codebase, not to mention it could all just be user
  error.
 
  The NPE is as follows:
  Exception in thread main java.lang.NullPointerException
at
  org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:1050)
at
  org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:345)
at
 
 org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259)
at
 
 org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:676)
at
 
 org.drools.reteoo.ReteooWorkingMemory$EvaluateResultConstraints.execute(ReteooWorkingMemory.java:590)
at
 
 org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:350)
at
 
 org.drools.rule.SlidingLengthWindow.assertFact(SlidingLengthWindow.java:119)
at
 org.drools.rule.BehaviorManager.assertFact(BehaviorManager.java:94)
at org.drools.reteoo.WindowNode.assertObject(WindowNode.java:167)
at
 
 org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
 
 org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
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.NamedEntryPoint.insert(NamedEntryPoint.java:127)
at
 org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:55)
at drools5fusioneval.Average.main(Average.java:66)
 
  ### Average.java ###
  package drools5fusioneval;
 
  import java.io.IOException;
  import java.util.Random;
  import org.drools.KnowledgeBase;
  import org.drools.KnowledgeBaseConfiguration;
  import org.drools.KnowledgeBaseFactory;
  import org.drools.builder.KnowledgeBuilder;
  import org.drools.builder.KnowledgeBuilderFactory;
  import org.drools.builder.ResourceType;
  import org.drools.conf.EventProcessingOption;
  import org.drools.io.ResourceFactory;
  import org.drools.runtime.StatefulKnowledgeSession;
  import org.drools.runtime.rule.WorkingMemoryEntryPoint;
 
  class AvgDFEChannel implements org.drools.runtime.Channel {
  @Override
  public void send(Object o) {
  System.err.println (Recieved channel message: + o);
  }
  }
 
  public class Average {
  public static void main(String[] args) throws InterruptedException,
  IOException {
  KnowledgeBaseConfiguration kbconfig =
  KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
  kbconfig.setOption(EventProcessingOption.STREAM);
 
  KnowledgeBase kbase =
  KnowledgeBaseFactory.newKnowledgeBase(kbconfig);
 
  KnowledgeBuilder kbuilder

[rules-users] Grid Node Null Pointer Exception

2013-05-09 Thread Jason Barto
I am attempting to, using Camel, receive AMQP messages from RabbitMQ and
pass them into a Drools Fusion engine.  As my starting point I have a 4
line bit of Java code that instantiates Camel and passes it the camel XML
pasted below.  Is it apparent to anyone where I've gone wrong that I
receive a NPE while the system is calling the init method for 'node1'?

?xml version=1.0 encoding=UTF-8?

beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:rabbit=http://www.springframework.org/schema/rabbit;
   xmlns:drools=http://drools.org/schema/drools-spring;
   xsi:schemaLocation=
   http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
   http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd;

bean id=droolsPolicy class=org.drools.camel.component.DroolsPolicy
/
drools:grid-node id=node1/
drools:kbase id=kbase1 node=node1
drools:configuration
drools:mbeans enabled=true/
/drools:configuration
drools:resources
drools:resource type=DRL
source=classpath:drools-rules.drl/
/drools:resources
/drools:kbase

drools:ksession id=ksession1 type=stateful name=ksession1
kbase=kbase1 node=node1/

bean id=drools class=org.drools.camel.component.DroolsComponent/

bean id=jsonMessageConverter
class=amqp.spring.converter.XStreamConverter/
bean id=textMessageConverter
class=amqp.spring.converter.StringConverter/
bean id=messageConverter
class=amqp.spring.converter.ContentTypeConverterFactory
property name=converters
map
entry key=application/json
value-ref=jsonMessageConverter/
entry key=application/xml
value-ref=textMessageConverter/
/map
/property
property name=fallbackConverter ref=textMessageConverter/
/bean

rabbit:connection-factory id=connectionFactory host=127.0.0.1
port=5672 /
rabbit:template id=amqpTemplate
connection-factory=connectionFactory message-converter=messageConverter
reply-timeout=6/
rabbit:admin connection-factory=connectionFactory/

camelContext xmlns=http://camel.apache.org/schema/spring;
route
from uri=stream:in?promptMessage=Enter something: /
to uri=spring-amqp:cml.direct:a.b.c?type=direct/
/route
route
from uri=spring-amqp:cml.direct:springd:a.b.c?type=direct /
transform
simple${body.toUpperCase()}/simple
/transform
to uri=spring-amqp:cml.topic:a.b.c/
/route
route
from uri=spring-amqp:cml.topic:springt:#?type=topic /
to uri=stream:out/
/route
/camelContext

/beans

I'm still extremely new to Drools, Camel, BRMS and my ultimate goal is to
have BRMS running, receiving events from RabbitMQ.  This is one step along
my learning to achieve that goal so any help that can be offered is very
much appreciated.

It's potentially worth noting that the JAR files I'm running for this are
from the Drools-jBPM Integration 5.5 distribution.

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

Re: [rules-users] Consequence Exception with too many events

2013-05-04 Thread Jason Barto
Wolfgang,
thank you for your prompt reply.  After further work with my code I think
the culprit may have either been the setting of the event expiration time
to 1s OR that I was using session.update to insert a new counter object;
but maybe not.  I cleaned up my code in order to send it out.  In doing so
I also downloaded the official Drools 5.5 distribution (in the previous
example I was using the libraries packaged with BRMS).  Between the code
cleanup and the use of the official distro I'm no longer experiencing a
Consequence Exception.

That being said I am still experiencing a NPE when a high iteration count.
If you take a look at Drools5FusionEval.java, around line 51 you'll see a
variable 'eventLimit'.  If set to 50 it seems to pretty reliably kick
out the following NPE:

Exception in thread Thread-1 java.lang.NullPointerException
at
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1319)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
at
org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1434)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:755)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:731)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:247)
at drools5fusioneval.Drools5FusionEval$1.run(Drools5FusionEval.java:47)

As I've said I'm still very new to Drools and trying to understand better
how it does what it does - any information that anyone can provide to help
me understand why the above error is being experienced would be greatly
appreciated.

Source code and rules are attached.

Sincerely,
Jason


On Sat, May 4, 2013 at 7:58 AM, Wolfgang Laun wolfgang.l...@gmail.comwrote:

 Works for me (5.5.0, 5.4.0) - at least based on the code you've posted
 which (apart from the omitted getters and setters) isn't the one you've
 been running, and so you may have changed or omitted something
 that's essential.

 The full stack dump might shed some more light on this, and the full and
 true code of the rule RHS whre the NPE is caused.

 -W

 On 04/05/2013, Jason Barto jason.p.ba...@gmail.com wrote:
  I am new to Drools (Expert and Fusion) and have been reading through the
  materials over the last few days.  After going through some of the
 tutorial
  code I wrote a very quick and dirty to perform a base assessment of the
  speed of Fusion / Expert.  My code is below.  The strange thing I'm
  currently receiving is, if I insert 100k events the test completes
  successfully, if I insert 150k events, I receive a ConsequenceException
  caused by an NPE.  Being new to Drools I must be doing something wrong,
 can
  anyone please provide some guidance?
 
  (Main function)
  Counter cc = new Counter ();
  session.insert (cc);
  for (int i = 0; i  15; i++) {
entryPoint01.insert (new MyEvent ());
  }
 
  (Counter Class)
  public class Counter {
private long total = 0;
// get / set total
public void addValue (int val) {
  total += val;
}
  }
 
  (MyEvent Class)
  public class MyEvent {
private int value = 1;
// get / set value
  }
 
  (DRL file)
  declare MyEvent
@role (event)
@expires (1s)
  end
 
  rule Count the rules
  when
$ev : MyEvent () from entry-point entryPoint01
$pc : Counter ()
  then
$cc.addValue ($ev.getValue ());
  end
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users



drools5fusioneval.tar.gz
Description: GNU Zip compressed data
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Consequence Exception with too many events

2013-05-04 Thread Jason Barto
Wolfgang,
I'd agree with you although I will continue to research further.  If it is
as you suggest - a race condition - I would think a more appropriate
reaction of the system would be to emit a warning that events are expiring
before they can be considered by the rules engine, although I would think
that this is a use case which does not see much real life execution.  Thank
you very much for your time and input into this matter, it's been
educational.

Sincerely,
Jason

On Saturday, May 4, 2013, Wolfgang Laun wrote:

 I can confirm that (using 5.5.0) this NPE occurs predictably with a
 limit of 50.

 It looks like a race condition to me - at least that is what line
 DefaultAgenda.java:1319 suggests. Possibly it is due to automatic
 retraction overtaking rule firing, since the latter tends to take
 much, much longer than the ~10sec the mere insertion of 500K events
 takes on my system.

 500,000 inserted in 10s means 50,000/s, and that, in turn, implies
 50,000 retractions per second.  30s after the last insertion, only
 ~90,000 firings have taken place. (I added a printout of the counter's
 total after the Thread.sleep().)

 It's interesting to experiment with the @expires value: Everything
 else remaining the same, a setting of @expires(10s) will let the
 firings complete without a NPE.

 So, I'm back to my surmise: a race condition, due to expiry being cut
 too short to cope with the system load. I'd still classify this as a
 Drools bug: it should notice that it is being overtaxed and/or
 destabilizing itself.

 -W


 On 04/05/2013, Jason Barto jason.p.ba...@gmail.com wrote:
  Wolfgang,
  thank you for your prompt reply.  After further work with my code I think
  the culprit may have either been the setting of the event expiration time
  to 1s OR that I was using session.update to insert a new counter object;
  but maybe not.  I cleaned up my code in order to send it out.  In doing
 so
  I also downloaded the official Drools 5.5 distribution (in the previous
  example I was using the libraries packaged with BRMS).  Between the code
  cleanup and the use of the official distro I'm no longer experiencing a
  Consequence Exception.
 
  That being said I am still experiencing a NPE when a high iteration
 count.
  If you take a look at Drools5FusionEval.java, around line 51 you'll see a
  variable 'eventLimit'.  If set to 50 it seems to pretty reliably kick
  out the following NPE:
 
  Exception in thread Thread-1 java.lang.NullPointerException
  at
  org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1319)
  at
  org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1221)
  at
  org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1434)
  at
 
 org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:755)
  at
 
 org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:731)
  at
 
 org.drools.impl.StatefulKnowledgeSessionImpl.fireUntilHalt(StatefulKnowledgeSessionImpl.java:247)
  at
 drools5fusioneval.Drools5FusionEval$1.run(Drools5FusionEval.java:47)
 
  As I've said I'm still very new to Drools and trying to understand better
  how it does what it does - any information that anyone can provide to
 help
  me understand why the above error is being experienced would be greatly
  appreciated.
 
  Source code and rules are attached.
 
  Sincerely,
  Jason
 
 
  On Sat, May 4, 2013 at 7:58 AM, Wolfgang Laun
  wolfgang.l...@gmail.comwrote:
 
  Works for me (5.5.0, 5.4.0) - at least based on the code you've posted
  which (apart from the omitted getters and setters) isn't the one you've
  been running, and so you may have changed or omitted something
  that's essential.
 
  The full stack dump might shed some more light on this, and the full and
  true code of the rule RHS whre the NPE is caused.
 
  -W
 
  On 04/05/2013, Jason Barto jason.p.ba...@gmail.com wrote:
   I am new to Drools (Expert and Fusion) and have been reading through
   the
   materials over the last few days.  After going through some of the
  tutorial
   code I wrote a very quick and dirty to perform a base assessment of
 the
   speed of Fusion / Expert.  My code is below.  The strange thing I'm
   currently receiving is, if I insert 100k events the test completes
   successfully, if I insert 150k events, I receive a
 ConsequenceException
   caused by an NPE.  Being new to Drools I must be doing something
 wrong,
  can
   anyone please provide some guidance?
  
   (Main function)
   Counter cc = new Counter ();
   session.insert (cc);
   for (int i = 0; i  15; i++) {
 entryPoint01.insert (new MyEvent ());
   }
  
   (Counter Class)
   public class Counter {
 private long total = 0;
 // get / set total
 public void addValue (int val) {
   total += val;
 }
   }
  
   (MyEvent Class)
   public class MyEvent {
 private int value = 1;
 // get / set value

[rules-users] Consequence Exception with too many events

2013-05-03 Thread Jason Barto
I am new to Drools (Expert and Fusion) and have been reading through the
materials over the last few days.  After going through some of the tutorial
code I wrote a very quick and dirty to perform a base assessment of the
speed of Fusion / Expert.  My code is below.  The strange thing I'm
currently receiving is, if I insert 100k events the test completes
successfully, if I insert 150k events, I receive a ConsequenceException
caused by an NPE.  Being new to Drools I must be doing something wrong, can
anyone please provide some guidance?

(Main function)
Counter cc = new Counter ();
session.insert (cc);
for (int i = 0; i  15; i++) {
  entryPoint01.insert (new MyEvent ());
}

(Counter Class)
public class Counter {
  private long total = 0;
  // get / set total
  public void addValue (int val) {
total += val;
  }
}

(MyEvent Class)
public class MyEvent {
  private int value = 1;
  // get / set value
}

(DRL file)
declare MyEvent
  @role (event)
  @expires (1s)
end

rule Count the rules
when
  $ev : MyEvent () from entry-point entryPoint01
  $pc : Counter ()
then
  $cc.addValue ($ev.getValue ());
end
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] Planner: Hard Constraint Prevents Moves and Swaps

2012-09-25 Thread Jason Virtue
All,

I have a problem where I need to assign tasks:
1.) Times
2.) Resources based on a Resource Type

I've used the nurse rostering problem as an example and come up with a
planning entity ResourceAssignment that looks like:

Facts:
Task
ResourceType

Variables:
Time
Resource

For example:
1.) Lets say there are two resource types Type1  Type2
2.) A pool of resources: Resource1(type1), Resource2(type1),
Resource3(type1), Resource4(type2), Resource4(type2), Resource5(type2) ...
3.) Task A: that requires 1 resource of type1 and one resource of type2

My program creates two PlanningEntities
ResourceAssignment1
Fact:
Task=A
ResourceType=1
Variables
Time
Resource

ResourceAssignment2
Fact:
Task=A
ResourceType=2
Variables:
Time
Resource

I've created a rule that is designed to keep tasks starting at the same
time:

//tasks need to be in the same timeSlot

rule taskInTimeSlot

when

$ra1 : ResourceAssignment ( task != null, time != null, $id : id, $task :
task, $time : time)

$ra2 : ResourceAssignment ( task != null, timeSlot != null, id != $id, task
== $task, time != $time )

then

insertLogical(new IntConstraintOccurrence(taskInTimeSlot,
ConstraintType.NEGATIVE_HARD,

1,$ra1, $ra2));

end


*PROBLEM*


This results in: Cancelled step index (7), time spend (2848): there is no
doable move. Terminating phase early.


If I change the constraint to a NEGATIVE_SOFT the problem is solved, but it
doesn't scale. Any more that a few tasks and it doesn't seem to be able to
find solutions.


What I need is for swaps and moves to change the time on multiple
ResourceAssignments together.


Am I going about the problem the right way? Do I need something other than
the generic move/swap factories?


Thanks in advance,

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


Re: [rules-users] Anyway to get Failed Reason for Failed Rule?

2012-08-10 Thread Zhong, Jason
A simple solution is to pass in a string list and for each rule that is fired, 
append the rule name to the list. Example

In your Java code declare:
class RuleLog {
List log = new ArrayList();
public void add(String logEntry) {
log.add(logEntry);
}   
...
}

Then insert an instance of RuleLog as a fact to the rules engine. The log 
entries generated can be retrieved after the rule session is completed.

In your rule:

rule foo
   when 

logger: RuleLog()
   Then
// this will add the current rule name to the log when this rule is 
fired
logger.add(drools.getRule().getName())
...
end

Jason




-Original Message-
From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Rana
Sent: Thursday, August 09, 2012 5:00 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] Anyway to get Failed Reason for Failed Rule?

Hi Davide, your second guess is right. Sorry I should have said failed
condition.

I wanted to know which rule got fired and which one did not (because the
condition failed in when clause).

I wanted to know those, because we have requirement which asks for what are
the rules which have passed and failed copnditions, so that we can make some
decisions.

Also, I wanted to know that in a rule

rule name
when
//condition
then
   //consequence
end

when the condition is failed will the rule goes to consequence or not.  (I
am fairely new to Drools. sorry).

Thanks.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Anyway-to-get-Failed-Reason-for-Failed-Rule-tp4019070p4019077.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] Your suggestions for rules for pretty simple problem

2012-02-09 Thread Jason Parekh
I'm new to constraint programming and Drools Planner.  I've read through the
docs and built some rules that would probably get me to the right answer,
eventually :)

I was hoping to get your suggestions for better concrete rules.

The problem is I need to order items in a performance with the following
logical rules:
1) All items of the same category must appear together.
2) A performer can be in multiple items, but ideally there'd be at least
three items between any of her two items

The approaches I took are:
- For (1), count the number of transitions from one category to another.
Subtract this to the hard score.
- For (2), three separate rules, each of which assert that an item at
position i does not share performers with an item at position i+1, i+2 and
i+3 (one of these per rule).  The number of shared performers would be
subtracted from the hard score.

The scoring and my choice for construction heuristic (FIRST_FIT) are just
naive selections.  I haven't gotten to optimizing either of these -- just
wanted to check with you guys to make sure my rules are sane.

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


Re: [rules-users] Using Drools Flow with Multiple Fact Types

2011-11-08 Thread Jason
Can anyone help with this?  It's been two weeks with no replies and my
attempts to work around this problem are proving unsuccessful.

Can a Drools flow handle multiple types of data being passed through it
(e.g. ten different POJOs) such that one of the data types (User) is
selectively directed down one of multiple paths based on a field value
(User.Program) but the rest of the facts (Activities, Accounts, Connections)
are sent down all paths?  I'm looking to apply different sets of rules to
different Users based on the program they're in.

Any help will be most welcome!!!

--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-Drools-Flow-with-Multiple-Fact-Types-tp3449939p3490286.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] Using Drools Flow with Multiple Fact Types

2011-10-24 Thread Jason
 in parsing errors (often of
the unmatched then or unmatched ( sort when the flow is initially read
in).  Can anyone point me to an example of a flow where multiple types of
facts are sent through?  In fact, any pointers to examples of the syntax
that has been used within the Constraint Editor Textual Editor field could
help a lot in illustrating how to apply this element of Drools Flow control.

Any help or guidance will be greatly appreciated!

-Jason


--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-Drools-Flow-with-Multiple-Fact-Types-tp3449939p3449939.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] OutOfMemoryError happens when dynamic loading of Rules from Guvnor frequently

2011-06-20 Thread Jason Smith
Try using JMAP to get a heap dump, and then find an analysis tool you like to 
find the memory leak.  It is probably due to a memory leak in MVEL that show 
itself when you do dynamic rules allocation (I don't think it has been fixed 
yet), but I can't be sure unless you find the class that is leaking.  

Jason Smith


From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Oliver Liu [liuyy2...@hotmail.com]
Sent: Monday, June 20, 2011 5:44 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] OutOfMemoryError happens when dynamic loading of 
Rules from Guvnor frequently

Any idea is appreciated, it's critical for my project. Thanks.

--
View this message in context: 
http://drools.46999.n3.nabble.com/OutOfMemoryError-happens-when-dynamic-loading-of-Rules-from-Guvnor-frequently-tp3079965p3088701.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] Problems with BigDecimal on LHS

2011-01-12 Thread Jason Mihalick

I searched on the forum before I posted this and looked in JIRA.  It appears
that all problems like this with BigDecimal are thought to be resolved. 
However, I am having a problem that appears it may be attributed to Drools
using the BigDecimal( double ) constructor when converting decimal numbers
in the rules to a BigDecimal.

If you are able to reproduce this problem, what is the work around?  Use an
eval statement?

The rule does not fire in the following test:

package org.test;

import java.math.BigDecimal;

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

public class BigDTest {

  public final static String RULE = 
package mypackage;  +
import org.test.BigDTest; +
rule \BigDecimal compare problem\  +
   when  +
   BigDTest( bigDValue == 6.3 )  +
   then  +
   System.out.println( \Matched!\ );  +
   end
;
  
  private BigDecimal bigDValue = new BigDecimal( 6.3 ) ; // Rule will fire
if this is changed to BigDecimal( 6.3 )
  
  public BigDecimal getBigDValue() {
return bigDValue;
  }

  public void setBigDValue( BigDecimal bigDValue ) {
this.bigDValue = bigDValue;
  }

  public static void main( String[] args ) {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newByteArrayResource( RULE.getBytes() ),
ResourceType.DRL );
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}

KnowledgeBase kbase = kbuilder.newKnowledgeBase();

StatelessKnowledgeSession ksession =
kbase.newStatelessKnowledgeSession();
BigDTest bigDTest = new BigDTest();
ksession.execute( bigDTest );
  }
}

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Problems-with-BigDecimal-on-LHS-tp2244966p2244966.html
Sent from the Drools - User 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] Need help with Decision Table Conditions

2011-01-10 Thread Jason Mihalick

Thanks Tihomir.  I will submit a JIRA ticket for this, as I definitely could
use this feature.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2227739.html
Sent from the Drools - User 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] Need help with Decision Table Conditions

2011-01-10 Thread Jason Mihalick

JIRA Issue added here:  https://issues.jboss.org/browse/JBRULES-2866
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2227963.html
Sent from the Drools - User 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] Need help with Decision Table Conditions

2011-01-07 Thread Jason Mihalick

Tihomir,

Do you know if decision tables support 
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e3368
metadata ?
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2215160.html
Sent from the Drools - User 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] Need help with Decision Table Conditions

2011-01-05 Thread Jason Mihalick

Thank you so much for the posting!  All I had to do was add the 'X' character
in the cell below $pgMeta: PageMeta() and that fixed it!

When is it necessary to add the 'X' character and when is it ok to leave it
blank?  I don't recall seeing information about that in the doc.

Thanks also for the SpreadsheetCompiler code.  I didn't think
SpreadsheetCompiler was available until 5.2 because I didn't see it in the 
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/apidocs/index.html
5.1 javadoc .
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2199270.html
Sent from the Drools - User 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] Need help with Decision Table Conditions

2011-01-04 Thread Jason Mihalick

I have a decision table with the conditions shown in the graphic below.  When
Drools attempts to compile the spreadsheet I get the following errors:

nested exception is java.lang.RuntimeException: Unable to return Declaration
for identifier '$pgMeta' : [Rule name='Section Head Spacing_18']
Unable to create restriction '[VariableRestriction: == $pgMeta ]' for field
'pageMeta' in the rule 'Section Head Spacing_18' : [Rule name='Section Head
Spacing_18']
Unable to build expression for 'from' : [Error: Failed to compile: 2
compilation error(s):
 - (1,7) unqualified type in strict mode for: $pgMeta
 - (1,22) unable to resolve method using strict-mode:
java.lang.Object.getLineMetas()]
[Near : {... Unknown }]
 ^
[Line: 1, Column: 0] '$pgMeta.getLineMetas()' : [Rule name='Section Head
Spacing_18']

 
http://drools-java-rules-engine.46999.n3.nabble.com/file/n2195003/Picture_2.png 

The LHS of a hand-coded rule for this, is as follows:

when
$pageMeta :  PageMeta()
$bodyLines : LineMeta( pageMeta == $pageMeta, lineType == LineType.BODY
)
 from $pageMeta.getLineMetas()
$bodyLine :  LineMeta( previousPageMetaComponent != null,
   previousPageMetaComponent == previousLineMeta,
   previousLineMeta.lineType ==
LineType.SECTION_HEAD,
   verticalSpacingToPreviousPageMetaComponent 
5.9525 ) from $bodyLines
 
Can this rule be created in a Decision table or not?  Your help is most
appreciated!

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-tp2195003p2195003.html
Sent from the Drools - User 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] Drools + Spring without internet

2010-12-01 Thread Jason Davidson
I had the same issue at startup (i.e. not connected to the internet).
 Anyway, I used the XSD files are bundled in the drools-spring-5.1.1.jar.  I
simply changed my application context schema location to 
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring.xsd; and the XSD files are loaded
from the jar file at startup.

On Wed, Dec 1, 2010 at 8:21 AM, Corneil du Plessis corn...@tsctech.comwrote:

 change schema location to that is only contains filenames like

 beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:drools=http://drools.org/schema/drools-spring;
xmlns:camel=http://camel.apache.org/schema/spring;
 
 xsi:schemaLocation=http://www.springframework.org/schema/beansspring-beans-2.5.xsd
 http://drools.org/schema/drools-spring drools-spring-1.0.0.xsd
 http://camel.apache.org/schema/spring camel-spring.xsd

 Then put the xsd files in same folder as applicationContext.xml


 On 01/12/2010 17:15, Geoffrey De Smet wrote:
  IIRC, there's something in drools-spring we can do, so the xsd's don't
  have to be downloaded from the internet but can be used directly from
  the jar.
  It might be a properties file or something in the jar, which says urlX =
  pathYinTheJar.
 
  Op 01-12-10 15:59, Anderson Rocha schreef:
  Thank you for your replay.
 
  I downloaded the schemas and configured the applicationContext.xml
  like this, consider path to my the path to the file.
 
  beans xmlns=http://www.springframework.org/schema/beans;
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
  xmlns:drools=http://drools.org/schema/drools-spring;
  xmlns:camel=http://camel.apache.org/schema/spring;
  xsi:schemaLocation=http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  *http://drools.org/schema/drools-spring
  file:///path/to/my/drools-spring-1.0.0.xsd*
  *http://camel.apache.org/schema/spring
  file:///path/to/my/camel-spring.xsd*
 
  I have a web application, and when I execute it works =) but I have
  some unit tests and I initialize the spring with the code
 
  ApplicationContext applicationContext = new
  ClassPathXmlApplicationContext(new String[] {applicationContext.xml});
 
  In this case I get the same error I had before. Any ideia?
 
  Anderson
 
  2010/12/1 Mauricio Salatinosala...@gmail.commailto:sala...@gmail.com
 
 
   yes you can download the schemas to your hard drive and point the
   applicationContext.xml to them.
 
 
   2010/12/1 Anderson Rochaanderson.u...@gmail.com
   mailto:anderson.u...@gmail.com
 
   Hi all,
 
   I realized that to use Drools with Spring I need to be
   conected to the internet, but sometimes I am not. There is a
   way to download the tags of Drools and configure the
   applicationContext.xml to seek for them localy?
 
   Regards,
   Anderson
 
   ___
   rules-users mailing list
   rules-users@lists.jboss.orgmailto:rules-users@lists.jboss.org
 
   https://lists.jboss.org/mailman/listinfo/rules-users
 
 
 
 
   --
- CTO @ http://www.plugtree.com
- MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jbug.com.ar
 
- Salatino Salaboy Mauricio -
 
   ___
   rules-users mailing list
   rules-users@lists.jboss.orgmailto: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] KnowledgeAgent ChangeSet failing to reload resources

2010-11-10 Thread Jason Davidson
Eric,

Thanks for your help.  I was never able to get the Drools Spring Resource
Scanner to work.  Instead I changed my Spring beans to use a KnowledgeAgent
similar to the code you've outlined below and it's working.

Jason

On Thu, Nov 4, 2010 at 9:50 AM, etfink123 fink_e...@bah.com wrote:


 Jason,

 Your's sound slightly different in that you have not been able to
 successfully fire up your KnowledgeBase at all.

 Mine works, but fails once an invalid DRL file is read.

 In any case, I am not use PKG for my ChangeSet resources:

 change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' 
add
resource source='file:C:/Transformations.drl' type='DRL' /
!--resource
 source='classpath:bass/enrichment/rules/Transformations.drl' type='DRL'
 /--
/add
 /change-set

 I am creating the KA as follows:

KnowledgeAgentConfiguration agentConfig =
 KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
agentConfig.setProperty(drools.agent.newInstance, false);

agent = KnowledgeAgentFactory.newKnowledgeAgent(MyAgent,
 agentConfig);
kaListener = new KnowledgeAgentEventListenerImpl();
agent.addEventListener(kaListener);


 agent.applyChangeSet(ResourceFactory.newClassPathResource(rules/ChangeSet.xml));
agent.monitorResourceChangeEvents(true);

ResourceChangeScannerConfiguration scannerConfig =

 ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
scannerConfig.setProperty(drools.resource.scanner.interval, 5);


 ResourceFactory.getResourceChangeScannerService().configure(scannerConfig);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();

 I'll keep you posted if I hear anything.

 - Eric

 --
 View this message in context:
 http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeAgent-ChangeSet-failing-to-reload-resources-tp1842033p1842540.html
 Sent from the Drools - User 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] Starting resource change scanner and notifier in drools-server.

2010-11-04 Thread Jason Davidson
I've move both the changeset.xml and my PKG files to a file location (not on
the class path).  It still doesn't detect when the PKG files have been
updated.

changeset.xml:

change-set xmlns='http://drools.org/drools-5.0/change-set'

xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd
' 

add

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.validation.financial.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.validation.judicial.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.validation.person.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.validation.user.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.validation.cases.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.validation.edocuments.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.financial.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.dcm.pkg/

  resource type=PKG source=
file:/Users/jljdavidson/temp/jworks.cases.pkg/

/add

/change-set

Spring config:

  drools:resource-change-scanner id=scanner interval=10 /

  drools:kbase id=ruleKBase

  /drools:kbase

  drools:kagent id=ruleKAgent kbase=ruleKBase

drools:resources

 drools:resource type=CHANGE_SET source=
file:/Users/jljdavidson/temp/drools-changeset.xml/

/drools:resources

  /drools:kagent


 Could it be because I'm using PKGs instead of DRL files?

Thanks!!
Jason

2010/11/3 Mark Proctor mproc...@codehaus.org

  It won't detect changes on the classpath. Needs to be file or http.

 Mark

 On 03/11/2010 21:49, Jason Davidson wrote:

 Hello,

  Any tips on this?  I'm seeing this same behavior using Drools 5.1.1:

  Spring Beans:

   !-- Drools : --

   drools:resource-change-scanner id=scanner interval=10 /

   drools:kbase id=ruleKBase

   /drools:kbase

   drools:kagent id=kagent1 kbase=ruleKBase

 drools:resources

  drools:resource type=CHANGE_SET source=
 classpath:drools-changeset.xml/

 /drools:resources

   /drools:kagent

  Changeset:

 change-set xmlns='http://drools.org/drools-5.0/change-set'

 xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

 xs:schemaLocation='http://drools.org/drools-5.0/change-set
 http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd
 ' 

 add

   resource source=
 http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
 

type='PKG' basicAuthentication=enabled username=admin
 password=admin /

 /add

 /change-set



  At startup I see that the KnowledgeAgent registers a listener but never
 detects changes:

 [2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
 interval=60

 [2010:11:307 15:11:506:info] ResourceChangeScanner created with default
 interval=60

 [2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
 interval=10

 [2010:11:307 15:11:528:info] ResourceChangeNotification created

 [2010:11:307 15:11:528:debug] ResourceChangeNotification monitor added
 monitor=org.drools.io.impl.resourcechangescanneri...@616181be

 [2010:11:307 15:11:529:debug] KnowledgeAgent building resource map

 [2010:11:307 15:11:529:info] KnowledegAgent has started listening for
 ChangeSet notifications

 [2010:11:307 15:11:529:info] KnowledgeAgent created, with configuration:

 monitorChangeSetEvents=true scanResources=true scanDirectories=true
 newInstance=true

 [2010:11:307 15:11:530:info] KnowledgeAgent applying ChangeSet

 [2010:11:307 15:11:531:debug] KnowledgeAgent processing sub
 ChangeSet=[ClassPathResource path='drools-changeset.xml']

 [2010:11:307 15:11:919:debug] KnowledgeAgent notifier subscribing to
 resource=[UrlResource path='
 http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
 ']

 [2010:11:307 15:11:920:debug] ResourceChangeNotification subscribing
 listener=org.drools.agent.impl.knowledgeagenti...@d2a7c1e to
 resource=[UrlResource path='
 http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
 ']

 [2010:11:307 15:11:920:debug] ResourceChangeScanner subcribing
 notifier=org.drools.io.impl.resourcechangenotifieri...@603a9c52 to
 resource=[UrlResource path='
 http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
 ']

 [2010:11:307 15:11:920:debug] KnowledgeAgent rebuilding KnowledgeBase using
 ChangeSet


  Thanks!

 Jason


   2010/9/23 Clandes Tino clandestino_...@yahoo.co.uk

   Hi,
 I've also faced the same problem.
 Hope somebody could give a hint.

 thanks  best,
 milan

 --- On *Mon, 20/9/10, Graham

Re: [rules-users] KnowledgeAgent ChangeSet failing to reload resources

2010-11-04 Thread Jason Davidson
Eric,

I've been fighting something similar to your problem as posted
herehttp://lists.jboss.org/pipermail/rules-users/2010-November/017124.html.


I'm interested in what your KnowledgeAgent setup because I can't get the
agent to detect changes to rule PKG files.  Are you using Spring?

Thanks!
Jason

On Thu, Nov 4, 2010 at 8:41 AM, Fink, Eric [USA] fink_e...@bah.com wrote:

 Greetings.  I am using Drools 5.1.1's KnowledgeAgent ChangeSet
 functionality and have come across an issue.

 here is the use case:

 Fire up the application with a valid DRL file. Works as designed.
 Update the DRL file. ChangeSet senses updated file, KnowledgeBase is
 updated with updated rules, yadda, yadda. Works as designed.
 Update the DRL file and introduce errors in the LHS of the rule. For
 example, I changed Sensor to Sccensor in the example below and $masterId is
 not defined. The following is reported as expected:

 KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
 [2010:11:308 09:11:515:info] KnowledgeAgent performing an incremental build
 of the ChangeSet
 [2010:11:308 09:11:843:debug] KnowledgeAgent has KnowledgeBuilder errors
  object=Unable to resolve ObjectType 'Sccensor' : [Rule name='18)
 sensorCount derived variable']
 Rule Compilation error : [Rule name='18) sensorCount derived variable']
bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (7:590)
 : $masterID cannot be resolved
bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (8:624)
 : $masterID cannot be resolved
bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (9:769)
 : $masterID cannot be resolved

 Update the DRL file to the previously working version. The ChangeSet never
 senses that the file has been updated. It just runs along checking every x
 seconds.

 Has anyone experienced this? Is there a listener that should be firing
 somewhere?

 Thanks is advance.

 - Eric
 ___
 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] Starting resource change scanner and notifier in drools-server.

2010-11-03 Thread Jason Davidson
Hello,

Any tips on this?  I'm seeing this same behavior using Drools 5.1.1:

Spring Beans:

  !-- Drools : --

  drools:resource-change-scanner id=scanner interval=10 /

  drools:kbase id=ruleKBase

  /drools:kbase

  drools:kagent id=kagent1 kbase=ruleKBase

drools:resources

 drools:resource type=CHANGE_SET source=
classpath:drools-changeset.xml/

/drools:resources

  /drools:kagent

Changeset:

change-set xmlns='http://drools.org/drools-5.0/change-set'

xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd
' 

add

  resource source=
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST


   type='PKG' basicAuthentication=enabled username=admin
password=admin /

/add

/change-set



At startup I see that the KnowledgeAgent registers a listener but never
detects changes:

[2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
interval=60

[2010:11:307 15:11:506:info] ResourceChangeScanner created with default
interval=60

[2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
interval=10

[2010:11:307 15:11:528:info] ResourceChangeNotification created

[2010:11:307 15:11:528:debug] ResourceChangeNotification monitor added
monitor=org.drools.io.impl.resourcechangescanneri...@616181be

[2010:11:307 15:11:529:debug] KnowledgeAgent building resource map

[2010:11:307 15:11:529:info] KnowledegAgent has started listening for
ChangeSet notifications

[2010:11:307 15:11:529:info] KnowledgeAgent created, with configuration:

monitorChangeSetEvents=true scanResources=true scanDirectories=true
newInstance=true

[2010:11:307 15:11:530:info] KnowledgeAgent applying ChangeSet

[2010:11:307 15:11:531:debug] KnowledgeAgent processing sub
ChangeSet=[ClassPathResource path='drools-changeset.xml']

[2010:11:307 15:11:919:debug] KnowledgeAgent notifier subscribing to
resource=[UrlResource path='
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
']

[2010:11:307 15:11:920:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.knowledgeagenti...@d2a7c1e to
resource=[UrlResource path='
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
']

[2010:11:307 15:11:920:debug] ResourceChangeScanner subcribing
notifier=org.drools.io.impl.resourcechangenotifieri...@603a9c52 to
resource=[UrlResource path='
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
']

[2010:11:307 15:11:920:debug] KnowledgeAgent rebuilding KnowledgeBase using
ChangeSet


Thanks!

Jason


2010/9/23 Clandes Tino clandestino_...@yahoo.co.uk

 Hi,
 I've also faced the same problem.
 Hope somebody could give a hint.

 thanks  best,
 milan

 --- On *Mon, 20/9/10, Graham Thomson gthom...@fizzback.com* wrote:


 From: Graham Thomson gthom...@fizzback.com
 Subject: [rules-users] Starting resource change scanner and notifier in
 drools-server.
 To: rules-users@lists.jboss.org
 Date: Monday, 20 September, 2010, 15:24



 Hi,

 I would like to ask for help with setting up drools-server with Guvnor. I
 am using version 5.1.1 of both.

 I am trying to set up an instance of drools-server in Tomcat that
 periodically loads new updates of packages published in Guvnor (both
 drools-server and Guvnor run in the same instance of Tomcat).

 My change set definition is as follows:

 ?xml version=1.0 encoding=UTF-8?
 change-set xmlns='http://drools.org/drools-5.0/change-set'
   xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
   xs:schemaLocation='http://drools.org/drools-5.0/change-set

 http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'
 
   add
 resource source='
 http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/one
 of my packages/LATEST'
   type='PKG' basicAuthentication=enabled username=username
 password= /
 resource source=
 http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/another
 of my packages/LATEST
   type=PKG basicAuthentication=enabled username=username
 password= /
   /add
 /change-set

 My knowledge-services.xml configuration is as follows (based on the unit
 test examples highlighted in
 http://article.gmane.org/gmane.comp.java.drools.user/20992/match=drools+spring
 ):

 ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:drools=http://drools.org/schema/drools-spring;
xsi:schemaLocation=http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://drools.org

[rules-users] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Jason van Zyl
Hi,

I have been following the documentation to create a RuleFlowProcess, and I went 
the route of creating the flow programmatically, but I can't find an example of 
adding this process to the knowledge builder. It seems to want an external 
resource of a given type. In my little code scenario below how would I add this 
programmatically created RuleFlowProcess?

DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( flow ); 
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* 
what do i put here*/ );

Do I have to serialize to an external form and deserialize?

Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

Three people can keep a secret provided two of them are dead.

 -- Unknown



Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

We know what we are, but know not what we may be.

  -- Shakespeare



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


[rules-users] Drools Sample Project Won't Execute on Spring STS IDE 2.3.2

2010-10-21 Thread Jason Mihalick

Versions involved:

IDE: Spring STS 2.3.2.RELEASE
Eclipse Drools Plugin: 5.1.1 (Includes JBoss Drools Core, JBoss Drools
Guvnor, JBoss Drools Task)
Java: JDK 1.6.0_11
Platform:  Windows XP

1) Create a sample Drools application using the New Project Wizard and
selecting Drools Project

2) Name it MyDroolsProject

3) Check all options on the add sample classes (e.g., 'Add a sample
HelloWorld rule file to this project', etc.)

4) Check to 'Use default Drools Runtime (currently Drools 5.1.0 runtime)'. 
Also choose to Generate code compatible with 'Drools 5.1.x'.  Click Finish.

5) In your newly created 'MyDroolsProject', drill down to
com.sample.DecisionTableTest.java, right click and choose to 'Run As | Java
Application'

The following stack trace ensues.  (Note, yes, I do have the STS Groovy
plugin installed)

Warning:  Cell at E21 not present - adding a blank
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
  at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
  at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:755)
  at
org.eclipse.jdt.internal.compiler.Compiler.init(Compiler.java:312)
  at
org.eclipse.jdt.internal.compiler.Compiler.init(Compiler.java:177)
  at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:349)
  at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
  at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
  at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
  at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
  at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
  at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
  at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:254)
  at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:484)
  at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
  at
com.sample.DecisionTableTest.readKnowledgeBase(DecisionTableTest.java:44)
  at com.sample.DecisionTableTest.main(DecisionTableTest.java:25)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  ... 27 more
 


-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Sample-Project-Won-t-Execute-on-Spring-STS-IDE-2-3-2-tp1746156p1746156.html
Sent from the Drools - User 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] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Jason van Zyl
Hi,

I have been following the documentation to create a RuleFlowProcess, and I went 
the route of creating the flow programmatically, but I can't find an example of 
adding this process to the knowledge builder. It seems to want an external 
resource of a given type. In my little code scenario below how would I add this 
programmatically created RuleFlowProcess?

DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( flow ); 
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* 
what do i put here*/ );

Do I have to serialize to an external form and deserialize?

Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

Three people can keep a secret provided two of them are dead.

 -- Unknown



Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

A language that doesn’t affect the way you think about programming is not worth 
knowing. 
 
 -— Alan Perlis



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


Re: [rules-users] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Jason van Zyl
Your Hudson instance with the latest documentation is down:

https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch05.html

On Oct 21, 2010, at 11:17 AM, Jason van Zyl wrote:

 Hi,
 
 I have been following the documentation to create a RuleFlowProcess, and I 
 went the route of creating the flow programmatically, but I can't find an 
 example of adding this process to the knowledge builder. It seems to want an 
 external resource of a given type. In my little code scenario below how would 
 I add this programmatically created RuleFlowProcess?
 
 DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();  
   
 RuleFlowProcess flow = flowGenerator.generateFlow( flow ); 
 KnowledgeBuilder knowledgeBuilder = 
 KnowledgeBuilderFactory.newKnowledgeBuilder();
 knowledgeBuilder.add( flow.getResource() /* this is null */, null /* 
 what do i put here*/ );
 
 Do I have to serialize to an external form and deserialize?
 
 Thanks,
 
 Jason
 
 --
 Jason van Zyl
 Founder,  Apache Maven
 http://twitter.com/jvanzyl
 -
 
 Three people can keep a secret provided two of them are dead.
 
  -- Unknown
 
 
 
 Thanks,
 
 Jason
 
 --
 Jason van Zyl
 Founder,  Apache Maven
 http://twitter.com/jvanzyl
 -
 
 A language that doesn’t affect the way you think about programming is not 
 worth knowing. 
  
  -— Alan Perlis
 
 
 
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

We know what we are, but know not what we may be.

  -- Shakespeare





Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

Simplex sigillum veri. (Simplicity is the seal of truth.)



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


[rules-users] Reusing Rules in a Rule Flow?

2010-08-03 Thread Jason Davidson
Is it possible to use a rule in a rule flow without a ruleflow-group?

Here's our use case:  We have a base set of rules that are not part of
a ruleflow-group.  But we want to allow the administrators of the
system to build custom rule flows that reuse these existing base
rules.  In most instances the base rules will be fired but in some
instances the ruleflow will be executed too.

What's the best way to reuse a rule in this case?

Thanks!
Jason

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


Re: [rules-users] Missing space when using DSL and Guvnor

2010-04-30 Thread Jason Smith
Hey, didn't mean to come off as critical today.  You are doing a good job on 
this, and the basic rules stuff is spot on as far as functionality goes.  Words 
like *refactor* and *scrub* are just artifacts of code that has gone through 
several revision cycles (and I helped).  Functionally, it's working great, as 
intended, with no compromises in the design - or at least tiny ones.  If the 
code is a little hard to modify (due to a couple of years of active 
maintenance), that's not a big deal.

It really may be a very small deal.  It looks to me like this code is about to 
enter a fairly stable time.  It's pretty close to feature-complete, and it's 
working.  So then it's your call if and when you want to spend the time and 
effort to pretty it up a bit.  In a code base as big as this one, with as many 
things as need to be done, there's plenty of other low hanging fruit...  :-)

Have a good weekend, and try not to work on this stuff.

Jason Smith
Software Engineer
InfoTrust Group, Inc.
500 Discovery Parkway, Suite 200
Superior, CO 80027
Office 303-627-6571
Fax 303-666-6711
Email jsm...@infotrustgroup.commailto:jsm...@infotrustgroup.com
WEB www.infotrustgroup.comhttp://www.infotrustgroup.com/
This e-mail and all information included herein do not constitute a legal 
agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.  All 
legal agreements must be formulated in writing by a legal representative of 
INFOTRUST GROUP. This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to whom they are 
addressed.  If you have received this e-mail by mistake, please inform us and 
destroy this e-mail and any documents it might contain.  Please note that any 
views or opinions presented in this email are solely those of the author and do 
not necessarily represent those of the company. Finally, the recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.  Thank you for your cooperation.

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Paul R. [reverselo...@gmail.com]
Sent: Friday, April 30, 2010 5:40 PM
To: Rules Users List
Subject: Re: [rules-users] Missing space when using DSL and Guvnor

Hi Jeff,

I logged a bug for this one a while back, here's the JIRA, patch details 
included.

https://jira.jboss.org/jira/browse/GUVNOR-520

I would appreciate it if somebody could commit this for me :)

Cheers,

Paul

2010/4/30 Esteban Aliverti 
esteban.alive...@gmail.commailto:esteban.alive...@gmail.com
It sounds like a bug. Can you double check it and create a jira issue please?

best,

2010/4/29 Doyel,Jeff jdo...@cerner.commailto:jdo...@cerner.com
I am setting up a very simple example using a DSL and Guvnor.  My DSL is as 
follows:

[when]Age is less than {age} years old=AgeFact(ageInYears  {age})

When I attempt to create a new Business Rule using the Guvnor I can select the 
above expression just fine and the sentence displays as expected.  I then fill 
in the years with a numeric value (4) and validate.  Upon validation I receive 
the following error.

[Age Test Rule] [ERR 101] Line 4:2 no viable alternative at input 'Age' in rule 
Age Test Rule

I then view the source and it looks like this.

rule Age Test Rule
dialect mvel
when
Age is less than 4years old
then
end

I noticed that there is no space between the ‘4’ and the word ‘years’.  
However, in my DSL sentence there is a space between {age} and years.  Another 
interesting thing, if I enter the number 4 followed by a space in the Guvnor 
form then the rule validates correctly.  Is this a bug or is it something I am 
doing wrong in my DSL?

Thanks,
Jeff


CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

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




--


Esteban Aliverti

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

Re: [rules-users] Missing space when using DSL and Guvnor

2010-04-30 Thread Jason Smith
I would like to recall the previous message...  please ignore.  Big oops!


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Paul R. [reverselo...@gmail.com]
Sent: Friday, April 30, 2010 5:40 PM
To: Rules Users List
Subject: Re: [rules-users] Missing space when using DSL and Guvnor

Hi Jeff,

I logged a bug for this one a while back, here's the JIRA, patch details 
included.

https://jira.jboss.org/jira/browse/GUVNOR-520

I would appreciate it if somebody could commit this for me :)

Cheers,

Paul

2010/4/30 Esteban Aliverti 
esteban.alive...@gmail.commailto:esteban.alive...@gmail.com
It sounds like a bug. Can you double check it and create a jira issue please?

best,

2010/4/29 Doyel,Jeff jdo...@cerner.commailto:jdo...@cerner.com
I am setting up a very simple example using a DSL and Guvnor.  My DSL is as 
follows:

[when]Age is less than {age} years old=AgeFact(ageInYears  {age})

When I attempt to create a new Business Rule using the Guvnor I can select the 
above expression just fine and the sentence displays as expected.  I then fill 
in the years with a numeric value (4) and validate.  Upon validation I receive 
the following error.

[Age Test Rule] [ERR 101] Line 4:2 no viable alternative at input 'Age' in rule 
Age Test Rule

I then view the source and it looks like this.

rule Age Test Rule
dialect mvel
when
Age is less than 4years old
then
end

I noticed that there is no space between the ‘4’ and the word ‘years’.  
However, in my DSL sentence there is a space between {age} and years.  Another 
interesting thing, if I enter the number 4 followed by a space in the Guvnor 
form then the rule validates correctly.  Is this a bug or is it something I am 
doing wrong in my DSL?

Thanks,
Jeff


CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

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




--


Esteban Aliverti

___
rules-users mailing list
rules-users@lists.jboss.orgmailto: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] AGE problem

2010-02-23 Thread Jason Smith
Hey, I haven't been following this thread, but you can use Joda Time to get 
much better, easier results.  For instance, you can add 1 month to a DateTime 
by using a new Period(P1M) [that is, a period of 1 month] - all done 
according to ISO8601 standards, so it works flawlessly, including adjustments 
for things like daylight savings time (so you don't have to think about it 
much).

In business, we live and die by precise time calculations.  Think of it as 
being like a check writing program that estimates a salary, and then pays the 
employee that amount.  Get your torches and pitchforks!

Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Pavel Tavoda [pavel.tav...@gmail.com]
Sent: Tuesday, February 23, 2010 1:30 AM
To: Rules Users List
Subject: Re: [rules-users] AGE problem

Try to do this in bank application. People come 1 hour after they date
expired and try to charge them for sooner withdrawal because you
calculate with 365.25 not 365 days. You will be kicked, believe me.

Pavel


2010/2/23 Wolfgang Laun wolfgang.l...@gmail.com:
 On Tue, Feb 23, 2010 at 8:07 AM, djb dbrownel...@hotmail.com wrote:

 I think though that the majority of uses for a rules engine is in a
 business
 context, where they don't use astronomical time.

 If the doctor's orders are:
 You cannot get out of bed for 2 months

 This means 59 days if he told you February 1st, and it means 62 days if he
 told you July 1st.


 This is a particularly bad example, because doctors can't say that - at
 least not one I'd trust ;-)

 I'm arguing that you cannot expect a computer program to relieve you from
 the burden of defining what you mean by a duration of one year (or month).
 Some legal rules require a person to have a certain age, and it is (for
 humans)
 more convenient to decide this on a person's birthday YMD plus an increment
 in the Y number. If  your application requires you to use an increment in
 the year
 component of the YMDhms representation of a point in time, then you are
 indeed stuck with Calendar and the resulting overhead. (Memoizing
 the results of YMDhms +/- n years might speed things up, for the usual
 price.)

 But many applications would be satisfied with using a fixed duration for
 a year in terms of 365 or 365.25 or some such value. If, for instance, you
 have a  library, and you must decide to move a book into deep storage
 if it has  not been requested for more than a year you might calculate
 this (faster) by adding 356*24*60*60 to the clock value of the last return.

 -W

 So at least for me, I am going to have to work out a plan that involves
 GregorianCalendar.

 --
 View this message in context:
 http://n3.nabble.com/AGE-problem-tp215215p354847.html
 Sent from the Drools - User 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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.  

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;
 
 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }
 
  @Override
  public void propertyChange(PropertyChangeEvent evt) 
  {
   System.out.println(** UPDATING  + evt.getPropertyName() + :  + 
 \nNEW: + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 \nOLD: + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null  evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





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


Re: [rules-users] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
Here is a twist.

If I call update($fact) explicitly in the rule, the rule is NOT called twice.

Can someone point me to the code used by update($fact)?  Maybe I can figure 
out what I did wrong to cause the rule to fire incorrectly a second time.


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 9:54 AM
To: Rules Users List
Subject: [rules-users] Updates with property change on facts.  How???

I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;

 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }

  @Override
  public void propertyChange(PropertyChangeEvent evt)
  {
   System.out.println(** UPDATING  + evt.getPropertyName() + :  +
 \nNEW: + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 \nOLD: + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null  evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





Jason Smith
___
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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
The Update command appears to be processed in 
org.drools.process.commands.UpdateCommand.   It's doing the update the same way 
I am.  

Why does this code work when Drools uses it, and it doesn't work for me?

package org.drools.process.command;
import org.drools.reteoo.ReteooWorkingMemory;
import org.drools.runtime.rule.FactHandle;
public class UpdateCommand
implements
CommandObject {
private FactHandle handle;
private Object object;
public UpdateCommand(FactHandle handle,
 Object object) {
this.handle = handle;
this.object = object;
}
public Object execute(ReteooWorkingMemory session) {
session.update( handle,
object );
return null;
}
public String toString() {
return session.update(  + handle + ,  + object +  );;
}
}


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 10:04 AM
To: Rules Users List
Subject: Re: [rules-users] Updates with property change on facts.  How???

Here is a twist.

If I call update($fact) explicitly in the rule, the rule is NOT called twice.

Can someone point me to the code used by update($fact)?  Maybe I can figure 
out what I did wrong to cause the rule to fire incorrectly a second time.


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 9:54 AM
To: Rules Users List
Subject: [rules-users] Updates with property change on facts.  How???

I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;

 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }

  @Override
  public void propertyChange(PropertyChangeEvent evt)
  {
   System.out.println(** UPDATING  + evt.getPropertyName() + :  +
 \nNEW: + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 \nOLD: + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null  evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





Jason Smith
___
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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
I think I've solved this.  You have to fire the property change event *AFTER* 
you change the underlying property.  As long as session.update() is called 
*AFTER* the value has changed, things seem to work correctly.

Does this sound like a reasonable solution?  I think I saw in the documentation 
(what little I could find on this particular subject) that the property event 
was triggered before the actual value changed.

Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 10:13 AM
To: Rules Users List
Subject: Re: [rules-users] Updates with property change on facts.  How???

The Update command appears to be processed in 
org.drools.process.commands.UpdateCommand.   It's doing the update the same way 
I am.

Why does this code work when Drools uses it, and it doesn't work for me?

package org.drools.process.command;
import org.drools.reteoo.ReteooWorkingMemory;
import org.drools.runtime.rule.FactHandle;
public class UpdateCommand
implements
CommandObject {
private FactHandle handle;
private Object object;
public UpdateCommand(FactHandle handle,
 Object object) {
this.handle = handle;
this.object = object;
}
public Object execute(ReteooWorkingMemory session) {
session.update( handle,
object );
return null;
}
public String toString() {
return session.update(  + handle + ,  + object +  );;
}
}


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 10:04 AM
To: Rules Users List
Subject: Re: [rules-users] Updates with property change on facts.  How???

Here is a twist.

If I call update($fact) explicitly in the rule, the rule is NOT called twice.

Can someone point me to the code used by update($fact)?  Maybe I can figure 
out what I did wrong to cause the rule to fire incorrectly a second time.


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 9:54 AM
To: Rules Users List
Subject: [rules-users] Updates with property change on facts.  How???

I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;

 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }

  @Override
  public void propertyChange(PropertyChangeEvent evt)
  {
   System.out.println(** UPDATING  + evt.getPropertyName() + :  +
 \nNEW: + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 \nOLD: + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null  evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





Jason Smith
___
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] FW: Rule runs twice without explicit call to update($fact).

2009-11-25 Thread Jason Smith
I never got an answer, any answer to this question.  I really need to know if 
PropertyChangeSupport actually works.  Is anyone out there successfully using 
it?

In one case (using modify()) I get a NPE.  In all cases, the rules run twice 
unless I explicitly call update().  Is anyone *not* seeing this behaviour?  
Is anyone successfully using the PropertyChangeSupport mechanism without 
explicit calls to update()???

Jason Smith

From: Jason Smith
Sent: Monday, November 23, 2009 12:36 PM
To: rules-users@lists.jboss.org
Subject: Rule runs twice without explicit call to update($fact).

My colleague has confirmed that this behavior has been around since Drools 4, 
and it continues to be a problem for Drools 5.0.1 and 5.1.0.M1, assuming it's a 
problem and not working as intended.

$fact.setPath(...) implements the correct PropertyChangeSupport mechanism for 
Drools.  At least Drools is using it and responding mostly as expected.

This runs once:

rule Constrain to owner or published to public

when

$fact : ListFact(

$path : path not matches .*owner.*,

noopResponse == true

)

$model : Model()

then

modify($fact)

{

setPath($fact.getPath() + [owner])

}

update($fact);

end


This runs twice:

rule Constrain to owner or published to public

when

$fact : ListFact(

$path : path not matches .*owner.*,

noopResponse == true

)

$model : Model()

then

modify($fact)

{

setPath($fact.getPath() + [owner])

}

end


If I don't use modify(...) and simply change the $fact bean path property, the 
same thing occurs.  If I explicitly call update($fact), the rule runs once.  If 
I don't it runs twice.

I get /path[owner][owner] when I actually wanted /path[owner], because it 
ran twice, not once.

Why doe update(...) work differently from the PropertyChangeSupport 
mechanism???  Shouldn't I be able to depend on Drools to run this rule only one 
time?

I am, admittedly, a bit of a noob at this, but I ran this by my local Drools 
resident expert, and he doesn't know the answer either.

Thanks so much!

Jason Smith
Software Engineer
InfoTrust Group, Inc.
500 Discovery Parkway, Suite 200
Superior, CO 80027
Office 303-627-6571
Fax 303-666-6711
Email jsm...@infotrustgroup.commailto:jsm...@infotrustgroup.com
WEB www.infotrustgroup.comhttp://www.infotrustgroup.com/
This e-mail and all information included herein do not constitute a legal 
agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.  All 
legal agreements must be formulated in writing by a legal representative of 
INFOTRUST GROUP. This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to whom they are 
addressed.  If you have received this e-mail by mistake, please inform us and 
destroy this e-mail and any documents it might contain.  Please note that any 
views or opinions presented in this email are solely those of the author and do 
not necessarily represent those of the company. Finally, the recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.  Thank you for your cooperation.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] (no subject)

2009-11-23 Thread Jason Smith
SUMMARY:
I am getting a NPE when using modify() with a JavaBean that implements 
PropertyChangeSupport.

I have included the original source and a proposed fix.  Stack trace is also 
included.

This applies to Drools 5.0.1, and has been verified to also be a problem for 
5.1.0.M1.


DETAIL:

I have a rule that looks like this:


rule Constrain to owner or published to public

when

  $fact : ListFact(

  path not matches .*owner.*,

  noopResponse == true

)

then

  modify($fact)

  {

setPath( [owner/username='' or publishlist/publish='All Users'])

  }

end


The $fact is a JavaBean that implements PropertyChangeSupport, and I've 
verified that everything is working correctly at the bean level.  When I run 
this rule, I get this exception:

Caused by: java.lang.NullPointerException:
at org.drools.common.EqualityKey.removeFactHandle(EqualityKey.java:109)
at 
org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1435)
at 
org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:1350)
at 
org.drools.common.AbstractWorkingMemory.propertyChange(AbstractWorkingMemory.java:1577)
at 
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
at 
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
at com.infotrustgroup.rules.RestFact.setPath(RestFact.java:264)
at 
com.infotrustgroup.facts.ParametersFact.setPath(ParametersFact.java:105)
at 
com.infotrustgroup.facts.ParametersFact.setPath(ParametersFact.java:74)
at 
com.infotrustgroup.what.Rule_Constrain_to_owner_or_published_to_public_0.consequence(Rule_Constrain_to_owner_or_published_to_public_0.java:12)
at 
com.infotrustgroup.what.Rule_Constrain_to_owner_or_published_to_public_0ConsequenceInvoker.evaluate(Rule_Constrain_to_owner_or_published_to_public_0ConsequenceInvoker.java:23)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
... 38 more

The offending line is marked below.  It looks like maybe this.instances is 
null in the else clause.

public void removeFactHandle(final InternalFactHandle handle) {
if ( this.handle == handle ) {
if ( this.instances == null ) {
this.handle = null;
} else {
this.handle = (InternalFactHandle) this.instances.remove( 0 );
if ( this.instances.isEmpty() ) {
this.instances = null;
}
}
} else {
***this.instances.remove( handle );***
if ( this.instances.isEmpty() ) {
this.instances = null;
}
}
}

It looks like someone else ran into this problem before, but only fixed it for 
the if portion, not the else portion.  I modified the code as follows, and 
this seems to fix the NPE.  Basically, I followed the pattern from the if 
portion.

public void removeFactHandle(final InternalFactHandle handle) {
if ( this.handle == handle ) {
if ( this.instances == null ) {
this.handle = null;
} else {
this.handle = (InternalFactHandle) this.instances.remove( 0 );
if ( this.instances.isEmpty() ) {
this.instances = null;
}
}
} else {
   if(this.instances == null)
   {
this.handle = null;
   }
   else
   {
this.instances.remove( handle );
if ( this.instances.isEmpty() ) {
 this.instances = null;
}
   }
}
}
Please read around the formatting.  Can someone verify if this is a correct 
fix, and if it should be applied to the codebase?  It seems to work for me.  It 
does not break any unit tests in drools-core 5.0.1 either.

Jason Smith
Software Engineer
InfoTrust Group, Inc.
500 Discovery Parkway, Suite 200
Superior, CO 80027
Office 303-627-6571
Fax 303-666-6711
Email jsm...@infotrustgroup.commailto:jsm...@infotrustgroup.com
WEB www.infotrustgroup.comhttp://www.infotrustgroup.com/
This e-mail and all information included herein do not constitute a legal 
agreement accorded by INFOTRUST GROUP and its affiliates and subsidiaries.  All 
legal agreements must be formulated in writing by a legal representative of 
INFOTRUST GROUP. This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to whom they are 
addressed.  If you have received this e-mail by mistake, please inform us and 
destroy this e-mail and any documents it might contain.  Please note that any 
views or opinions presented in this email are solely those of the author and do 
not necessarily represent those of the company. Finally, the recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.  Thank you for your

Re: [rules-users] how can drools file access class from an external jar

2009-01-09 Thread Jason Novotny


   Thanks, Greg

   I actually have the dependencies setup in my pom.xml and in fact I 
can happily import classes from package A where the core classes are 
and  package B where the rules files are.


   Jason

Greg Barton wrote:

Set up dependencies between the modules in your pom.xml.  You probably want to 
do a multimodule build, but that's not necessary.

Examples of multimodule builds:
http://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/index.html

--- On Thu, 1/8/09, Jason Novotny novo...@gridsphere.org wrote:

  

From: Jason Novotny novo...@gridsphere.org
Subject: [rules-users] how can drools file access class from an external jar
To: rules-users@lists.jboss.org
Date: Thursday, January 8, 2009, 7:19 PM
Hi,

I'm using maven to organize my project into
modules. I have all my 
drools related code in one module called xxx-rules and
things work fine. 
However, if I move one of the classes referenced by a .drl
rules file 
into another module xxx-core it doesn't work anymore.
Does anyone know 
how I can instruct the loader to look for the class in a
different maven 
module?


Thanks, Jason
___
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] how can drools file access class from an external jar

2009-01-08 Thread Jason Novotny


I should add that the error I'm seeing is the following:

17:37:05,634  INFO RuleSet:50 - Reading MyFirstRule
org.drools.rule.InvalidRulePackage: org.myorg.rules.data.StateRule 
Compilation error : [Rule name=My First Rule 1, agendaGroup=MAIN, 
salience=0, no-loop=false]
   org/myorg/rules/Rule_My_First_Rule_1_0.java (2:38) : Only a type can 
be imported. org.myorg.rules.data.State resolves to a package
Rule Compilation error : [Rule name=property type Adder Conforming 55, 
agendaGroup=MAIN, salience=0, no-loop=false]


   Thanks, Jason

Jason Novotny wrote:


Hi,

   I'm using maven to organize my project into modules. I have all my 
drools related code in one module called xxx-rules and things work 
fine. However, if I move one of the classes referenced by a .drl rules 
file into another module xxx-core it doesn't work anymore. Does anyone 
know how I can instruct the loader to look for the class in a 
different maven module?


   Thanks, Jason
___
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] Short circuiting evaluations on LHS

2008-04-03 Thread Newman, Jason
I am currently using Drools 4.0 to determine the best choice out of a data set
based on business rules. The rules eliminate (retract) facts until a single fact
survives, and is used for additional processing. I have found Drools to be a
great solution for this problem, and plan to role it out for additional survivor
rules. My problem is in optimization - this is essentially a batch processing
application, and speed is very important (of course it is  - show me the case
where it isn't, right?).

Some of the later evaluations in the rules are fairly expensive (invoking
complex queries from the database), and generally apply to only a small set of
the use cases. For most use cases, the survivor will have been determined after
the first or second rule, so I only want to perform the expensive evaluations if
necessary. I have not found a way to avoid or schedule the LHS evaluations from
firing when inserting the fact into the working memory. I have played around
with agenda groups and rule flows, but haven't had any luck. The only way I can
think of at this point is to break my rules into separate rule bases, and
manually copy survivors from one working memory to the next, performing my own
short circuiting outside of the rules being fired. 

Is there any other technique that I have missed? From a maintenance standpoint,
I would prefer to be able to use one rule base/rule flow to manage the rules
(there are only about 10 total rules, so the base is not very large - and I
would have to break it into 4 or 5 different rule bases, which seems like it
will be a pain across the 5 different areas I need to implement the rules.)

Thanks,

-Jason



The information transmitted (including attachments) is
covered by the Electronic Communications Privacy Act,
18 U.S.C. 2510-2521, is intended only for the person(s) or
entity/entities to which it is addressed and may contain
confidential and/or privileged material. Any review,
retransmission, dissemination or other use of, or taking
of any action in reliance upon, this information by persons
or entities other than the intended recipient(s) is prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.

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


RE: [rules-users] Issue with nested objects (Repost from message with no subject so that there is a subject)...

2008-03-26 Thread Jason Partyka
So it turns out my issue has something to do with rule-flow groups. I'm 
invoking the WorkingMemory.startProcess(String) method, with a parameter of 
QuoteBuilder to invoke the proper rule-flow, but I'm getting an error that 
says there is no such process id.

I know I am adding the proper .rf file when I build the pacakge and no error is 
occurring when I do that.

-Jason


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Jason Partyka [EMAIL 
PROTECTED]
Sent: Monday, March 24, 2008 4:46 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] Issue with nested objects (Repost from message with no 
subject so that there is a subject)...

Hi all,
I'm having an issue with my rule and Drools 4.0.4. The object that my rule is 
supposed to reason over has nested objects and Drools does not appear to be 
reasoning over it when I modify attributes. I've pasted the rule at the end of 
the e-mail. I am attempting to change the value of the ez_width and ez_drop 
properties and have the corresponding rule below invoked.
I have tried to use the StatefulSession.modifyRetract(FactHandle) and 
StatefulSession.modifyInsert(FactHandle, Object) methods, which I expected to 
work. I then, for the sake of trying, tried the 
StatefulSession.update(FactHandle, Object) method.
After both, I've tried StatefulSession.fireAllRules() as well and nothing.
It's possible I'm missing something in the rules editor but I do not know.
Any insights?
Thanks,
Jason

package com.hightower.templates;

dialect mvel

import com.hightower.tables.BasicBlindFridayTest_JP;
import com.hightower.tables.BasicMountFridayTest;
import com.hightower.tables.CRGtest;


global org.apache.commons.logging.Log LOG;
global com.hightower.drools.beans.hibernate.SoSalesOrderHeader SalesOrderHeader;
global com.hightower.drools.beans.hibernate.ArCustomer Customer;
global com.hightower.drools.beans.hibernate.ArCustomerContact Contact;
global com.hightower.drools.beans.hibernate.SyZipCode ZipCode;
global com.hightower.drools.beans.hibernate.SoShipToAddress ShipToAddress;
global com.hightower.drools.beans.hibernate.SoSalesOrderDetail SalesOrderDetail;
global com.hightower.drools.beans.hibernate.SoSalesHistory SalesHistory;
global com.hightower.drools.beans.hibernate.HtSalesOrderNo SalesOrderNo;
global com.hightower.drools.beans.hibernate.HtCustomerInstallation 
CustomerInstallation;
global com.hightower.drools.beans.hibernate.HtCustomerInfo CustomerInfo;
global com.hightower.drools.beans.hibernate.HtCustomerApplyDiscounts 
CustomerDiscounts;
global com.hightower.drools.beans.hibernate.HtOrderBasicsInfo OrderBasics;
global com.hightower.drools.beans.hibernate.Windows Window;
global com.hightower.drools.beans.hibernate.Rooms Room;




rule awe
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( basicMountFridayTest.mountType == T )
then
$daObj.getBasicBlindFridayTest_JP().setRightwidht(44);
end




rule priceTableValues_ValRule0
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 50.00, 
priceTable.Ez_width = 50.00 )
then
$daObj.getPriceTable().setEz_price(2500.00);
end


rule priceTableValues_ValRule1
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 100.00, 
priceTable.Ez_width = 100.00 )
then
$daObj.getPriceTable().setEz_price(1.00);
end


rule priceTableValues_ValRule2
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 25.00, 
priceTable.Ez_width = 25.00 )
then
$daObj.getPriceTable().setEz_price(625.00);
end


___
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] (no subject)

2008-03-24 Thread Jason Partyka
Hi all,

I'm having an issue with my rule and Drools 4.0.4. The object that my rule is 
supposed to reason over has nested objects and Drools does not appear to be 
reasoning over it when I modify attributes. I've pasted the rule at the end of 
the e-mail. I am attempting to change the value of the ez_width and ez_drop 
properties and have the corresponding rule below invoked.

I have tried to use the StatefulSession.modifyRetract(FactHandle) and 
StatefulSession.modifyInsert(FactHandle, Object) methods, which I expected to 
work. I then, for the sake of trying, tried the 
StatefulSession.update(FactHandle, Object) method.

After both, I've tried StatefulSession.fireAllRules() as well and nothing.

It's possible I'm missing something in the rules editor but I do not know.

Any insights?

Thanks,
Jason


package com.hightower.templates;



dialect mvel



import com.hightower.tables.BasicBlindFridayTest_JP;

import com.hightower.tables.BasicMountFridayTest;

import com.hightower.tables.CRGtest;





global org.apache.commons.logging.Log LOG;

global com.hightower.drools.beans.hibernate.SoSalesOrderHeader SalesOrderHeader;

global com.hightower.drools.beans.hibernate.ArCustomer Customer;

global com.hightower.drools.beans.hibernate.ArCustomerContact Contact;

global com.hightower.drools.beans.hibernate.SyZipCode ZipCode;

global com.hightower.drools.beans.hibernate.SoShipToAddress ShipToAddress;

global com.hightower.drools.beans.hibernate.SoSalesOrderDetail SalesOrderDetail;

global com.hightower.drools.beans.hibernate.SoSalesHistory SalesHistory;

global com.hightower.drools.beans.hibernate.HtSalesOrderNo SalesOrderNo;

global com.hightower.drools.beans.hibernate.HtCustomerInstallation 
CustomerInstallation;

global com.hightower.drools.beans.hibernate.HtCustomerInfo CustomerInfo;

global com.hightower.drools.beans.hibernate.HtCustomerApplyDiscounts 
CustomerDiscounts;

global com.hightower.drools.beans.hibernate.HtOrderBasicsInfo OrderBasics;

global com.hightower.drools.beans.hibernate.Windows Window;

global com.hightower.drools.beans.hibernate.Rooms Room;









rule awe

dialect mvel

ruleflow-group 'Validation'

when

$daObj : AReallyWonderfulAndCrappyTest( basicMountFridayTest.mountType == T )

then

$daObj.getBasicBlindFridayTest_JP().setRightwidht(44);

end









rule priceTableValues_ValRule0

dialect mvel

ruleflow-group 'Validation'

when

$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 50.00, 
priceTable.Ez_width = 50.00 )

then

$daObj.getPriceTable().setEz_price(2500.00);

end





rule priceTableValues_ValRule1

dialect mvel

ruleflow-group 'Validation'

when

$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 100.00, 
priceTable.Ez_width = 100.00 )

then

$daObj.getPriceTable().setEz_price(1.00);

end





rule priceTableValues_ValRule2

dialect mvel

ruleflow-group 'Validation'

when

$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 25.00, 
priceTable.Ez_width = 25.00 )

then

$daObj.getPriceTable().setEz_price(625.00);

end





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


[rules-users] Issue with nested objects (Repost from message with no subject so that there is a subject)...

2008-03-24 Thread Jason Partyka
Hi all,
I'm having an issue with my rule and Drools 4.0.4. The object that my rule is 
supposed to reason over has nested objects and Drools does not appear to be 
reasoning over it when I modify attributes. I've pasted the rule at the end of 
the e-mail. I am attempting to change the value of the ez_width and ez_drop 
properties and have the corresponding rule below invoked.
I have tried to use the StatefulSession.modifyRetract(FactHandle) and 
StatefulSession.modifyInsert(FactHandle, Object) methods, which I expected to 
work. I then, for the sake of trying, tried the 
StatefulSession.update(FactHandle, Object) method.
After both, I've tried StatefulSession.fireAllRules() as well and nothing.
It's possible I'm missing something in the rules editor but I do not know.
Any insights?
Thanks,
Jason

package com.hightower.templates;

dialect mvel

import com.hightower.tables.BasicBlindFridayTest_JP;
import com.hightower.tables.BasicMountFridayTest;
import com.hightower.tables.CRGtest;


global org.apache.commons.logging.Log LOG;
global com.hightower.drools.beans.hibernate.SoSalesOrderHeader SalesOrderHeader;
global com.hightower.drools.beans.hibernate.ArCustomer Customer;
global com.hightower.drools.beans.hibernate.ArCustomerContact Contact;
global com.hightower.drools.beans.hibernate.SyZipCode ZipCode;
global com.hightower.drools.beans.hibernate.SoShipToAddress ShipToAddress;
global com.hightower.drools.beans.hibernate.SoSalesOrderDetail SalesOrderDetail;
global com.hightower.drools.beans.hibernate.SoSalesHistory SalesHistory;
global com.hightower.drools.beans.hibernate.HtSalesOrderNo SalesOrderNo;
global com.hightower.drools.beans.hibernate.HtCustomerInstallation 
CustomerInstallation;
global com.hightower.drools.beans.hibernate.HtCustomerInfo CustomerInfo;
global com.hightower.drools.beans.hibernate.HtCustomerApplyDiscounts 
CustomerDiscounts;
global com.hightower.drools.beans.hibernate.HtOrderBasicsInfo OrderBasics;
global com.hightower.drools.beans.hibernate.Windows Window;
global com.hightower.drools.beans.hibernate.Rooms Room;




rule awe
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( basicMountFridayTest.mountType == T )
then
$daObj.getBasicBlindFridayTest_JP().setRightwidht(44);
end




rule priceTableValues_ValRule0
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 50.00, 
priceTable.Ez_width = 50.00 )
then
$daObj.getPriceTable().setEz_price(2500.00);
end


rule priceTableValues_ValRule1
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 100.00, 
priceTable.Ez_width = 100.00 )
then
$daObj.getPriceTable().setEz_price(1.00);
end


rule priceTableValues_ValRule2
dialect mvel
ruleflow-group 'Validation'
when
$daObj : AReallyWonderfulAndCrappyTest( priceTable.Ez_drop = 25.00, 
priceTable.Ez_width = 25.00 )
then
$daObj.getPriceTable().setEz_price(625.00);
end


___
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] Interesting null pointer exception when inserting afact.

2008-03-14 Thread Jason Partyka
Well, another update, if it helps anyone, I turned off Shadow objects and it's 
still occurring.


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Jason Partyka [EMAIL 
PROTECTED]
Sent: Wednesday, March 12, 2008 1:58 PM
To: Rules Users List
Subject: RE: [rules-users] Interesting null pointer exception when inserting 
afact.

It looks like the bug is still in there.

I am attempting to resolve it myself, but in order to do so I need to go into 
the MVEL code, but the mvel jar that is included as part of the drools 
classpath container (within eclipse) is just mvel14.jar. So I'm not sure where 
the source is or what version of MVEL source I should be attaching. I realize 
that the source-location thing is just an Eclipse issue, but I thought I'd let 
you know right away that it looks like it's still there.

Anywhere you can point me to that would help with making sure I'm looking the 
right code.

Thanks,
Jason

From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Mark Proctor [EMAIL 
PROTECTED]
Sent: Monday, March 10, 2008 8:17 AM
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.

please check with 4.0.x, which will be in 4.0.5 this week, and let us know if 
this is fixed or not. But hurry we are releasing 4.0.5 very soon:
http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/

Mark
Jason Partyka wrote:
I can give this a shot, but the reason why you suggest this is not obvious to 
me.

Have you encountered this problem yourself?

-Jason




From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]] On Behalf Of Anstis, Michael (M.) [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]]
Sent: Monday, March 10, 2008 5:06 AM
To: Rules Users List
Subject: RE: [rules-users] Interesting null pointer exception when inserting 
afact.

I'm no expert but recall there can be problems running long running 
(subjective) code from AWT's worker thread.

I thought it was good practice to run your application code in a worker 
thread. This was the first google hit I had on the matter.

http://www.cs.helsinki.fi/u/vihavain/k03/Java/JavathreadsandGUI.html

Cheers,

Mike


From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Edson Tirelli
Sent: 08 March 2008 13:15
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.


   Jason,

   Can you please isolate and show us the rule that is creating the problem? It 
is happening either in a eval() statement or in a nested property access.

[]s
Edson

2008/3/7, Jason Partyka [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]:
Hi,

This is in relation to drools 4.0.4

I have an interesting problem. I am getting a null pointer exception when I am 
inserting a fact into a StatefulSession object. What is odd about this NPE is 
that, as far as I can tell (and I have inserted a breakpoint right before I 
insert the fact) that all the properties in the object are initialized, and 
there are no rules accessing any thing that could be null.

So here's my exception trace (just first few lines to get context):

Exception in thread AWT-EventQueue-0 org.drools.RuntimeDroolsException: 
java.lang.NullPointerException
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)
  at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
  at 
org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
  at 
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
  at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
  at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
  at org.drools.reteoo.Rete.assertObject(Rete.java:177)
  at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
  at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
  at com.hightower.drools.executablerules.Rules.setTemplate(Rules.java:112)

Caused by: java.lang.NullPointerException
  at 
org.drools.base.mvel.MVELEvalExpression.evaluate(MVELEvalExpression.java:39)
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
  ... 39 more


(that setTemplate method is not a drools template)

Any ideas?

Thanks,
Jason

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



--
  Edson Tirelli
  JBoss Drools Core Development

RE: [rules-users] Interesting null pointer exception when inserting afact.

2008-03-12 Thread Jason Partyka
It looks like the bug is still in there.

I am attempting to resolve it myself, but in order to do so I need to go into 
the MVEL code, but the mvel jar that is included as part of the drools 
classpath container (within eclipse) is just mvel14.jar. So I'm not sure where 
the source is or what version of MVEL source I should be attaching. I realize 
that the source-location thing is just an Eclipse issue, but I thought I'd let 
you know right away that it looks like it's still there.

Anywhere you can point me to that would help with making sure I'm looking the 
right code.

Thanks,
Jason

From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Mark Proctor [EMAIL 
PROTECTED]
Sent: Monday, March 10, 2008 8:17 AM
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.

please check with 4.0.x, which will be in 4.0.5 this week, and let us know if 
this is fixed or not. But hurry we are releasing 4.0.5 very soon:
http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/

Mark
Jason Partyka wrote:
I can give this a shot, but the reason why you suggest this is not obvious to 
me.

Have you encountered this problem yourself?

-Jason




From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]] On Behalf Of Anstis, Michael (M.) [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]]
Sent: Monday, March 10, 2008 5:06 AM
To: Rules Users List
Subject: RE: [rules-users] Interesting null pointer exception when inserting 
afact.

I'm no expert but recall there can be problems running long running 
(subjective) code from AWT's worker thread.

I thought it was good practice to run your application code in a worker 
thread. This was the first google hit I had on the matter.

http://www.cs.helsinki.fi/u/vihavain/k03/Java/JavathreadsandGUI.html

Cheers,

Mike


From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
Behalf Of Edson Tirelli
Sent: 08 March 2008 13:15
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.


   Jason,

   Can you please isolate and show us the rule that is creating the problem? It 
is happening either in a eval() statement or in a nested property access.

[]s
Edson

2008/3/7, Jason Partyka [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]:
Hi,

This is in relation to drools 4.0.4

I have an interesting problem. I am getting a null pointer exception when I am 
inserting a fact into a StatefulSession object. What is odd about this NPE is 
that, as far as I can tell (and I have inserted a breakpoint right before I 
insert the fact) that all the properties in the object are initialized, and 
there are no rules accessing any thing that could be null.

So here's my exception trace (just first few lines to get context):

Exception in thread AWT-EventQueue-0 org.drools.RuntimeDroolsException: 
java.lang.NullPointerException
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)
  at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
  at 
org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
  at 
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
  at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
  at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
  at org.drools.reteoo.Rete.assertObject(Rete.java:177)
  at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
  at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
  at com.hightower.drools.executablerules.Rules.setTemplate(Rules.java:112)

Caused by: java.lang.NullPointerException
  at 
org.drools.base.mvel.MVELEvalExpression.evaluate(MVELEvalExpression.java:39)
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
  ... 39 more


(that setTemplate method is not a drools template)

Any ideas?

Thanks,
Jason

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



--
  Edson Tirelli
  JBoss Drools Core Development
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.comhttp://www.jboss.com



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

RE: [rules-users] Interesting null pointer exception when inserting afact.

2008-03-12 Thread Jason Partyka
Well, I've downloaded the source, and it appears that it is occuring in the 
org.mvel.MVELRuntime class, method execute(). My equals token (==) is being 
properly recognized, and converted to its integer representation (10). However, 
in a block with switch (operator), the org.mvel.Operator.EQUAL token does not 
appear, so the execute() method returns a null value because nothing is ever 
evaluated.

I've even verified that null is being returned from the execute method.

I stepped back out to the line (in org.mvel.CompiledExpression,java)
return handleParserEgress(execute(false, this, staticContext, factory), 
returnBigDecimal);

and then stepped into handleParserEgress and the first parameter, which is the 
return value from execute() is null!

Any ideas?

Thanks,
Jason


---


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Mark Proctor [EMAIL 
PROTECTED]
Sent: Wednesday, March 12, 2008 2:28 PM
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.


Jason Partyka wrote:
It looks like the bug is still in there.

I am attempting to resolve it myself, but in order to do so I need to go into 
the MVEL code, but the mvel jar that is included as part of the drools 
classpath container (within eclipse) is just mvel14.jar. So I'm not sure where 
the source is or what version of MVEL source I should be attaching. I realize 
that the source-location thing is just an Eclipse issue, but I thought I'd let 
you know right away that it looks like it's still there.
We strip jar version numbers to make deployment with Eclipse easier. If you 
look at parent pom.xml it will tell you the version of MVEL used.


Anywhere you can point me to that would help with making sure I'm looking the 
right code.

Thanks,
Jason


From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Mark Proctor [EMAIL 
PROTECTED]
Sent: Monday, March 10, 2008 8:17 AM
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.


please check with 4.0.x, which will be in 4.0.5 this week, and let us know if 
this is fixed or not. But hurry we are releasing 4.0.5 very soon:
http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/

Mark
Jason Partyka wrote:
I can give this a shot, but the reason why you suggest this is not obvious to 
me.

Have you encountered this problem yourself?

-Jason





From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Anstis, Michael (M.) 
[EMAIL PROTECTED]
Sent: Monday, March 10, 2008 5:06 AM
To: Rules Users List
Subject: RE: [rules-users] Interesting null pointer exception when inserting 
afact.


I'm no expert but recall there can be problems running long running 
(subjective) code from AWT's worker thread.

I thought it was good practice to run your application code in a worker 
thread. This was the first google hit I had on the matter.

http://www.cs.helsinki.fi/u/vihavain/k03/Java/JavathreadsandGUI.html

Cheers,

Mike




From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: 08 March 2008 13:15
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.



   Jason,

   Can you please isolate and show us the rule that is creating the problem? It 
is happening either in a eval() statement or in a nested property access.

[]s
Edson


2008/3/7, Jason Partyka [EMAIL PROTECTED]:
Hi,

This is in relation to drools 4.0.4

I have an interesting problem. I am getting a null pointer exception when I am 
inserting a fact into a StatefulSession object. What is odd about this NPE is 
that, as far as I can tell (and I have inserted a breakpoint right before I 
insert the fact) that all the properties in the object are initialized, and 
there are no rules accessing any thing that could be null.

So here's my exception trace (just first few lines to get context):

Exception in thread AWT-EventQueue-0 org.drools.RuntimeDroolsException: 
java.lang.NullPointerException
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)
  at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
  at 
org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
  at 
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
  at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
  at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
  at org.drools.reteoo.Rete.assertObject(Rete.java:177)
  at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
  at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java

RE: [rules-users] Interesting null pointer exception when inserting afact.

2008-03-10 Thread Jason Partyka
I can give this a shot, but the reason why you suggest this is not obvious to 
me.

Have you encountered this problem yourself?

-Jason




From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Anstis, Michael (M.) 
[EMAIL PROTECTED]
Sent: Monday, March 10, 2008 5:06 AM
To: Rules Users List
Subject: RE: [rules-users] Interesting null pointer exception when inserting 
afact.

I'm no expert but recall there can be problems running long running 
(subjective) code from AWT's worker thread.

I thought it was good practice to run your application code in a worker 
thread. This was the first google hit I had on the matter.

http://www.cs.helsinki.fi/u/vihavain/k03/Java/JavathreadsandGUI.html

Cheers,

Mike


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Edson Tirelli
Sent: 08 March 2008 13:15
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting 
afact.


   Jason,

   Can you please isolate and show us the rule that is creating the problem? It 
is happening either in a eval() statement or in a nested property access.

[]s
Edson

2008/3/7, Jason Partyka [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]:
Hi,

This is in relation to drools 4.0.4

I have an interesting problem. I am getting a null pointer exception when I am 
inserting a fact into a StatefulSession object. What is odd about this NPE is 
that, as far as I can tell (and I have inserted a breakpoint right before I 
insert the fact) that all the properties in the object are initialized, and 
there are no rules accessing any thing that could be null.

So here's my exception trace (just first few lines to get context):

Exception in thread AWT-EventQueue-0 org.drools.RuntimeDroolsException: 
java.lang.NullPointerException
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)
  at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
  at 
org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
  at 
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
  at 
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
  at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
  at org.drools.reteoo.Rete.assertObject(Rete.java:177)
  at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
  at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
  at 
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
  at com.hightower.drools.executablerules.Rules.setTemplate(Rules.java:112)

Caused by: java.lang.NullPointerException
  at 
org.drools.base.mvel.MVELEvalExpression.evaluate(MVELEvalExpression.java:39)
  at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
  ... 39 more


(that setTemplate method is not a drools template)

Any ideas?

Thanks,
Jason

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



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


[rules-users] Error Importing DRL into BRMS

2007-12-07 Thread Jason Lee
Hi.  I'm pretty new to drools (this is my second week  :).  When I try 
to create a new package in the BRMS by importing from a DRL file, I get 
this error message, which I'm hoping someone more experienced can make 
sense of:


Unable to import into the package. [Unable to process import: 
javax.jcr.RepositoryException: failed to resolve path relative to 
/drools:repository/drools:package_area/gov.faa.wmt.scheduling.rules/assets: 
Empty path element: : Empty path element: ]


There's no stack trace in the logs that I can see (the BRMS is hosted by 
GlassFish, fwiw).  The DRL is 188 lines long.  Not too long, I guess, 
but I'll not clutter things unless someone really needs to see my (ugly) 
rules file. :P  Thanks!


--
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
Project Mojarra Dev Team
http://blogs.steeplesoft.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Golfer Example: Why will the example get two equal result ?

2007-08-02 Thread jason
 

When I test the Golfer example in Drools4.0 environment. I found the rule
was matched twice but print same result. I try to override equals() and
hashCode() method in Golfer Object, but no change happen. Who can tell me
the reason that happened? 

 

Thanks.

Jason Wang

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


[rules-users] Time constrained rules

2007-07-06 Thread Jason Vasquez

Hi all,

I need a set of rules to fire on time-based criteria.  I have a  
'Clock' object in working memory, along with an unknown number of  
'TestObject's, each of which can report its 'age'.  At some interval,  
I modify the Clock object in working memory, and then fire the  
rules.  As a start (which I'm certain shouldn't work anyway), I'm  
playing around with a rule like this:


rule remove objects older than 2 seconds
when
Clock()
$to : TestObject( ageInMillis  2000 )
then
	System.out.println(new java.util.Date() +  = Retracting  +  
$to);

retract($to);
end

It appears that the RHS is never executed, presumably because  
TestObjects were not modified.  (I'm new to JBossRules, so I'm  
unclear on that )


Alternatively, I could just remove the Clock() constraint and iterate  
an external collection of TestObject's, marking each object as  
modified.  Just looking for the best way here...


Thanks,
-jason

smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Time constrained rules

2007-07-06 Thread Jason Vasquez

Thanks Edison, that will do the trick.


On Jul 6, 2007, at 2:52 PM, Edson Tirelli wrote:



   Jason,

   Yes, the engine does not see any change in TestObject until you  
call update() for it.

   In your case, I would play that a bit different:

rule remove objects older than 2 seconds
when
Clock( $cur : currentTime )
$to : TestObject( creationTime  ( $cur - 2000 ) )
then
System.out.println(new java.util.Date() +  =  
Retracting  +

$to);
retract($to);
end

   This way you only need to update your clock object and not your  
testObjects.


   []s
   Edson




smime.p7s
Description: S/MIME cryptographic signature
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users