Re: [rules-users] Logic Problems drools

2007-08-20 Thread MarkA

Hi,

I downloaded the two examples. If I try to run the jar one I get the
classdefnotfound error:

 java -jar SonsAgesPuzzle.jar
 Exception in thread main java.lang.NoClassDefFoundError:
org/drools/WorkingMemory

Any ideas? I get this whenever I try to run my own Drools stuff outside
eclipse too (works fine inside eclipse) and it is proving a real problem.
Obvously it must be possible to create standalone programs that can be run
from jar's somehow.

Any ideas would be very welcome,

Thanks,

Mark.





Ellen Ning Zhao wrote:
 
 have a look here:
 
 http://ningning.org/blog2/?page_id=122
 
 MarkA wrote:
 Are there examples online somewhere then?

 I just want a few more examples to examine really. That and find out how
 to
 run a drools app outside of eclipse without the noclassdefound error.

 I'll keep a look out on the list.


 Mark Proctor wrote:
   
 Ellen runs a little logic club Dr Gernot Starke one the last one, see 
 mailing list archives for the problem. The winner gets to post the next 
 puzzle, so stay tuned and win, so you can post your puzzle for people to 
 try :) I believe that gernot will post the details of his solution to 
 the blog soon.

 Mark
 MarkA wrote:
 
 I am a big fan of the logic problem puzzles (the ones with the grids)
 and
 would like to play with drools to solve a few - just for a laugh and to
 see
 if it can be done. 

 I found a pretty simple one:
 
 Mrs. Robinson's 4th grade class took a field trip to the local zoo. The
 day
 was sunny and warm - a perfect day to spend at the zoo. The kids had a
 great
 time and the monkeys were voted the class favorite animal. The zoo had
 four
 monkeys - two males and two females. It was lunchtime for the monkeys
 and
 as
 the kids watched, each one ate a different fruit in their favorite
 resting
 place. Can you determine the name of each monkey, what kind of fruit
 each
 monkey ate, and where their favorite resting place was?
1. Sam, who doesn't like bananas, likes sitting on the grass. 
2. The monkey who sat on the rock ate the apple. The monkey who ate
 the
 pear didn't sit on the tree branch. 
3. Anna sat by the stream but she didn't eat the pear. 
4. Harriet didn't sit on the tree branch. Mike doesn't like oranges. 
 -

 But I can't get the logic working, has anyone done any other examples
 for
 drools (or maybe converted the monkey  banana or cannibal ones from
 CLIPS)?

 I have looked at the golf one in the examples but it's a bit simple. In
 that
 one it uses variables for each bit $bobsColour etc. and then uses those
 in
 later rules. I tried it with the one above but I kept needing to refer
 to
 a
 variable that I hadn't yet defined and I couldn't define it as it
 needed
 to
 refer to another one and so on...

 Many thanks,

 Mark.


   
   
 ___
 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
 
 

-- 
View this message in context: 
http://www.nabble.com/Logic-Problems---drools-tf4278900.html#a12231483
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] Logic Problems drools

2007-08-20 Thread Manjax23


Basically the classes you are using are not present in your applications
classpath.
Put all the drools jar files and the dependent jar files in the class path
and run.

java -classpath drools.jar;drools-compiler.jar;;SonsAgesPuzzle.jar
(optionally classname here)

Hope this works.

Thanks,
Manjax23



