[rules-users] UI for Rule Engine

2011-08-10 Thread Gaurav Silakari
Hi, I need to know whether Guvnor UI is customizable. I have a requirement where there is a need for a customized UI for managing the rules. So for that case, either a new UI has to be created or the Guvnor UI needs to be edited/modified and integrated with the Application. Could anybody please help me on how should I proceed in this case. How can the Guvnor UI be modified and Integrated it with an Application.If a separate UI is been created then how we can connect it with Guvnor to achieve full functionality, any APIs that would be useful or through some web service calls from the Custom UI to Guvnor.Thanks & Regards,Gaurav SilakariMailto: gaurav.silak...@tcs.com  =-=-=Notice: The information contained in this e-mailmessage and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Calling a method in when part

2011-08-10 Thread Sumeet Karawal

Hi,

I have a requirement where there is a customized Java class having a method
that returns some value.
like:

getValueBoolean("Some String")

{ //some calculation
   // returns a boolean value
}

The default getters and setters are not being used in the Application. The
value that is being returned by the method needs to be checked in the .drl
file.
There are different Java classes with these kind of methods. Where the
string and integer value is also returned. I have gone through the
documentation for Drools-Expert but have only found the implementation for
the method in the consequence part, i.e., the then part.

This is how I tried:

importing the class

in when
binding the a variable to the Class name suppose $c
eval ($c.getValueBoolean("abc"))
then
System.out.println("the value is true")


It didn't work this way.
I tried by another way like :

creating a function in the .drl itself that calls the method of that class
and returns a value
then calling this drl function in the when part and carrying on.

It would be very helpful if some body could let me know how to do this in
the .drl.


Thanks & Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com

=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



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


Re: [rules-users] Calling a method in when part

2011-08-10 Thread Wolfgang Laun
If you don't show your code we can't tell you what is wrong with it. So I
think what you may have to do is

when
   $someObj: SomeClass()  # matches each WME of SomeClass
   eval( $someObj.getValueBoolean("abc"))
then

There is not much to be gained by using a DRL function; it would have to be
called like
   eval( someFunction( $someObj, "abc" ) )

-W


On 10 August 2011 11:05, Sumeet Karawal  wrote:

>
> Hi,
>
> I have a requirement where there is a customized Java class having a method
> that returns some value.
> like:
>
> getValueBoolean("Some String")
>
> { //some calculation
>   // returns a boolean value
> }
>
> The default getters and setters are not being used in the Application. The
> value that is being returned by the method needs to be checked in the .drl
> file.
> There are different Java classes with these kind of methods. Where the
> string and integer value is also returned. I have gone through the
> documentation for Drools-Expert but have only found the implementation for
> the method in the consequence part, i.e., the then part.
>
> This is how I tried:
>
> importing the class
>
> in when
> binding the a variable to the Class name suppose $c
> eval ($c.getValueBoolean("abc"))
> then
> System.out.println("the value is true")
>
>
> It didn't work this way.
> I tried by another way like :
>
> creating a function in the .drl itself that calls the method of that class
> and returns a value
> then calling this drl function in the when part and carrying on.
>
> It would be very helpful if some body could let me know how to do this in
> the .drl.
>
>
> Thanks & Regards,
> Sumeet Karawal
> Mailto: sumeet.kara...@tcs.com
>
> =-=-=
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
> ___
> 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] UI for Rule Engine

2011-08-10 Thread John
http://www.plugtree.com/guvnor-embed-asset%E2%80%99s-editor-in-your-application/
http://www.plugtree.com/guvnor-embed-asset%E2%80%99s-editor-in-your-application/
 

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-UI-for-Rule-Engine-tp3241833p3242290.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] Off to a very bad start - please help

2011-08-10 Thread ronalbury
I am running Ubuntu Linux 10.04 with the latest eclipse.  I followed the
directions and the eclipse project would not build.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Off-to-a-very-bad-start-please-help-tp3237300p3242528.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] Off to a very bad start - please help

2011-08-10 Thread Mauricio Salatino
Can you share the errors that appears in the Problems Tab in eclipse?


On Wed, Aug 10, 2011 at 10:25 AM, ronalbury  wrote:

