Re: [rules-users] JSR-94 and JEE integration

2008-08-01 Thread Rainer Langbehn

The "Rules Framework" project @ sourceforge,
http://sourceforge.net/projects/rules/,
addresses this scenario, especially the JSR 94 based JCA resource adapter
and the
JSR 94 based Stateless Decision Service.

Rainer


Knoster wrote:
> 
> Hi,
> i would like to integrate drools in jee. to be more flexible i was loking
> at jsr-94. as i suppose jsr-94 only addresses j2se environment, my
> question is: how it is possible to use drools with this specs from an ejb3
> session bean? my thoughts about this brought me to the idea of injecting
> the rules-administrator via resource annotation to prevent the container
> always doing a class.forname(..) lookup. to define a j2se resource in a
> jee container a jca might be the best way to integrate and to assure the
> jee specs will not be violated. but this seams a lot of overhead to me.
> how do u use drools in your jee applications when not relying on the brms?
> any help or ideas on integrating drools with jsr-94 in jee would be great.
> 
> Knosta
> 
> 
> 
> ___
> 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/JSR-94-and-JEE-integration-tp17751072p18749348.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] Compiling .drl files inside of a JUnit test

2008-08-01 Thread Ron Kneusel

Mark Proctor wrote:

>You don't have your DRLs in the correct location, our DRLs mirror the path of 
>the class that is loading them via getClass().getResourceAsStream():
>http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/
>It just does a loadClass on the classLoader, as long as your classes are in 
>the classpath it will find them. 

So, when the compiler is compiling the rules file, it will "inherit" the 
classpath from Eclipse?  Or it should?  To me, the key is your phrase "as long 
as your classes are in the classpath".  As far as Eclipse is concerned they 
are, but what classpath is used by the compiler of the .drl file?

There is an entire complex directory structure to the project and the unit 
tests are in one directory which is far removed from the source for the classes 
yet when other unit tests run, they see everything as expected, which my test 
class extending TestCase also sees, but not the compiler compiling the .drl 
file.

Apologies for being so slow with this but I'm learning Java and Drools at the 
same time, not an ideal situation.  Thanks for the help!

Ron

_
Use video conversation to talk face-to-face with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] determinism with rulebase partitioning

2008-08-01 Thread Mark Proctor

Sorry I meant to ask this on th dev list :(
Anstis, Michael (M.) wrote:

Hi Mark,

A few questions:-

(A) What does "parallel evaluation of a rulebase" mean? Is it designed
to optimise, for example, two threads processing a stateless and
stateful session?
  
It works out the parts of the network that can be isolated, so we can 
use multiple threads in parallel for evalation of a rulebase.

(B) Are there only two partitions, both of which are invisible to the
user? Is there any value in allowing user-defined partitions?
  
There could be any number of partitions depending on the analysis of the 
rulebase. It's an internal optimisation of a rulebase, so it's not 
something they are aware of. A user cannot define a partition, as 
partitions are determined by the rules written and their level of isolation.

(C) Does the partition used depend upon what type of session is used
(i.e. stateless always uses the partition without an agenda whereas
stateful always uses the partition with an agenda)?
  
it analysesthe rulebase, nothing to do with the session type. However 
stateless sessions without inference typically don't need determinstic 
execution, so we can just evaluate and fire there.

(D) Can a rule sometimes be deterministic and sometimes not (i.e.
depends upon the type of session)?
  
Not on the type of session, no. And having a rule sometimes determinstic 
would probably be bad.

Cheers,

Mike

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
Sent: 01 August 2008 07:05
To: Rules Users List
Subject: [rules-users] determinism with rulebase partitioning

We have rulebase partitioning almost working, this allows parallel 
evaluation of a rulebase. For stateless lessions with no agenda this 
will allow for much faster executions, where you don't care about 
deterministic execution. However for deterministic execution its more 
complicated. The current plan is to have an agenda per parition, which 
means that we no longer have rulebase wide deterministic execution 
order, only with the partition itself. The user is unlikely to be aware 
of the created partitions, so won't be aware of the unditermistic 
behavour of their rulebase. Anyone have any input on mechanisms users 
can do to help the rulebase know what needs to be executed 
deterministically and what doesn't?


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] Compiling .drl files inside of a JUnit test