MarkA wrote:
 
 Hi,
 
 I downloaded the two examples. If I try to run the jar one I get the
 classdefnotfound error:
 
  java -jar SonsAgesPuzzle.jar
  Exception in thread main java.lang.NoClassDefFoundError:
 org/drools/WorkingMemory
 
 Any ideas? I get this whenever I try to run my own Drools stuff outside
 eclipse too (works fine inside eclipse) and it is proving a real problem.
 Obvously it must be possible to create standalone programs that can be run
 from jar's somehow.
 
 Any ideas would be very welcome,
 
 Thanks,
 
 Mark.
 
 
 
 
 
 Ellen Ning Zhao wrote:
 
 have a look here:
 
 http://ningning.org/blog2/?page_id=122
 
 MarkA wrote:
 Are there examples online somewhere then?

 I just want a few more examples to examine really. That and find out how
 to
 run a drools app outside of eclipse without the noclassdefound error.

 I'll keep a look out on the list.


 Mark Proctor wrote:
   
 Ellen runs a little logic club Dr Gernot Starke one the last one, see 
 mailing list archives for the problem. The winner gets to post the next 
 puzzle, so stay tuned and win, so you can post your puzzle for people
 to 
 try :) I believe that gernot will post the details of his solution to 
 the blog soon.

 Mark
 MarkA wrote:
 
 I am a big fan of the logic problem puzzles (the ones with the grids)
 and
 would like to play with drools to solve a few - just for a laugh and
 to
 see
 if it can be done. 

 I found a pretty simple one:
 
 Mrs. Robinson's 4th grade class took a field trip to the local zoo.
 The
 day
 was sunny and warm - a perfect day to spend at the zoo. The kids had a
 great
 time and the monkeys were voted the class favorite animal. The zoo had
 four
 monkeys - two males and two females. It was lunchtime for the monkeys
 and
 as
 the kids watched, each one ate a different fruit in their favorite
 resting
 place. Can you determine the name of each monkey, what kind of fruit
 each
 monkey ate, and where their favorite resting place was?
   1. Sam, who doesn't like bananas, likes sitting on the grass. 
   2. The monkey who sat on the rock ate the apple. The monkey who ate
 the
 pear didn't sit on the tree branch. 
   3. Anna sat by the stream but she didn't eat the pear. 
   4. Harriet didn't sit on the tree branch. Mike doesn't like oranges. 
 -

 But I can't get the logic working, has anyone done any other examples
 for
 drools (or maybe converted the monkey  banana or cannibal ones from
 CLIPS)?

 I have looked at the golf one in the examples but it's a bit simple.
 In
 that
 one it uses variables for each bit $bobsColour etc. and then uses
 those
 in
 later rules. I tried it with the one above but I kept needing to refer
 to
 a
 variable that I hadn't yet defined and I couldn't define it as it
 needed
 to
 refer to another one and so on...

 Many thanks,

 Mark.


   
   
 ___
 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
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Logic-Problems---drools-tf4278900.html#a12233104
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] Problem with Student - module example

2007-08-20 Thread Dave, Rajeev
Given:
Student.java
public class Student {
private String name;
private ArrayList modules = new ArrayList();
...
}

Module.java
public class Module {
private String name;
private Student student;
private int score;
...
}

Rule:
exists( $student : Student()  Module( student == $student  score 
40 ) )

Problem statement:
I assert 2 Students and 2 modules in the session
Student s = new Student(), s1 = new Student();
  Module m = new Module(), m1 = new Module();
  m.setName(English); m.setStudent(s); m.setScore(10);
  s.setName(abc); s.addModule(m);

  m1.setName(English1); m1.setStudent(s1); m1.setScore(50);
  s1.setName(xyz); s1.addModule(m1);
  
workingMemory.insert(m);
  workingMemory.insert(s);

Result:
I  get 2 activations. I am expecting only 1 activation as only xyz
student has score  40

Am I missing something or is this a bug?

Rgds,
rajeev


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


Re: [rules-users] Logic Problems drools

2007-08-20 Thread MarkA

I've tried that. I copied all the drools jars (14 of them) into a directory
and then used that on the classpath - didn't work.

I also searched for every jar file on my Mac, put them all in there and
tried again - failed.

It's only Drools I have a problem with, anything else I create works fine.



Manjax23 wrote:
 
 
 Basically the classes you are using are not present in your applications
 classpath.
 Put all the drools jar files and the dependent jar files in the class path
 and run.
 
 java -classpath drools.jar;drools-compiler.jar;;SonsAgesPuzzle.jar
 (optionally classname here)
 
 Hope this works.
 
 Thanks,
 Manjax23
 
 
 
 MarkA wrote:
 
 Hi,
 
 I downloaded the two examples. If I try to run the jar one I get the
 classdefnotfound error:
 
  java -jar SonsAgesPuzzle.jar
  Exception in thread main java.lang.NoClassDefFoundError:
 org/drools/WorkingMemory
 
 Any ideas? I get this whenever I try to run my own Drools stuff outside
 eclipse too (works fine inside eclipse) and it is proving a real problem.
 Obvously it must be possible to create standalone programs that can be
 run from jar's somehow.
 
 Any ideas would be very welcome,
 
 Thanks,
 
 Mark.
 
 
 
 
 
 Ellen Ning Zhao wrote:
 
 have a look here:
 
 http://ningning.org/blog2/?page_id=122
 
 MarkA wrote:
 Are there examples online somewhere then?

 I just want a few more examples to examine really. That and find out
 how to
 run a drools app outside of eclipse without the noclassdefound error.

 I'll keep a look out on the list.


 Mark Proctor wrote:
   
 Ellen runs a little logic club Dr Gernot Starke one the last one,
 see 
 mailing list archives for the problem. The winner gets to post the
 next 
 puzzle, so stay tuned and win, so you can post your puzzle for people
 to 
 try :) I believe that gernot will post the details of his solution to 
 the blog soon.

 Mark
 MarkA wrote:
 
 I am a big fan of the logic problem puzzles (the ones with the grids)
 and
 would like to play with drools to solve a few - just for a laugh and
 to
 see
 if it can be done. 

 I found a pretty simple one:
 
 Mrs. Robinson's 4th grade class took a field trip to the local zoo.
 The
 day
 was sunny and warm - a perfect day to spend at the zoo. The kids had
 a
 great
 time and the monkeys were voted the class favorite animal. The zoo
 had
 four
 monkeys - two males and two females. It was lunchtime for the monkeys
 and
 as
 the kids watched, each one ate a different fruit in their favorite
 resting
 place. Can you determine the name of each monkey, what kind of fruit
 each
 monkey ate, and where their favorite resting place was?
  1. Sam, who doesn't like bananas, likes sitting on the grass. 
  2. The monkey who sat on the rock ate the apple. The monkey who ate
 the
 pear didn't sit on the tree branch. 
  3. Anna sat by the stream but she didn't eat the pear. 
  4. Harriet didn't sit on the tree branch. Mike doesn't like oranges. 
 -

 But I can't get the logic working, has anyone done any other examples
 for
 drools (or maybe converted the monkey  banana or cannibal ones from
 CLIPS)?

 I have looked at the golf one in the examples but it's a bit simple.
 In
 that
 one it uses variables for each bit $bobsColour etc. and then uses
 those
 in
 later rules. I tried it with the one above but I kept needing to
 refer to
 a
 variable that I hadn't yet defined and I couldn't define it as it
 needed
 to
 refer to another one and so on...

 Many thanks,

 Mark.


   
   
 ___
 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
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Logic-Problems---drools-tf4278900.html#a12237669
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] Logic Problems drools

2007-08-20 Thread Ellen Ning Zhao
I had exactly the same problem when I was evaluating the submissions
from last round. Here is a fragment from my .bashrc:

export DROOLS_HOME=/home//drools-4.0.0.SNAPSHOT-bin.zip_FILES/

export
CLASSPATH=$CLASSPATH:$DROOLS_HOME/drools-compiler-4.0.0.SNAPSHOT.jar:$DROOLS_HOME/drools-core-4.0.0.SNAPSHOT.jar:$DROOLS_HOME/lib/antlr-runtime-3.0.jar:$DROOLS_HOME/lib/janino-2.5.7.jar:$DROOLS_HOME/lib/core-3.2.3.v_686_R32x.jar


This did not work. As a result I had to run everything from within the
Eclipse.