> I am running Ubuntu Linux 10.04 with the latest eclipse.  I followed the
> directions and the eclipse project would not build.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Off-to-a-very-bad-start-please-help-tp3237300p3242528.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
>



-- 
 - 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.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Calling a method in when part

2011-08-10 Thread Sumeet Karawal
Hi,

Below is the drl that I am using and the class that it is referring to:

Drl:

package rules.person

import com.person.Age
Import com.person.Classification

rule "Check_person.option1"

when

$age : com.person.Age()
$classification : com.person.Classification()

eval ($age.getClassification("16"))

then

modify ($classification) {$classification.setResult('"Teenager"; }

end

rule "Check_person.option2"

when

$age : com.person.Age()
$classification : com.person.Classification()

eval ($age.getClassification("40"))

then

modify ($classification) {$classification.setResult('"Adult"; }

end


Application Class :

public class Age
{
public string getClassification(String name) {

return str;
}
}

public class Classification
{
public void setResult(String name) {


}
}



Queries :

   Please let me know if I am using the 'when' part correctly.
   And please check for the use of the object 'classification' in my
   application (as return value to the application)




Thanks & Regards,
Sumeet Karawal
Mailto: sumeet.kara...@tcs.com



  
  From:   Wolfgang Laun
  

  
  To: Rules Users List 
  

  
  Date:   08/10/2011 03:03 PM   
  

  
  Subject:Re: [rules-users] Calling a method in when part   
  

  
  Sent by:rules-users-boun...@lists.jboss.org   
  

  





If you don't show your code we can't tell you what is wrong with it. So I
think what you may have to do is

when
   $someObj: SomeClass()  # matches each WME of SomeClass
   eval( $someObj.getValueBoolean("abc"))
then

There is not much to be gained by using a DRL function; it would have to be
called like
   eval( someFunction( $someObj, "abc" ) )

-W


On 10 August 2011 11:05, Sumeet Karawal  wrote:

  Hi,

  I have a requirement where there is a customized Java class having a
  method
  that returns some value.
  like:

  getValueBoolean("Some String")

  { //some calculation
    // returns a boolean value
  }

  The default getters and setters are not being used in the Application.
  The
  value that is being returned by the method needs to be checked in
  the .drl
  file.
  There are different Java classes with these kind of methods. Where the
  string and integer value is also returned. I have gone through the
  documentation for Drools-Expert but have only found the implementation
  for
  the method in the consequence part, i.e., the then part.

  This is how I tried:

  importing the class

  in when
  binding the a variable to the Class name suppose $c
  eval ($c.getValueBoolean("abc"))
  then
  System.out.println("the value is true")


  It didn't work this way.
  I tried by another way like :

  creating a function in the .drl itself that calls the method of that
  class
  and returns a value
  then calling this drl function in the when part and carrying on.

  It would be very helpful if some body could let me know how to do this in
  the .drl.


  Thanks & Regards,
  Sumeet Karawal
  Mailto: sumeet.kara...@tcs.com

  =-=-=
  Notice: The information contained in this e-mail
  message and/or attachments to it may contain
  confidential or privileged information. If you are
  not the intended recipient, any dissemination, use,
  review, distribution, printing or copying of the
  information contained in this e-mail message
  and/or attachments to it are strictly prohibited. If
  you have received this communication in error,
  please notify us by reply e-mail or telephone and
  immediately and permanently delete the message
  and any attachments. Thank you



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

___
rules-users mailing list
rul

[rules-users] Collect with same value

2011-08-10 Thread wendy
Hi,
  I'm trying to write the following rule but am having some trouble.  

  We have a object say Shape and which has attributes size and color.  I
want to get a list of all shapes with the same color that have size > 5. 
How can I make sure the color is the same for all objects in the collect
without having different rules for 'red', 'green'...? 

Thank you,
Wendy


--
View this message in context: 
http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.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] Calling a method in when part

2011-08-10 Thread Sachin Thapa
There are two things:

1. You want to call this method when a condition is satisfied 
2. You want to check this condition and do something.

If you want to do '1'

when
  <>
then
   boolean val = c.getValueBoolean("string");
end

if you want to do '2'

when
   eval(c.getValueBoolean("string"))
then
   <>
end

I am not sure what you want to do about of these two, hope this helps. If i
have not understand your problem could you please provide more details will
try to post solution.

Regards,
Sachin
http://technologistics.blogspot.com/

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Calling-a-method-in-when-part-tp3241883p3242981.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] Drools 5.2 performance building KnowledgeBase

2011-08-10 Thread lhorton
I did some benchmarking yesterday and noticed this too.  I also found that
package load time is much slower when using change sets.

originally my drools-spring file looked like this (snippet):

.





.

and the change set was:
 
 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";>
 
   
  
  


when I got rid of the change set, and changed the drools-spring to this:







the packages loaded in half the time.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-5-2-performance-building-KnowledgeBase-tp3239746p3243032.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] How to update facts in Script task (RuleFlow)

2011-08-10 Thread joeyoungkc
Hi, 

I'm trying to update the facts before a flowgroup and after a script
task(written in java).  I was thinking of calling update(myFact) inside the
script task, but how do I call it?

Do I need to press in the session to the parameter map and call
session.update(FactHandle handle,   Object object)??
--
StatefulKnowledgeSession session = getKnowledgeAgent("abc")

.getKnowledgeBase().newStatefulKnowledgeSession();
Map parameterMap = new HashMap();
parameterMap.put("myFact",myFact);
session.insert(myFact);
session.startProcess("rruleflow", parameterMap);
session.fireAllRules();
--

I'm new to drool, please help!


--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-update-facts-in-Script-task-RuleFlow-tp3243175p3243175.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] Calling a method in when part

