Re: [rules-users] Using Enums in when clause

2009-08-07 Thread Zevenbergen, Alex
Thanking you - much appreciated

 



From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: 07 August 2009 06:48
To: Rules Users List
Subject: Re: [rules-users] Using Enums in when clause

 

In gameWinner == PARTICIPANTS.HOME.getId(), the second operand isn't an
enum, it's a method call on an enum object. Hence, it must be written as
a Return Value Restriction (cf. Expert doc on a Rule's LHS), thus
   ..., gameWinner == ( PARTICIPANTS.HOME.getId() ), ...

-W



2009/8/6 Zevenbergen, Alex azevenber...@paddypower.com

Hi,

 

This is my where clause:

 

when

  resultInfo : TennisResultInfo(endGame == true , setNumber ==
5,gameWinner == PARTICIPANTS.HOME.getId() , gameLoseScore == 0)

then

 

 

the rule falls over on PARTICIPANTS.HOME.getId()

 

PARTICIPANTS.HOME.getId() is an enum and returns an integer.

 

If I replace this line with the value that it would return the rule runs
perfectly.

 

Do I have to reference this in a certain way because it is an integer?

 

(Note all imports are present and correct)

 

Thanks,

 

Alex



Privileged, confidential and/or copyright information may be contained
in this communication. This e-mail 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 are not the intended addressee, you
may not copy, forward, disclose or otherwise use this e-mail or any part
of it in any way whatsoever. To do so is prohibited and may be unlawful.
If you have received this email in error 
please notify the sender immediately.

Paddy Power PLC may monitor the content of e-mail sent and received for
the purpose of ensuring compliance with its policies and procedures.

Paddy Power plc, Airton House, Airton Road, Tallaght, Dublin 24
Registered in Ireland: 16956



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

 



Privileged, confidential and/or copyright information may be contained in this 
communication. This e-mail 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 are not the intended addressee, you may not copy, forward, 
disclose or otherwise use this e-mail or any part of it in any way whatsoever. 
To do so is prohibited and may be unlawful. If you have received this email in 
error 
please notify the sender immediately.

Paddy Power PLC may monitor the content of e-mail sent and received for the 
purpose of ensuring compliance with its policies and procedures.

Paddy Power plc, Airton House, Airton Road, Tallaght, Dublin 24  Registered in 
Ireland: 16956
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Do you love to play Magic The Gathering? (Renton, WA) (Job Posting)

2009-08-07 Thread Mark Proctor

http://blog.athico.com/2009/08/do-you-love-to-play-magic-gathering.html

This came up in my google alerts today, and applying Drools to computer 
games is something I've always wanted to see happen :) If anyone gets 
the contract, you can be sure the Drools team will be available to you 
for direct free mentoring - actually I insist on it :)



   Do you love to play Magic The Gathering? (Renton, WA)
   http://seattle.craigslist.org/est/sof/1309824161.html

http://seattle.craigslist.org/est/sof/1309824161.html


Date: 2009-08-06, 4:44PM PDT
Reply to: job-vtfwu-1309824...@craigslist.org 
mailto:job-vtfwu-1309824...@craigslist.org?subject=do%20you%20love%20to%20play%20magic%20the%20gathering%3f%20%28renton%2c%20wa%29body=%0A%0Ahttp%3A%2F%2Fseattle.craigslist.org%2Fest%2Fsof%2F1309824161.html%0A 
^[Errors when replying to ads? 
http://www.craigslist.org/about/help/replying_to_posts]



Do you love to play Magic The Gathering and have experience with technology?

We are looking for a consultant to provide an initial assessment of the 
applicability of rules and constraint based programming to the on-line 
version of the game Magic: The Gathering.


The initial engagement is for one to two weeks and the bulk of the work 
can be done remotely with flexible hours.


Mandatory qualifications are as follows:

1. At least 3 years of Magic: The Gathering play experience.

2. Active user of Magic: The Gathering Online

3. A Pro Tour Level Player or certified Magic Judge

4. At least 3 years of rule based programming experience in at least two 
of the following tools:

a)Eclipse Rules/ Oracle Policy Automation
b)Clips
c)Jess
d)Corticon Rules
e)BizTalk Rules
f)JBoss Rules
g)Art Enterprise
h)OPS 83
i)ILog/IBM Rules

5. A theoretical understanding of the Rete algorithm and other rule 
processing optimizations


6. Experience with all of the following:
a)Natural or domain language rule expression
b)Programming language rule expression
c)Visual rule editing and diagramming

Most of the work can be done remotely, however some on-site meetings 
will be required. Estimate of 20-80 hours of total work over two weeks, 
could be an on-going need if you like the work


If you are interested in applying, please send me your current word.doc 
resume and let me know a good time to give you a call.



* Location: Renton, WA
* Compensation: Competitive
* Telecommuting is ok.
* This is a part-time job.
* This is a contract job.
* Principals only. Recruiters, please don't contact this job poster.
* Please, no phone calls about this job!
* Please do not contact job poster about other services, products or 
commercial interests.


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


[rules-users] DRL Pattern match to subclass?

2009-08-07 Thread Kris Nuttycombe
Hi, all,

I'm trying to figure out a way to perform the following pattern match
in a when clause in a drl file. This is with Drools 4.x

I have the following parameterized class (boilerplate omitted):

abstract class PropertyT {
  public String getName() {
  //...
  }

  public abstract T getValue();
}

and subclasses such as

class BigDecimalProperty extends PropertyBigDecimal {
  public BigDecimal getValue() {
//...
  }
}

I then have an interface as such:

public interface Propertied {
  public SetProperty? getProperties();
}

and an implementing class:

class Plan implements Propertied {
  //...
}

In my rules file, I would like to be able to perform the following
pattern match:

rule Ensure that plan minimum commitment has been met.
agenda-group evaluate-balance
when
$plan: Plan()
$minCommitProperty: BigDecimalProperty(name ==
minimum_commitment, $minCommitment : value) from $plan.properties
then
//...
end

Of course, this results in a runtime rule compilation exception
complaining of type mismatch. Is there any better way to encode this
match than to add all properties to the working memory, match the
desired property as a first-class object, then match against the plan
with Plan(properties contains $minCommitProperty)?

Thanks,

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


Re: [rules-users] DRL Pattern match to subclass?

2009-08-07 Thread Kris Nuttycombe
On Fri, Aug 7, 2009 at 10:33 AM, Kris
Nuttycombekris.nuttyco...@gmail.com wrote:
 Hi, all,

 I'm trying to figure out a way to perform the following pattern match
 in a when clause in a drl file. This is with Drools 4.x

 I have the following parameterized class (boilerplate omitted):

 abstract class PropertyT {
  public String getName() {
      //...
  }

  public abstract T getValue();
 }

 and subclasses such as

 class BigDecimalProperty extends PropertyBigDecimal {
  public BigDecimal getValue() {
    //...
  }
 }

 I then have an interface as such:

 public interface Propertied {
  public SetProperty? getProperties();
 }

 and an implementing class:

 class Plan implements Propertied {
  //...
 }

 In my rules file, I would like to be able to perform the following
 pattern match:

 rule Ensure that plan minimum commitment has been met.
    agenda-group evaluate-balance
 when
    $plan: Plan()
    $minCommitProperty: BigDecimalProperty(name ==
 minimum_commitment, $minCommitment : value) from $plan.properties
 then
    //...
 end

 Of course, this results in a runtime rule compilation exception
 complaining of type mismatch. Is there any better way to encode this
 match than to add all properties to the working memory, match the
 desired property as a first-class object, then match against the plan
 with Plan(properties contains $minCommitProperty)?

One addendum - this isn't really a desirable approach since it would
mean I would have to segment my working memory on a plan-by-plan
basis, as various different minimum commitments.

Kris

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


Re: [rules-users] DRL Pattern match to subclass?

2009-08-07 Thread Kris Nuttycombe
On Fri, Aug 7, 2009 at 10:37 AM, Kris
Nuttycombekris.nuttyco...@gmail.com wrote:
 On Fri, Aug 7, 2009 at 10:33 AM, Kris
 Nuttycombekris.nuttyco...@gmail.com wrote:
 Hi, all,

 I'm trying to figure out a way to perform the following pattern match
 in a when clause in a drl file. This is with Drools 4.x

 I have the following parameterized class (boilerplate omitted):

 abstract class PropertyT {
  public String getName() {
      //...
  }

  public abstract T getValue();
 }

 and subclasses such as

 class BigDecimalProperty extends PropertyBigDecimal {
  public BigDecimal getValue() {
    //...
  }
 }

 I then have an interface as such:

 public interface Propertied {
  public SetProperty? getProperties();
 }

 and an implementing class:

 class Plan implements Propertied {
  //...
 }

 In my rules file, I would like to be able to perform the following
 pattern match:

 rule Ensure that plan minimum commitment has been met.
    agenda-group evaluate-balance
 when
    $plan: Plan()
    $minCommitProperty: BigDecimalProperty(name ==
 minimum_commitment, $minCommitment : value) from $plan.properties
 then
    //...
 end

So, I have concocted the following abomination:

rule Ensure that plan minimum commitment has been met.
   agenda-group evaluate-balance
when
  $plan: Plan()
  $prop: Property(name == minimum_commitment) from
$scheduledSegment.segment.properties
  BigDecimalProperty($minCommitment : value) from $prop.class.cast($prop)
then
  //...
end

This (unbelievably) at least compiles and passes my tests; of course,
at the moment I don't have any Property instances with a name of
minimum_commitment that are not instances of BigDecimalProperty. Is
there any way to at least encode an instanceof check into the Property
pattern match to eliminate the possibility of a class cast exception?
How do I reference BigDecimalProperty.class at all?

Actually, this brings me to anotherpressing question - how do I refer
to anything other than a method that obeys the bean property
convention in a from clause?
I've got a number of instances where I'd like to be able to do something like:


when
$cont : Container()
Value() from $cont.value()
then

where Container (a third-party class that I can't change) defines:

interface Container {
  public Value value();
}

(in this case, Container is really Option from functionaljava.org, and
value() is really some())

Is it possible to sidestep the bean convention? It seems like the
Drools compiler attempts to convert everything to getter method
without even checking whether an appropriate method exists on the
target class.

Kris

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


[rules-users] How can I configure who is an Admin in Guvnor?

2009-08-07 Thread Steve Ronderos
Hello Drools Users,

In the Guvnor Documentation (
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html/ch01.html#d0e185
) it states that . It is also possible (thanks to JAAS) to define what 
users have the admin role for Guvnor (note that an Admin user of Guvnor 
doesn't have to really be a system administrator).   I wasn't sure if 
this meant that there was a way to define Admins from within the Guvnor UI 
or if it was possible to configure the admin role to read from an LDAP 
group or some other JAAS method.

We are going to be deploying Guvnor to a production environment in the 
near future, we want to take advantage of Role Based Authorization, we 
want to start with an empty DB and we don't want to have to deploy with 
Authorization off, set up roles and then turn it back on.

Is this possible? Or did I misinterpret the documentation?

Thanks,

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


[rules-users] Strategy for initializing objects

2009-08-07 Thread sonia
Hello

I want to achieve this:
box1.setX(0)
box2.setX(box1.size());
box2.setX(box1.size + box2.size)
...

I want to do it with rules, and would like to know what's the best
method of initializing (or any other operation with varying data) a
group of objects

rule init box
 when
   b : Box( x == -1)
 then
   b.setX(Box.getX());
   Box.setX( Box.getX() + b.size);
end

This does not work.
A single box object is matched several times instead of different box objects.
What is happening? how come a single box object is matched several
times? Why doesnt drools choose other instances of box?

What do I need to do to initialize all boxes, once for every box?

Thank you.

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


Re: [rules-users] Strategy for initializing objects

2009-08-07 Thread Wolfgang Laun
Your goal and the presented code aren't clear to me. The consequence (after
then) contains calls to static/class methods (Box.setX()) which isn't going
to change anything in your fact object. The call b.setX() might change your
object, but this depends on what the class method Box.getX() returns.

Assuming Drools 5, a typical consequence would look like
   b: Box(...)
then
   modify( b ){
  setX( ... )
   }
end

-W

On Sat, Aug 8, 2009 at 1:48 AM, sonia
robotnic+dro...@gmail.comrobotnic%2bdro...@gmail.com
 wrote:

 Hello

 I want to achieve this:
 box1.setX(0)
 box2.setX(box1.size());
 box2.setX(box1.size + box2.size)
 ...

 I want to do it with rules, and would like to know what's the best
 method of initializing (or any other operation with varying data) a
 group of objects

 rule init box
  when
   b : Box( x == -1)
  then
   b.setX(Box.getX());
   Box.setX( Box.getX() + b.size);
 end

 This does not work.
 A single box object is matched several times instead of different box
 objects.
 What is happening? how come a single box object is matched several
 times? Why doesnt drools choose other instances of box?

 What do I need to do to initialize all boxes, once for every box?

 Thank you.

 --
 robosonia
 ___
 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