MarkA wrote:
 I've tried that. I copied all the drools jars (14 of them) into a directory
 and then used that on the classpath - didn't work.

 I also searched for every jar file on my Mac, put them all in there and
 tried again - failed.

 It's only Drools I have a problem with, anything else I create works fine.



 Manjax23 wrote:
   
 Basically the classes you are using are not present in your applications
 classpath.
 Put all the drools jar files and the dependent jar files in the class path
 and run.

 java -classpath drools.jar;drools-compiler.jar;;SonsAgesPuzzle.jar
 (optionally classname here)

 Hope this works.

 Thanks,
 Manjax23



 MarkA wrote:
 
 Hi,

 I downloaded the two examples. If I try to run the jar one I get the
 classdefnotfound error:

  java -jar SonsAgesPuzzle.jar
  Exception in thread main java.lang.NoClassDefFoundError:
 org/drools/WorkingMemory

 Any ideas? I get this whenever I try to run my own Drools stuff outside
 eclipse too (works fine inside eclipse) and it is proving a real problem.
 Obvously it must be possible to create standalone programs that can be
 run from jar's somehow.

 Any ideas would be very welcome,

 Thanks,

 Mark.





 Ellen Ning Zhao wrote:
   
 have a look here:

 http://ningning.org/blog2/?page_id=122

 MarkA wrote:
 
 Are there examples online somewhere then?

 I just want a few more examples to examine really. That and find out
 how to
 run a drools app outside of eclipse without the noclassdefound error.

 I'll keep a look out on the list.


 Mark Proctor wrote:
   
   
 Ellen runs a little logic club Dr Gernot Starke one the last one,
 see 
 mailing list archives for the problem. The winner gets to post the
 next 
 puzzle, so stay tuned and win, so you can post your puzzle for people
 to 
 try :) I believe that gernot will post the details of his solution to 
 the blog soon.

 Mark
 MarkA wrote:
 
 
 I am a big fan of the logic problem puzzles (the ones with the grids)
 and
 would like to play with drools to solve a few - just for a laugh and
 to
 see
 if it can be done. 

 I found a pretty simple one:
 
 Mrs. Robinson's 4th grade class took a field trip to the local zoo.
 The
 day
 was sunny and warm - a perfect day to spend at the zoo. The kids had
 a
 great
 time and the monkeys were voted the class favorite animal. The zoo
 had
 four
 monkeys - two males and two females. It was lunchtime for the monkeys
 and
 as
 the kids watched, each one ate a different fruit in their favorite
 resting
 place. Can you determine the name of each monkey, what kind of fruit
 each
 monkey ate, and where their favorite resting place was?
 1. Sam, who doesn't like bananas, likes sitting on the grass. 
 2. The monkey who sat on the rock ate the apple. The monkey who 
 ate
 the
 pear didn't sit on the tree branch. 
 3. Anna sat by the stream but she didn't eat the pear. 
 4. Harriet didn't sit on the tree branch. Mike doesn't like 
 oranges. 
 -

 But I can't get the logic working, has anyone done any other examples
 for
 drools (or maybe converted the monkey  banana or cannibal ones from
 CLIPS)?

 I have looked at the golf one in the examples but it's a bit simple.
 In
 that
 one it uses variables for each bit $bobsColour etc. and then uses
 those
 in
 later rules. I tried it with the one above but I kept needing to
 refer to
 a
 variable that I hadn't yet defined and I couldn't define it as it
 needed
 to
 refer to another one and so on...

 Many thanks,

 Mark.


   
   
   
 ___
 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] Logic Problems drools

2007-08-20 Thread Mark Proctor
btw you don't need janino if you have jdt core. This is standard java, 
there is no reason for this not to work, must be the way you are setting 
up your classpath. Btw there is the 4.0.1 SNAPSHOT available now. Did 
you rememer to add mvel?


http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules

Mark
Ellen Ning Zhao wrote:

I had exactly the same problem when I was evaluating the submissions
from last round. Here is a fragment from my .bashrc:

export DROOLS_HOME=/home//drools-4.0.0.SNAPSHOT-bin.zip_FILES/

export
CLASSPATH=$CLASSPATH:$DROOLS_HOME/drools-compiler-4.0.0.SNAPSHOT.jar:$DROOLS_HOME/drools-core-4.0.0.SNAPSHOT.jar:$DROOLS_HOME/lib/antlr-runtime-3.0.jar:$DROOLS_HOME/lib/janino-2.5.7.jar:$DROOLS_HOME/lib/core-3.2.3.v_686_R32x.jar


This did not work. As a result I had to run everything from within the
Eclipse.

MarkA wrote:
  

I've tried that. I copied all the drools jars (14 of them) into a directory
and then used that on the classpath - didn't work.

I also searched for every jar file on my Mac, put them all in there and
tried again - failed.

It's only Drools I have a problem with, anything else I create works fine.



Manjax23 wrote:
  


Basically the classes you are using are not present in your applications
classpath.
Put all the drools jar files and the dependent jar files in the class path
and run.

java -classpath drools.jar;drools-compiler.jar;;SonsAgesPuzzle.jar
(optionally classname here)

Hope this works.

Thanks,
Manjax23



MarkA wrote:

  

Hi,

I downloaded the two examples. If I try to run the jar one I get the
classdefnotfound error:

 java -jar SonsAgesPuzzle.jar
 Exception in thread main java.lang.NoClassDefFoundError:
org/drools/WorkingMemory

Any ideas? I get this whenever I try to run my own Drools stuff outside
eclipse too (works fine inside eclipse) and it is proving a real problem.
Obvously it must be possible to create standalone programs that can be
run from jar's somehow.

Any ideas would be very welcome,

Thanks,

Mark.





Ellen Ning Zhao wrote:
  


have a look here:

http://ningning.org/blog2/?page_id=122

MarkA wrote:

  

Are there examples online somewhere then?

I just want a few more examples to examine really. That and find out
how to
run a drools app outside of eclipse without the noclassdefound error.

I'll keep a look out on the list.


Mark Proctor wrote:
  
  


Ellen runs a little logic club Dr Gernot Starke one the last one,
see 
mailing list archives for the problem. The winner gets to post the
next 
puzzle, so stay tuned and win, so you can post your puzzle for people
to 
try :) I believe that gernot will post the details of his solution to 
the blog soon.


Mark
MarkA wrote:


  

I am a big fan of the logic problem puzzles (the ones with the grids)
and
would like to play with drools to solve a few - just for a laugh and
to
see
if it can be done. 


I found a pretty simple one:

Mrs. Robinson's 4th grade class took a field trip to the local zoo.
The
day
was sunny and warm - a perfect day to spend at the zoo. The kids had
a
great
time and the monkeys were voted the class favorite animal. The zoo
had
four
monkeys - two males and two females. It was lunchtime for the monkeys
and
as
the kids watched, each one ate a different fruit in their favorite
resting
place. Can you determine the name of each monkey, what kind of fruit
each
monkey ate, and where their favorite resting place was?
	1. Sam, who doesn't like bananas, likes sitting on the grass. 
	2. The monkey who sat on the rock ate the apple. The monkey who ate

the
pear didn't sit on the tree branch. 
	3. Anna sat by the stream but she didn't eat the pear. 
	4. Harriet didn't sit on the tree branch. Mike doesn't like oranges. 
-


But I can't get the logic working, has anyone done any other examples
for
drools (or maybe converted the monkey  banana or cannibal ones from
CLIPS)?

I have looked at the golf one in the examples but it's a bit simple.
In
that
one it uses variables for each bit $bobsColour etc. and then uses
those
in
later rules. I tried it with the one above but I kept needing to
refer to
a
variable that I hadn't yet defined and I couldn't define it as it
needed
to
refer to another one and so on...

Many thanks,

Mark.


  
  
  


