My problem is that I am running it using Guvnor and in Guvnor it is not able to recognize the class when I write the import statement.

I tried creating drl using File-> New-> drl       

I also tried to import the rt jar file(through “new file” option in drools 5.1 ) but the package does not get built and gives import error. It seems it is not able to recognize the jar.

 

 

Is there any way by which I can use the java api  or start importing the api jars into package(I don’t want to use it as fact. Hence I am not using “upload pojo model jar” option).

 

 

 

Best Regards,

Kripa

 

 

From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Monday, October 04, 2010 11:45 AM
To: Rules Users List
Subject: Re: [rules-users] performing math function in drools

 

// appl.transport.Transport.java:
public class Transport {
  public static double tax( double a, int n ){
    return Math.pow( a, (double)n );
  }
}

// transport.drl --------------------------------------------------
import function appl.transport.Transport.tax;
import function java.lang.Math.pow;

dialect "java"

function double sqr( double a ){
  return Math.pow( a, 2.0 );
}

rule "demo"
when
    Cargo( name == "Crate", , limit < ( tax( 20.0, 2 ) ) )
then
    System.out.println( "tax=" + tax( 20.0, 2 )  );
    System.out.println( "pow=" + pow( 20.0, 2.0 )  );
    System.out.println( "sqr=" + sqr( 20.0 )  );
end

-W

2010/10/4 Kripa Nathwani <Kripa.Nathwani@lntinfotech.com>

But for using Math.pow() I have to import java.lang in that function.

Even after importing java.lang, it is not recognizing the function add giving me error as :

Prohibited package name:java.class

 

If you can just forward me the link for that document you mentioned below, I can get some useful insight into it.

 

 

Best Regards,

Kripa

 

 

 

From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Leandro Romero
Sent: Monday, October 04, 2010 10:22 AM
To: Rules Users List
Subject: Re: [rules-users] performing math function in drools

 

If you want to make a function call in LHS you have to use Eval, it allows you to execute any Java code. In this especific case, you can call Math.pow() inside of it.

Before using it, I strongly recommend you to read the documentation about it.

______________________________________________________________________

 


This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.

______________________________________________________________________


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



______________________________________________________________________



This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.

______________________________________________________________________