2011-08-10 Thread Wolfgang Laun
On 10 August 2011 17:14, Sumeet Karawal  wrote:

>
>
> package rules.person
>
> import com.person.Age
> Import com.person.Classification
>
> rule "Check_person.option1"
>
> when
>
> $age : com.person.Age()
> $classification : com.person.Classification()
>

If you import, you can use just "Age" and "Classification".


>
> eval ($age.getClassification("16"))
>

This is not correct since the return value of Age.getClassification is not a
boolean.

As you present this code, it doesn't make any sense. The condition is a join
of an Age object and a Classification object and the argument of
getClassification("16") is a literal.

Providing an object to collect results is one reasonable way of doing it.

-W



>
> then
>
> modify ($classification) {$classification.setResult('"Teenager"; }
>
> end
>
> rule "Check_person.option2"
>
> when
>
> $age : com.person.Age()
> $classification : com.person.Classification()
>
> eval ($age.getClassification("40"))
>
> then
>
> modify ($classification) {$classification.setResult('"Adult"; }
>
> end
>
>
> Application Class :
>
> public class Age
> {
>public string getClassification(String name) {
>
>return str;
>}
> }
>
> public class Classification
> {
>public void setResult(String name) {
>
>
>}
> }
>
>
>
> Queries :
>
>   Please let me know if I am using the 'when' part correctly.
>   And please check for the use of the object 'classification' in my
>   application (as return value to the application)
>
>
>
>
> Thanks & Regards,
> Sumeet Karawal
> Mailto: sumeet.kara...@tcs.com
>
>
>
>   From:   Wolfgang Laun 
>
>  To: Rules Users List 
>
>  Date:   08/10/2011 03:03 PM
>
>  Subject:Re: [rules-users] Calling a method in when part
>
>  Sent by:rules-users-boun...@lists.jboss.org
>
>
>
>
>
>
> If you don't show your code we can't tell you what is wrong with it. So I
> think what you may have to do is
>
> when
>$someObj: SomeClass()  # matches each WME of SomeClass
>eval( $someObj.getValueBoolean("abc"))
> then
>
> There is not much to be gained by using a DRL function; it would have to be
> called like
>eval( someFunction( $someObj, "abc" ) )
>
> -W
>
>
> On 10 August 2011 11:05, Sumeet Karawal  wrote:
>
>  Hi,
>
>  I have a requirement where there is a customized Java class having a
>  method
>  that returns some value.
>  like:
>
>  getValueBoolean("Some String")
>
>  { //some calculation
>// returns a boolean value
>  }
>
>  The default getters and setters are not being used in the Application.
>  The
>  value that is being returned by the method needs to be checked in
>  the .drl
>  file.
>  There are different Java classes with these kind of methods. Where the
>  string and integer value is also returned. I have gone through the
>  documentation for Drools-Expert but have only found the implementation
>  for
>  the method in the consequence part, i.e., the then part.
>
>  This is how I tried:
>
>  importing the class
>
>  in when
>  binding the a variable to the Class name suppose $c
>  eval ($c.getValueBoolean("abc"))
>  then
>  System.out.println("the value is true")
>
>
>  It didn't work this way.
>  I tried by another way like :
>
>  creating a function in the .drl itself that calls the method of that
>  class
>  and returns a value
>  then calling this drl function in the when part and carrying on.
>
>  It would be very helpful if some body could let me know how to do this in
>  the .drl.
>
>
>  Thanks & Regards,
>  Sumeet Karawal
>  Mailto: sumeet.kara...@tcs.com
>
>  =-=-=
>  Notice: The information contained in this e-mail
>  message and/or attachments to it may contain
>  confidential or privileged information. If you are
>  not the intended recipient, any dissemination, use,
>  review, distribution, printing or copying of the
>  information contained in this e-mail message
>  and/or attachments to it are strictly prohibited. If
>  you have received this communication in error,
>  please notify us by reply e-mail or telephone and
>  immediately and permanently delete the message
>  and any attachments. Thank you
>
>
>
>  ___
>  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] Collect with same value

2011-08-10 Thread Wolfgang Laun
rule "get big shapes by color"
when
  $map: Map()
from accumulate ( $shape: Shapes( $color: color, size > 5 ),
  init( Map m = new HashMap(); ),
  action( List list = m.get( $color );
 if( list == null ) list = new ArrayList();
 list.add( shape ); ),
  result( m ) )
then
   // process $map to get all lists of same color
end

Untested.

-W

On 10 August 2011 17:20, wendy  wrote:

> Hi,
>  I'm trying to write the following rule but am having some trouble.
>
>  We have a object say Shape and which has attributes size and color.  I
> want to get a list of all shapes with the same color that have size > 5.
> How can I make sure the color is the same for all objects in the collect
> without having different rules for 'red', 'green'...?
>
> Thank you,
> Wendy
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.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


Re: [rules-users] Collect with same value

2011-08-10 Thread wendy
thank you.




From: Wolfgang Laun-2 [via Drools] 

To: wendy 
Sent: Wednesday, August 10, 2011 1:31 PM
Subject: Re: [rules-users] Collect with same value


rule "get big shapes by color"
when
  $map: Map()
    from accumulate ( $shape: Shapes( $color: color, size > 5 ),
  init( Map m = new HashMap(); ),
      action( List list = m.get( $color );
 if( list == null ) list = new ArrayList();
 list.add( shape ); ),
  result( m ) )
then
   // process $map to get all lists of same color
end

Untested.

-W


On 10 August 2011 17:20, wendy <[hidden email]> wrote:

Hi,
> I'm trying to write the following rule but am having some trouble.
>
> We have a object say Shape and which has attributes size and color.  I
>want to get a list of all shapes with the same color that have size > 5.
>How can I make sure the color is the same for all objects in the collect
>without having different rules for 'red', 'green'...?
>
>Thank you,
>Wendy
>
>
>--
>View this message in context: 
>http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.html
>Sent from the Drools: User forum mailing list archive at Nabble.com.
>___
>rules-users mailing list
>[hidden email]
>https://lists.jboss.org/mailman/listinfo/rules-users
>

___ 
rules-users mailing list 
[hidden email] 
https://lists.jboss.org/mailman/listinfo/rules-users



 
If you reply to this email, your message will be added to the discussion 
below:http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3243337.html
 
To unsubscribe from Collect with same value, click here.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3243377.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] Lock-on-active and ruleflow-group

2011-08-10 Thread bitter
Thank-you
09-08-2011 13:23 użytkownik "Wolfgang Laun-2 [via Drools]" <
ml-node+3238607-487429483-420...@n3.nabble.com> napisał:
>
>
> Modules (=agenda-group and ruleflow-group) are fine for large-scale
> rule flow control. First choice for fine-grained rule execution
> control is - Logic.
>
> Write your constraints so that only one rule fires, e.g., by testing
> price == null.
>
> Ideally, you should also avoid salience by fully describing the cases
> for prices 1 and 2.
>
> Using flow control and salience - this isn't rule based programming
> any more, just a very elaborate way of implementing sequential logic.
>
> -W
>
>
>
> On 9 August 2011 13:08, bitter  wrote:
>> But when I use activation-group only one fact has price. I would like to
>> insert two facts (or more) and only one rule invoke per fact.Like in my
test
>> class.
>> Could you look at use case that I attached in my first post? Thanks.
>>
>>
>> Wolfgang Laun-2 wrote:
>>>
>>> You should use activation-group "price" or similar, not lock-on-active.
>>> -W
>>>
>>>
>>> On 9 August 2011 11:40, Wolfgang Laun 
>>> wrote:

 "Whenever a ruleflow-group becomes active [...], any rule within that
 group that has lock-on-active set to true will not be activated any
 more." (Emphasis added by me.)

 Do you activate the ruleflow-group before you insert the Car fact?

 -W


 On 9 August 2011 11:05, bitter  wrote:
>
> Log:
>
> ==>[BeforeActivationFiredEvent:  getActivation()=[Activation
rule=Second
> rule, act#=1, salience=25, tuple=[fact
> 0:1:1428842218:1428842218:1:DEFAULT:Car{color='red', size='small',
> price=null}]
> ],
>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@72f6f1b6]
> ==>[AfterActivationFiredEvent: getActivation()=[Activation rule=Second
> rule,
> act#=1, salience=25, tuple=[fact
> 0:1:1428842218:1428842218:2:DEFAULT:Car{color='red', size='small',
> price=2}]
> ],
>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@72f6f1b6]
> ==>[BeforeActivationFiredEvent:  getActivation()=[Activation
rule=First
> rule, act#=0, salience=20, tuple=[fact
> 0:1:1428842218:1428842218:2:DEFAULT:Car{color='red', size='small',
> price=2}]
> ],
>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@72f6f1b6]
> ==>[AfterActivationFiredEvent: getActivation()=[Activation rule=First
> rule,
> act#=0, salience=20, tuple=[fact
> 0:1:1428842218:1428842218:3:DEFAULT:Car{color='red', size='small',
> price=1}]
> ],
>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@72f6f1b6]
> ==>[BeforeActivationFiredEvent:  getActivation()=[Activation
rule=Second
> step, act#=2, salience=40, tuple=[fact
> 0:1:1428842218:1428842218:3:DEFAULT:Car{color='red', size='small',
> price=1}]
> ],
>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@72f6f1b6]
> ==>[AfterActivationFiredEvent: getActivation()=[Activation rule=Second
> step,
> act#=2, salience=40, tuple=[fact
> 0:1:1428842218:1428842218:3:DEFAULT:Car{color='red', size='small',
> price=1}]
> ],
>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@72f6f1b6]
> Car{color='red', size='small', price=1}
>
> java.lang.AssertionError:
> Expected :2
> Actual   :1
>at org.junit.Assert.fail(Assert.java:91)
>at org.junit.Assert.failNotEquals(Assert.java:645)
>at org.junit.Assert.assertEquals(Assert.java:126)
>at org.junit.Assert.assertEquals(Assert.java:145)
>at
>
CarKnowledgeBaseTest.shouldObtainPriceWhereSalienceIsBigger(CarKnowledgeBaseTest.java:47)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>at
>
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>at
>
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>at
>
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>at
>
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>at
>
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>at
>
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>at
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>at
> 

[rules-users] Rule o

2011-08-10 Thread DroolersEye
Hi,
Some one can help me, 
I want to use Rule object...I noticed Rule interface available in two
packages ...which one to be used...
"org.drools.definitions.rule" or "org.drools.rule"

please some one can advise us...
thanks,


-
with kind regards,

--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-o-tp3243667p3243667.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread lhorton
try adding /execute to your URL, i.e.

/drools-server/kservice/rest/execute

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3243913.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread kkelleyjr
I have already tried that... I got HTTP/1.1 204 No Content [Server:
Apache-Coyote/1.1, Date: Wed, 10 Aug 2011 21:21:45 GMT]...


Thank you for the advice... 

I have been thinking that it may have something to do with xstream and jaxb
stuff, but I am very new to both tech's...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3243969.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread lhorton
I got the 5.2 drools-server working with xstream.  You can see my code here:

http://drools.46999.n3.nabble.com/rules-users-how-to-invoke-rest-service-on-drools-server-with-serialized-objects-td3179834.html

at the time of that post, i hadn't figured out how to get the return
objects.  this post covers how to do that:

http://drools.46999.n3.nabble.com/drools-server-empty-response-body-td3192475.html

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3244021.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread kkelleyjr
Thank You I had been looking at your post actually, trying to understand the
difference between the two technologies... I will take a look at the xstream
and will post if I figure out what the issue is with the jaxb...

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3244078.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] Drools Queries with relation to the LHS and RHS syntax of the rule

2011-08-10 Thread Dibya
I have the below two requirement for Drools implementation.

1. To use a java method(with single argument) of my application class in the
'LHS' of the rule .
2. To pass the object set in 'RHS' of the rule back to my application.

Is it possible to implement point 1 and point 2 as below ?

Example :

Application class is defined as :

//Class for getting various types from my application

package application.custom;

public class Project
{
public string getStringValue(String name) {

return ;
}
}

//Class 2 for setting the rule result

package application.customresults;

public class ProjectResults
{
public void setResult(String name) {


}}

===
Drl file like :

package application.rules

#I shall set the object 'projRes'  in my appl using setGlobal
global application.customresults.ProjectResults  projRes ; 

import application.custom.Project;

rule "project-1.option1"

when

$proj : application.custom.Project();

eval ($proj.getStringValue("Drools") .equals ("ABC")) # Logic specific to my
application 

then
#Requirement is to set and make use of the object 'projRes' in my
application

modify (projRes) {projRes.setResult("Drools project");  }
end

rule "project-1.option2"

when

$proj : application.custom.Project();
$projRes : application.customresults.ProjectResults();

eval ($proj.getStringValue("Java") .equals ("DEF")) # Logic specific to my
application 

then
#Requirement is to set and make use of the object 'projRes' in my
application

modify (projRes) {projRes.setResult("Java project");
 }
end


Please let me know if the above way of writing the drl would suffice both
the requirements (or) is there a better way to implement it.

Thanks
Dibya

--
View this message in context: 
http://drools.46999.n3.nabble.com/Drools-Queries-with-relation-to-the-LHS-and-RHS-syntax-of-the-rule-tp3244097p3244097.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread kkelleyjr
I was looking at you code and I was wondering if there is a reason that you
did not use the new httpcomponents for the httpclient?

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3244182.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread lhorton
No reason - I used the old HttpClient because I'm familiar with it.  

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3244221.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] Insert a fact into drools server from a web application or java application

2011-08-10 Thread kkelleyjr
Well after modifying some of the code that you gave and setting the drools
server back to using xstream... so basically, the exact code that I posted
but with the xstream marshaller... the code works... so I am very confused
with what the deal is with the jaxb situation

I would think maybe that it has something to do with how to configure the
drools server for jaxb correctly???

--
View this message in context: 
http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3244282.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] best way to write this rule?

2011-08-10 Thread Warner Onstine
I am new to Drools and I've been trying to figure this out through the
user guide and examples I've been finding, but I'm not sure what the
best way is to write this rule (or set of rules).

What I'm trying to write is a set of rules for determining when
someone has earned (or is starting to earn) a badge. I want to be able
to show their progress on badge completion as well as when they
finally complete said badge.

I'm passing in the following to the rule:
- Player
- Earned Badges (list)
- All possible badges

The first rule only deals with one specific badge. So I have something
like this in my when:
$badge : Badge(name == "Something") //my assumption is that Badge
comes from the list of all possible badges I've just passed in

Then, I decided to split the rule into two. One rule for when they had
not earned it yet:
and I call a function
function earnedBadge(List badges, String name) {
boolean found = false;
for(EarnedBadge badge : badges) {
if(badge.getBadge().getName().equals(name)) {
found = true;
}
}
return found;
}

when:
earnedBadge(badges, $badge (name))

Then I got stuck. If they have completed one or more tasks I would
like to create (or use the badge they've started to earn) to track
their progress. So, If I have 5 possible things they need to do and
they've done three of those I'd like to create a new EarnedBadge for
the one they are earning and give it a percentage of 60%. What would
be the best way to do something like this?

Thanks for helping out the newbie, it's greatly appreciated :).

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