___
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

[rules-users] Are rules with time windows supported? Thanks.

2007-08-20 Thread Anh Vuong
Hi,
  My understanding is that time window rule is not supported yet in 4.0 after 
checking the manual and followed some blogs regarding SEP/CEP.  I wonder if 
some workaround can be done for simple case such as collect some similar events 
over 1 minute. Will time window feature be included soon?
   
  Thanks,
  anh

   
-
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Re: Odd static inner class behavior

2007-08-20 Thread Fernando Meyer
Hi Eric, after some tests I noticed that in java language you can't  
import the same class name twice even if the class is defined in  
different packages, ie try creating a java file and import both  
java.awt.List and java.util.List, it won't work, you will get a  
similar error from javac compiler


So, if it is really necessary you can try using two package builders  
as I did in the following example


public void testImportColision () throws Exception  {
final PackageBuilder builder = new PackageBuilder();
final PackageBuilder builder2 = new PackageBuilder();
builder.addPackageFromDrl( new InputStreamReader( getClass 
().getResourceAsStream( nested1.drl ) ) );
builder2.addPackageFromDrl( new InputStreamReader( getClass 
().getResourceAsStream( nested2.drl ) ) );

final Package pkg = builder.getPackage();
final Package pkg2 = builder2.getPackage();

final RuleBase ruleBase = getRuleBase();
ruleBase.addPackage( pkg );
ruleBase.addPackage( pkg2 );


final WorkingMemory workingMemory =  
ruleBase.newStatefulSession();


workingMemory.insert( new FirstClass() );
workingMemory.insert( new SecondClass() );
workingMemory.insert( new FirstClass.AlternativeKey() );
workingMemory.insert( new SecondClass.AlternativeKey() );

workingMemory.fireAllRules();
}

Regards
Fernando

On Aug 1, 2007, at 1:15 PM, Eric Miles wrote:


Edson,