2008-08-01 Thread Mark Proctor

Ron Kneusel wrote:

Edson wrote:
  

Right now, Drools uses JUnit for all its unit and integration tests. Take a 
look at the integration tests and I think you will figure out:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/



Thanks for the link but I do not see how this helps with my problem.  Perhaps 
it would if I could see the actual .drl files.  For example, when I use 
getClass().getResourceAsStream(...) a null is returned but even it that part 
worked, it wouldn't be any different than what I currently have.
  
You don't have your DRLs in the correct location, our DRLs mirror the 
path of the class that is loading them via getClass().getResourceAsStream():

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/

Seeing the .drl file is not the problem.  Getting the import statements in the 
.drl file to actually find the proper classes is.  Do you know how the actual 
.drl files used in the unit testing are referring to the objects they need?
  
It just does a loadClass on the classLoader, as long as your classes are 
in the classpath it will find them.

Ron

_
Use video conversation to talk face-to-face with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008
___
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] Reusing predicates

2008-08-01 Thread Mark Proctor

Kris Nuttycombe wrote:

Hi, all,

I have a set of rules where the LHS is essentially the same except for
a couple of additional conditions in each case. What is the best way
to factor out these common predicates? Should I simply create an
intermediate fact based upon the common set of conditions and then
reason with that fact, or is there a way of reusing them without
adding another fact to the mix?
  
'or' conditional element will result in subrule generation, but you 
would need to put all your logic in a single rule. You could try a DSL 
to create building blocks of your re-usable parts. Also your predicate 
logic should be in a function, so that function is re-usable.

Thanks,

Kris
___
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] Compiling .drl files inside of a JUnit test

2008-08-01 Thread Ron Kneusel

Edson wrote:
>
>Right now, Drools uses JUnit for all its unit and integration tests. Take a 
>look at the integration tests and I think you will figure out:
>http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/

Thanks for the link but I do not see how this helps with my problem.  Perhaps 
it would if I could see the actual .drl files.  For example, when I use 
getClass().getResourceAsStream(...) a null is returned but even it that part 
worked, it wouldn't be any different than what I currently have.

Seeing the .drl file is not the problem.  Getting the import statements in the 
.drl file to actually find the proper classes is.  Do you know how the actual 
.drl files used in the unit testing are referring to the objects they need?

Ron

_
Use video conversation to talk face-to-face with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Problems with looping

2008-08-01 Thread Greg Barton
Did you implement equals() and hashCode()?

Implementing them isn't hard.  Implementing them well
can be tricky, but for these purposes a simple
implementation will do.  Basically, with equals() you
want to compare the stuff contained in the objects. 
With hashCode() you want to produce an integer that
can be used in HashMaps.  The only restriction is
that, if o1.equals(o2) == true, then o1.hashCode() ==
o2.hashCode().  (The reverse is not necessarily true.)

The easiest way to implement these is to just compare
the fields that define the state of your object:

public class Foo {

  int bar;
  String bas;

  public boolean equals(Object o) {
if(o instanceof Foo) {
  Foo other = (Foo)o;
  return bar == other.bar && bas != null &&
bas.equals(other.bas);
} else {
  return false;
}
  }

  public int hashCode() {
int hash = 37;
hash ^= bar;
if(bas != null) {
  hash ^= bas.hashCode();
}
return hash;
  }
}

One good way to make this easier is to use the jakarta
commons EqualsBuilder and HashCodeBuilder classes. 
They also help you implement them "well," especially
hashCode.

GreG

--- thomas kukofka <[EMAIL PROTECTED]> wrote:

