Re: [rules-users] best way to write this rule?

2011-08-28 Thread Wolfgang Laun
On 28 August 2011 01:23, Warner Onstine warn...@gmail.com wrote:


 As a player I have:
 - a list of badges I am in progress of completing


And also a list of badges a player already has, to avoid acquiting it over
and over again.


 - something I've just done that could go towards one or more of these
 badges


The or more is essential. I can imagine that certain things need to be
done more than
once. Is that so?



 Within the game there are:
 - a list of potential badges that a player could earn
 - with a set of things to do to earn each badge (what I'm considering the
 rules)


Notice that the definition of a badge and how to earn it is very similar to
what has
to be recorded for a player's progress.

It is certainly possible to write a rule for each badge to determine whether
a player
has achieved it. But it could be much simpler if all achievements are
tallied individually,
because then rules just need to check for each badge whether a player's
achievements
match the badge's requirements; this can be done with a single rule.

-W





 In short I don't want to have to go through each thing each player has
 done and try and determine which rule to run, I just want to pass in:
 - their set of badges (with steps they've completed so far)
 - what badges are available to earn (to match against)
 - what they just did

 Maybe I'm thinking about this the wrong way and there's an easier way
 to do this. Still trying to figure the best implementation of the rule
 and rule set. My goal is to load all the rules at load time (and
 reload when I add a new badge) so that I have a full knowledgebase and
 can just run it whenever someone does something in the game.


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


[rules-users] Drools and OpenJPA

2011-08-28 Thread eggeral
Hi all, 

I am trying to get Drools working with OpenJPA. 

Currently I am stuck on the named query ProcessInstancesWaitingForEvent. 

The term in elements(... seams to be Hibernate specific and can not be
compiled by the OpenJPA JPQL compiler.

Is there any workaround for this problem? 

thx

Alexander 

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-and-OpenJPA-tp3290343p3290343.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] java.lang.NoSuchFieldError: DESCR

2011-08-28 Thread rahulkrishnan
Am a newbe to the Drools.

When am trying
http://www.softwarepassion.com/getting-started-with-drools-flow/ tutorial 
to run the program in this tutorial it is giving this exception

Exception in thread main java.lang.NoSuchFieldError: DESCR
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:539)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at
com.softwarepassion.droolsflow.SPDroolsFlowExample.readKnowledgeBase(SPDroolsFlowExample.java:30)
at
com.softwarepassion.droolsflow.SPDroolsFlowExample.main(SPDroolsFlowExample.java:20)


how can i resolve this one

--
View this message in context: 
http://drools.46999.n3.nabble.com/java-lang-NoSuchFieldError-DESCR-tp3290363p3290363.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] fireAllRules() doesn't return back

2011-08-28 Thread Neel
Hi,I'm using drools-5.3.0.Beta1. I've following rule definition:

import java.util.*;


declare Student
   name : String @key
   subjectGradeMap : HashMap   
end
 
rule Subject grade points
dialect mvel
when
   $u : Student()
then
   $u.subjectGradeMap[CompSc] += 100;
   System.out.println(Marks added);
end
While executing RHS of above rule, fireAllRules() doesn't return, it 
hangs.Please help.Thanks,Neel
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] rule parse error for null check

2011-08-28 Thread Neel
Hi,I'm using drools-5.3.0.Beta1. I've following rule file:
import java.util.*;

declare Student
   name : String @key
   subjectGradeMap : HashMap   
end
 
rule Subject grade points
dialect mvel
when
   $u : Student()
then
   if($u.subjectGradeMap == null)
   {
      $u.subjectGradeMap = new HashMapString,Integer();
   }
   $u.subjectGradeMap[CompSc] += 100;
   System.out.println(Marks added);
end
I get following error while rule compilation:Unable to Analyse Expression 
if($u.subjectGradeMap == null);
   {
      $u.subjectGradeMap = new HashMapString,Integer();
   };
   $u.subjectGradeMap[CompSc] += 100;
   System.out.println(Marks added);:
[Error: was expecting type: java.lang.Object; but found type: Unknown]
[Near : {... if($u.subjectGradeMap == null) }]
             ^
[Line: 1, Column: 1] : [Rule name='Subject grade points']

Please let me know if this is correct usage in the above scenario.
Thanks,Neel
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] fireAllRules() doesn't return back

2011-08-28 Thread Esteban Aliverti
It hangs? Or the rule get executed once and again?
I don't see anything wrong with your rule. Are you sure you are not doing
any update() od modify() inside your rule?
Can you share with us how are you creating and interacting with the
knowledge base?

Best Regards,



Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2011/8/28 Neel neelesh...@yahoo.co.in

 Hi,
 I'm using drools-5.3.0.Beta1. I've following rule definition:


 import java.util.*;


 declare Student

name : String @key

subjectGradeMap : HashMap

 end



 rule Subject grade points

 dialect mvel

 when

$u : Student()

 then

$u.subjectGradeMap[CompSc] += 100;

System.out.println(Marks added);

 end


 While executing RHS of above rule, fireAllRules() doesn't return, it hangs.

 Please help.

 Thanks,

 Neel



 ___
 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] fireAllRules() doesn't return back

2011-08-28 Thread Wolfgang Laun
You are adding 100 to a non-existing Map entry. Doing this in Java code like
e.g.

   HashMapString,Integer m = $u.getSubjectGradeMap();
   m.put( CompSc, m.get( CompSc ) + 100 );

would have thrown a NullPointerException, and you would have seen the
problem.

MVEL, with its balmy-barmy way of hiding the realities of programming from
you, sinks you in an infinite loop...

Verified with current master, and I won't create a JIRA for this one either,
as moticated previously.

-W


2011/8/28 Neel neelesh...@yahoo.co.in

 Hi,
 I'm using drools-5.3.0.Beta1. I've following rule definition:


 import java.util.*;


 declare Student

name : String @key

subjectGradeMap : HashMap

 end



 rule Subject grade points

 dialect mvel

 when

$u : Student()

 then

$u.subjectGradeMap[CompSc] += 100;

System.out.println(Marks added);

 end


 While executing RHS of above rule, fireAllRules() doesn't return, it hangs.

 Please help.

 Thanks,

 Neel



 ___
 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 parse error for null check

2011-08-28 Thread Wolfgang Laun
See JBRULES-3064 https://issues.jboss.org/browse/JBRULES-3064, dialect
mvel flouts generic parameters.

If you omit String,Integer after new HashMap all is well. Of course,
this is another MVEL bug or restriction - who knows.

But don't try to work around this by

then
   if($u.subjectGradeMap == null){
  $u.subjectGradeMap = new HashMap*/*String,Integer*/*();
   }

You'll just run into another MVEL bug.

-W



2011/8/28 Neel neelesh...@yahoo.co.in

 Hi,
 I'm using drools-5.3.0.Beta1. I've following rule file:

 import java.util.*;


 declare Student

name : String @key

subjectGradeMap : HashMap

 end



 rule Subject grade points

 dialect mvel

 when

$u : Student()

 then

if($u.subjectGradeMap == null)

{

   $u.subjectGradeMap = new HashMapString,Integer();

}

$u.subjectGradeMap[CompSc] += 100;

System.out.println(Marks added);

 end


 I get following error while rule compilation:

 Unable to Analyse Expression if($u.subjectGradeMap == null);

{

   $u.subjectGradeMap = new HashMapString,Integer();

};

$u.subjectGradeMap[CompSc] += 100;

System.out.println(Marks added);:

 [Error: was expecting type: java.lang.Object; but found type: Unknown]

 [Near : {... if($u.subjectGradeMap == null) }]

  ^

 [Line: 1, Column: 1] : [Rule name='Subject grade points']


 Please let me know if this is correct usage in the above scenario.


 Thanks,

 Neel



 ___
 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