I was finally able to get around to making a test case to determine  
if I did in fact see this behavior.  I can reproduce it and have  
opened up a Jira for it.  I have also attached my test case for  
easy reproduction. For your (and other's) knowledge, here is the link:


http://jira.jboss.com/jira/browse/JBRULES-1053

Truly odd behavior for sure!

Thanks,
Eric

Edson Tirelli wrote:

Eric,
Please do! Thanks,
Edson
2007/7/26, Eric Miles [EMAIL PROTECTED]  
mailto:[EMAIL PROTECTED]:

Edson,
That certainly makes sense.  However I'm fairly certain that in
referencing the inner class in rule definition, I always  
qualified it

with the outer class name, ie:
DataClass.AlternativeKey()
or
AnotherClass.AlternativeKey()
I appreciate your explaination of the merge process.  Rather  
than have
you spend any more time on this, I'll try to put together a  
test case to
ensure I was seeing the behavior I thought I was seeing.  I  
probably

won't get around to this until tonight or the weekend.
If I was mistaken, I'll let you (and the mailing list) know.   
If I was
not, would you like me to open a JIRA with the attached test  
case?  I
would assume that if the inner classes contain the qualified  
name that

the engine should be able to handle that?
Thanks,
Eric
Edson Tirelli wrote:
 
  Eric,
 
  Thanks, I understand now.
 
   What happens is that if both DRL files declare the  
same package
  name, all their contents will be merged. It means that you  
would

end up
  with both imports in the same namespace:
 
  import com.company.DataClass.AlternativeKey;
  import com.company.AnotherClass.AlternativeKey;
 
   And so the engine will raise an error saying that it does
not know
  which one you are refering to when you write simply:
 
  AlternativeKey
 
  I think the engine behavior is correct, since the idea  
of loading
  two different files with the same name space into the same  
package

  builder is to merge them, or even replace (update) that
eventually have
  the same name.
 
  What do you think?
 
  Edson
 
 
  2007/7/26, Eric Miles [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
  mailto: [EMAIL PROTECTED]  
mailto:[EMAIL PROTECTED]:

 
  Edson,
 
  I have since changed my schema but here was my issue:
 
  rule1.drl:
  import com.company.DataClass.AlternativeKey;
  import com.company.DataClass;
 
  rule Some rule
  when
  DataClass.AlternativeKey(someParm == true)
  then
  ...
  end
 
  Different drlf file:
  rule2.drl
  import com.company.AnotherClass.AlternativeKey;
  import com.company.AnotherClass;
 
  rule Another rule
  when
  AnotherClass.AlternativeKey(diffParm == 1)
  then
  ...
  end
 
 
  This was the gist of what I was doing.  The outer  
classes' names

  were different, it was the INNER class of each of these
classes that
  had the same name.  I was actually getting compile  
errors on the
  import statements.  Like I said, these rules worked  
fine if

loaded
  separately, but once I tried to put them all int he  
same 

Re: [rules-users] Drools - is dynamic change possible ?

2007-08-20 Thread pns77

Any suggestions / guidance for the below question ?


pns77 wrote:
 
 Hi,
 
 The following is the block of code that i tried
 
 RuleBase ruleBase = readRule();
 WorkingMemory workingMemory =
 ruleBase.newStatefulSession(false); // to keep reference
 // Create a message object
 workingMemory.insert( message );
 workingMemory.fireAllRules();
 
 When i try chaning the drl file at run time the change doesnt get
 reflected. Is there anything else i need to be doing here?  Any additional
 jar files ?
 
 To have this change take effect at runtime - do i need to create a new
 session for each run or do i need to retain the session - i tried both
 newStatefulSession(false) and newStatefulSession() - get the same
 result with both.
 
 Just to add on...for two successive runs, the times taken to create
 RuleBase object were
 
  START 1187339950422
  FINISH .1187339956100 = ~ 6 seconds
 
  START 1187340049090
  FINISH .1187340049721 = ~ .6 seconds
 
 Doesnt this mean that there is a cache that prevents the modified drl file
 from being parsed ?
 
 
 Mark Proctor wrote:
 
 Yes this can be done at runtime. The RuleBase has a reference to each of 
 the created StatefulSessions that has not called dispose() yet and will 
 push those rule changes out to each running session.
 
 
 Mark
 pns77 wrote:
 Thanks for the response.

 Just to confirm when you say ...but you can remove a rule and add
 another
 in its place... - can this be done at runtime - i.e server is running,
 i go
 add a new rule/change the output of an existing rule. If so, can  i have
 the
 new rule take effect ?

 Also, do i need to include any specific jar file for this dynamic
 feature ?

 Am not looking at performance here - more from a
 maintenance/changeability
 point of view.


 Mark Proctor wrote:
   
 you cannot change an individual rule, but you can remove a rule and add 
 another in its place.

 Mark
 pns77 wrote:
 
 Have been able to execute/run a sample Drools file

 import com.sample.Message;
  
 rule Hello World
 when
 m : Message( status == Message.HELLO, message : message,
 testStringExternal : testStringExternal )
 then
 System.out.println( message );
 m.setMessage( Goodbye cruel world );
 System.out.println( testStringExternal + Message.HELLO );
 m.setStatus( Message.GOODBYE );
 update( m );
 end

 Now, is it possible to change the logic dynamically at runtime ? Or is
 the
 drl file used only to externalize the business logic? I tried changing
 the
 message in drl file and it didnt get reflected

 Environment - RAD 6.0/jdk 1.4

 Used the following set of jar files
 C:\Drools\libraries\drools-core.jar;
 C:\Drools\libraries\drools-compiler.jar;
 C:\Drools\libraries\mvel14.jar;
 C:\Drools\libraries\antlr-runtime.jar;
 C:\Drools\libraries\xstream.jar;
 C:\Drools\lib\core-3.2.3.v_686_R32x.jar; 
   
   
 ___
 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
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Drools---is-dynamic-change-possible---tf4277622.html#a12248108
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