> Hi, I used no-loop true but it still loops!!
> 
> Thomas
> 
> Hi
> 
> you must use "no-loop true" and the rule will be
> executed one for one
> InputObject.
> 
> 
> 2008/8/1 thomas kukofka 
web.de
> >:
> 
> > Hello,
> 
> >
> 
> > I have and less loop (the rule should only
> executed one for one
> InputObject)
> 
> > in the follwing rule although I use "no-loop":
> 
> >
> 
> > rule "rulename"
> 
> >   dialect "java"
> 
> >   no-loop
> 
> > when
> 
> > io: InputObject (type ==
> InputObject.Type.Typename)
> 
> > then
> 
> >
> io.setStringPropertyValue(InputObject.PROPERTYVALUE,
> "somestring");
> 
> > update(oo);
> 
> >
> 
> > end
> 
> >
> 
> > I've read that I have to overwrite hashcode and
> equals, can this be the
> 
> > reason? If yes, do you have an example how to
> overwrite these methods?
> 
> >
> 
> > Thomas
> > ___
> 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 looping

2008-08-01 Thread thomas kukofka
Hi, I used no-loop true but it still loops!!

Thomas

Hi

you must use "no-loop true" and the rule will be executed one for one
InputObject.


2008/8/1 thomas kukofka https://lists.jboss.org/mailman/listinfo/rules-users>
>:

> Hello,

>

> I have and less loop (the rule should only executed one for one
InputObject)

> in the follwing rule although I use "no-loop":

>

> rule "rulename"

>   dialect "java"

>   no-loop

> when

> io: InputObject (type == InputObject.Type.Typename)

> then

> io.setStringPropertyValue(InputObject.PROPERTYVALUE,
"somestring");

> update(oo);

>

> end

>

> I've read that I have to overwrite hashcode and equals, can this be the

> reason? If yes, do you have an example how to overwrite these methods?

>

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


[rules-users] (no subject)

2008-08-01 Thread thomas kukofka
Hi, I used no-loop true but it still loops!!

Thomas

Hi

you must use "no-loop true" and the rule will be executed one for one
InputObject.


2008/8/1 thomas kukofka https://lists.jboss.org/mailman/listinfo/rules-users>
>:

> Hello,

>

> I have and less loop (the rule should only executed one for one
InputObject)

> in the follwing rule although I use "no-loop":

>

> rule "rulename"

>   dialect "java"

>   no-loop

> when

> io: InputObject (type == InputObject.Type.Typename)

> then

> io.setStringPropertyValue(InputObject.PROPERTYVALUE,
"somestring");

> update(oo);

>

> end

>

> I've read that I have to overwrite hashcode and equals, can this be the

> reason? If yes, do you have an example how to overwrite these methods?

>

> Thomas

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


Re: [rules-users] Problems with looping

2008-08-01 Thread Vanina Beraudo
Hi,

you must use "no-loop true" and the rule will be executed one for one
InputObject.




2008/8/1 thomas kukofka <[EMAIL PROTECTED]>:
> Hello,
>
> I have and less loop (the rule should only executed one for one InputObject)
> in the follwing rule although I use "no-loop":
>
> rule "rulename"
>   dialect "java"
>   no-loop
> when
> io: InputObject (type == InputObject.Type.Typename)
> then
> io.setStringPropertyValue(InputObject.PROPERTYVALUE, "somestring");
> update(oo);
>
> end
>
> I've read that I have to overwrite hashcode and equals, can this be the
> reason? If yes, do you have an example how to overwrite these methods?
>
> Thomas
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>



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


[rules-users] Problems with looping

2008-08-01 Thread thomas kukofka
Hello,

I have and less loop (the rule should only executed one for one InputObject)
in the follwing rule although I use "no-loop":

rule "rulename"
  dialect "java"
  no-loop
when
io: InputObject (type == InputObject.Type.Typename)
then
io.setStringPropertyValue(InputObject.PROPERTYVALUE, "somestring");
update(oo);

end

I've read that I have to overwrite hashcode and equals, can this be the
reason? If yes, do you have an example how to overwrite these methods?

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


Re: [rules-users] determinism with rulebase partitioning

2008-08-01 Thread Edson Tirelli
I think that even with rulebase partitions, we should continue to
support current execution mode. So, we should keep a rulebase configuration
that basically allow the user to defines: either single-thread (as it is
today) or multi-thread (as we are trying to achieve) execution.

Having that in mind, in the multi-thread mode:

(A) What does "parallel evaluation of a rulebase" mean? Is it designed
to optimise, for example, two threads processing a stateless and
stateful session?
   Means that rules that do not share nodes, being independent of each other
(from an evaluation perspective), will be evaluated in parallel. This is
very common scenario and a desidered feature in CEP engines.

(B) Are there only two partitions, both of which are invisible to the
user? Is there any value in allowing user-defined partitions?
There will be as many partitions as the compiler can create for the
given set of rules. Rules that share more nodes, are more difficult to
partition, while rules that are independent from an LHS point of view, are
easier to parallelize. In my opinion, the only thing that may be helpful to
expose and allow the user to control is the maximum size of the thread pool
that is used to propagate facts. Even that I'm not sure is so helpful,
because it is complex to fine tune such things, since the partitioning is
completely dependent on the rules added to the rulebase.

(C) Does the partition used depend upon what type of session is used
(i.e. stateless always uses the partition without an agenda whereas
stateful always uses the partition with an agenda)?
The partitioning of the rulebase is dependent upon the rules in the
rulebase and nothing more. But that is different from the agenda. The agenda
issue is much more complex, because even with partitions we can keep a
single deterministic agenda (as long as it is not in active mode -
runUntilHalt). Now, if the agenda is in active mode, or if we have multiple
agendas (1 per partition, for instance), then the engine behavior becomes
indeterministic. This is a common scenario in CEP systems that have multiple
different "queries" running over the same set of streams, trying to detect
and act upon them as soon as they are detected, and event streams are
indeterministic by their own nature. In common rules engines scenarios, I'm
not sure we can run in this indeterministic mode.

(D) Can a rule sometimes be deterministic and sometimes not (i.e.
depends upon the type of session)?
It will always depend on the set of rules (the rulebase), not the type
of session. One rule is always deterministic when considered in isolation,
but two or more rules may or may not be deterministic in relation to each
other. Just remember Eisten's Relativity Theory... ;)

   []s
   Edson

2008/8/1 Anstis, Michael (M.) <[EMAIL PROTECTED]>

> Hi Mark,
>
> A few questions:-
>
> (A) What does "parallel evaluation of a rulebase" mean? Is it designed
> to optimise, for example, two threads processing a stateless and
> stateful session?
>
> (B) Are there only two partitions, both of which are invisible to the
> user? Is there any value in allowing user-defined partitions?
>
> (C) Does the partition used depend upon what type of session is used
> (i.e. stateless always uses the partition without an agenda whereas
> stateful always uses the partition with an agenda)?
>
> (D) Can a rule sometimes be deterministic and sometimes not (i.e.
> depends upon the type of session)?
>
> Cheers,
>
> Mike
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark Proctor
> Sent: 01 August 2008 07:05
> To: Rules Users List
> Subject: [rules-users] determinism with rulebase partitioning
>
> We have rulebase partitioning almost working, this allows parallel
> evaluation of a rulebase. For stateless lessions with no agenda this
> will allow for much faster executions, where you don't care about
> deterministic execution. However for deterministic execution its more
> complicated. The current plan is to have an agenda per parition, which
> means that we no longer have rulebase wide deterministic execution
> order, only with the partition itself. The user is unlikely to be aware
> of the created partitions, so won't be aware of the unditermistic
> behavour of their rulebase. Anyone have any input on mechanisms users
> can do to help the rulebase know what needs to be executed
> deterministically and what doesn't?
>
> 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
>



-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists