Rules Engine Question

Hello All,
I am trying to put together a very simple service that uses the Oracle Rules engine, but I can't seem to get anything to happen.
I have set up a class called ScheduleValidity which has three attributes, hour, message, and isValid. The idea is that you pass an instance of this into the rule engine as a fact with the hour set, and then have the rules engine set isValid and the message. When I call the engine however, the object that I am asserting is not being changed. I am sure that I am doing something obviously incorrect, but I can't figure it out.
The RL for the two rules that I have are:
rule checkThatTimeisLateEnough
priority = 0;
if
fact mil.navy.seawarrior.scheduler.ScheduleValidity v0_ScheduleValidity && (
(v0_ScheduleValidity.hour < 9 )))
v0_ScheduleValidity.isValid = false ;
v0_ScheduleValidity.message = "The time is too early" ;
v0_ScheduleValidity.setIsValid(false );
v0_ScheduleValidity.setMessage("Time is too early" );
assert(v0_ScheduleValidity);
} //end rule checkThatTimeisLateEnough;
rule timeIsOk
priority = 0;
if
fact mil.navy.seawarrior.scheduler.ScheduleValidity v0_ScheduleValidity && (
(v0_ScheduleValidity.hour >= 9 )))
v0_ScheduleValidity.isValid = true ;
v0_ScheduleValidity.message = "This time is OK" ;
v0_ScheduleValidity.setIsValid(true );
v0_ScheduleValidity.setMessage("this time is OK" );
} //end rule timeIsOk;
The Web Services code that I am using is:
RuleRepository repository = RepositoryManager.getDefaultRepository("D:\\OC4J10.1.3\\j2ee\\home\\SchedulerRulesTest\\");
String rules = (repository.loadDictionary("SchedulerRulesTest",null)).ruleSetRL("SchedulerRulesTestRS"); //.getRuleSet("SchedulerRulesTestRS").generateRL(null);
String dm = (repository.loadDictionary("SchedulerRulesTest",null)).dataModelRL();
RuleSession rs = new RuleSession();
rs.executeRuleset(rules);
rs.executeRuleset(dm);
Calendar cal = new GregorianCalendar();
cal.setTime(startDateTime);
ScheduleValidity sv = new ScheduleValidity();
sv.setHour(cal.get(Calendar.HOUR_OF_DAY));
sv.setMessage("Default message");
System.out.println("hour:" + sv.getHour());
rs.callFunctionWithArgument("assert",sv);
rs.callFunction("run");
OperationStatus returnOs = new OperationStatus();
returnOs.setMessage(sv.getMessage());
returnOs.setSuccess(sv.isIsValid());
Unfortunately, the sv object's attributes are never being set. Can anyone give me an idea what I am going incorrectly?
Thanks

It isn't required that the ruleset be called main. There are two ways to get your ruleset (as originally named) to be evaluated. The pushRuleset function can be used to push the ruleset onto the ruleset stack or the run function may be invoked with a ruleset name argument. In code either:
rs.callFunctionWithArgument("pushRuleset", "SchedulerRulesTestRS");
rs.callFunction("run");
or
rs.callFunctionWithArgument("run", "SchedulerRulesTestRS");
The first approach is documented in the "Oracle Business Rules Users Guide" in section 2.7.4. For some more info on the ruleset stack, see section 1.4.3 in the "Oracle Business Rules Language Reference".

Similar Messages

  • Rules Engine Design Questions

    Rules Engine Questions:
    1. Rules are processed in the order they are created in dictionary file if the priorities are the same. Is it true?
    for eg: if the order you see on the screen in rules dictionary window is:
         rule1 --> set var1 = 10
         rule2 --> set var1 = 20
         rule3 --> set var1 = 30
         rule4 --> set var1 = 40
         rule5 --> set var1 = 50
         result would be 50
    2. I want to use the rules engine for validations.
    Eg: Can we check for the requiredness of xsd validations using rules engine? or this should be done else where?
    eg:
    If my xml is below, then can I use rules engine to check
    <Firstname>
    <LastName> and
    <Address1>
    for emptyness and pass back saying that the validation failed because <LastName> and <Address1> are empty.
    <Customer>
         <Firstname>aaa<Firstname>
         <LastName> <LastName>
         <Email>ccc<Email>
         <Address>
              <Address1> </Address>
         </Address>
    I have a response xml:
         <ValidationResult>
              <Result>Failed<Result>
              <Message>all required fields are not present<Message>
         <ValidationResult>
    So my rules should be
         check for <Firstname>
              Assert new ValidationResult ('success', ..)
         check for <LastName>
              Assert new ValidationResult ('failed', ..)
         check for <Email>
              Assert new ValidationResult ('success', ..)
         check for <Address1>
              Assert new ValidationResult ('failed', ..)     
    and since last rule is failed, will rules engine send back failed? or what is the strategy for order of rules that get fired?
    For the above scenario what would be the best design solution?

    This is a complicated question but I will try my best to give you the best solution:
    #In answer to your question regarding the order that rules fire unless you use priority you cannot garantee the order that the rules fire. The Oracle rules engine uses the Rete algorithm to establish the order in which to fire the rules and this is generally based upon the data passed into the rules. Therefore if the result of rule 4 may effect rule 1 then the rules engine will run rule 4 before rule 1.
    The scenario you have provided is slightly different however and I woudl suggest the following.
    Instead of passing out a single result from your ruleset pass our an array of results meaning you could effectively run all your rules and pass out all rules that failed. Be wary of checking for nulls however because if nothing is passed into a field then the rules engine will not create that element in the rules fact and the rule will never fire.
    To create a array of results you will need to create a function which creates the result fact for you and then addes each result in turn.
    If you woudl like more information let me know and I will help out as much as I can.

  • Rules Engine Environment in MDM

    Hi Everyone,
    I am evaluating the capability of SAP MDM to see if there is any kind of rules engine delivered that can create a material master (SKU) number.  I am not trying to create material master records yet - just the material number !
    Background:
    Defned rules, coupled with reference data should be able to generated the list of SKUs.
    Example:
    Reference Data contained in 3 tables:
    Product Line: LN1, LN2
    Release: 2009
    Language: EN, JA, FR, DE
    SKU mask: AA-BB-CC
    AA = Product Line
    BB = Release
    CC = Language
    The rules would be to create combinations of all the reference data values and output a list of SKUs according to the SKU mask/format.  In other words, by implmenting rules, I should be able to generate  2x1x4 = 8 SKUs in total (2 values for product line, mulitplied by 1 value for Release, multiplied by 4 values for Language).
    Questions:
    I know I can implment rules on the ABAP workbench in R/3 to create material master numbers, and then later create actual material master records with reference to other materials all within R/3.  However, I would like to create and manage the material master directly in MDM.
    1) Is a rules engine like drools provided as part of MDM?
    2) Since MDM is based on the Netweaver and sits on the web apps server, is there an ABAP workbench provided in MDM from where I can create the rules and create z tables for the reference data.
    3) Do I need to create a separate web service in Netweaver Developer Studio to create these rules.
    Thanks in advance
    -Rajiv

    Hi Rajiv,
      In some scenarios Material master is imported to SAP MDM from R/3 and all the logic is performed in R/3 itself. For such cases You can use the standrad MDM Material Repository provided by SAP.
    <i>How do people create specific part numbers (material numbers / SKUs) in SAP MDM based upon some specific business logic?</i>
    Let us say the Part number is an depandant on another field say Product ID.
    In MDM Console you can specify the business logic in the Calculation field.
    Also i would like to add that in SAP MDM most of this business logic are mere mathematical fuctions (part no = 1.5 * product ID). There is no provision to call external methods (like RFCs in R/3).
    I suggest you to get the Standard MDM Materials Repository and play around the Calculated fields\ Auto ID Fields in MDM Console.
    Get back for help,
    Vijay

  • Haley Rules Engine - HaleyAuthority with respect to Oracle E Business Suite

    I am currently exploring on Haley Rules Engine which is recently aquired by Oracle.
    As per my investingation, i came to know that HaleyAuthority ruleEngine is available as plugin from the recent release of Siebel CRM 8.0 installation and onwards.
    Here goes my questions
    1) is this haleyAuthority rule engine available as third party tool? If so, How to integrate with Oracle E- Business Suite.
    2) Like Siebel 8.0, Is this HaleyAuthority plugged in any latest version of our oracle E- Business Suite?
    Please let me know your understanding and information on Haley Rules Engine with respect to Oracle E-Business Suite.
    Thanks in Advance.

    Praveen ,
    May be late for you (but for others looking similar information)
    haleyAuthority is different from Haley Determination Services (now Oracle Policy Automation)
    OPA (Haley's Determination Services) are available as Web Service which you can invoke from E-Business Suite or Use Fusion Middleware (SOA Suite / BPEL) as layer between OPA and E-Business Suite
    For overview of Haley Office Rules or Oracle Policy Automation check
    http://onlineappsdba.com/index.php/2009/04/27/oracle-policy-automation-modeling-earlier-haley-office-rules-determination/

  • How to pass any type of objects into Portal's rules engine?

    Is that possible to pass any type of objects into Portal's rules engine? Or BEA's Portal service rules engine can only allow to pass a limited number of objects?
    Are there any information about BEA's rules engine? and Can we use its rules engine without using its Portal service?
    Thank you.

    I worked on BEA rules engine 4 months back. I'm sure you can pass any JAVA object to it's working meomory. I am giving my sample rules here, hope it will be helpful for you.
    I just replace pcakage name, other than that everything is from wroking project. Open in xml spy, it should be clear from the desc. If you have any questions post back.
    <cr:rule-set is-complete="true" xmlns="http://www.bea.com/servers/p13n/xsd/expression/expressions/2.1.1" xmlns:cr="http://www.bea.com/servers/p13n/xsd/rules/core/2.1.1" xmlns:literal="http://www.bea.com/servers/p13n/xsd/expression/literal/1.0.1" xmlns:string="http://www.bea.com/servers/p13n/xsd/expression/string/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/p13n/xsd/rules/core/2.1.1 rules-core-2_1_1.xsd">
         <cr:rule is-complete="true">
              <cr:name>TaxForm1040</cr:name>
              <cr:description>If salary is 70,000 then this rule makes 1040 as required form</cr:description>
              <cr:conditions>
                   <multi-and>
                        <multi-and>
                             <equal-to>
    <instance-method>
    <variable>
    <name>SalaryField</name>
    <type-alias>com.blah.field.REInputObject</type-alias>
    </variable>
    <name>getKey</name>
    </instance-method>
    <literal:string>Salary</literal:string>
    </equal-to>
    <equal-to>
    <instance-method>
    <variable>
    <name>SalaryField</name>
    <type-alias>com.blah.field.REInputObject</type-alias>
    </variable>
    <name>getValue</name>
    </instance-method>
    <literal:integer>70000</literal:integer>
    </equal-to>
                        </multi-and>
                   </multi-and>
              </cr:conditions>
              <cr:actions>
                   <new-instance>
                        <type-alias>com.blah.field.RequiredField</type-alias>
                        <arguments>
                             <literal:string>1040</literal:string>
                        </arguments>
                   </new-instance>
              </cr:actions>
         </cr:rule>
    </cr:rule-set>

  • To invoke bussiness rules engine from ADF

    hi all,
    To invoke the business rule engine running on the SOA server, from the application module. can you please any one help me in this.

    Murali,
    If the business rules are deployed to the SOA Suite as service-enabled rules, they are just web service calls, correct? You can create a web service proxy class in JDeveloper and then just invoke that class from your AM's java code. There's nothing special with respect to an AM in this case, so if you have detailed questions - probably best to ask in the SOA Suite forum - but no need to complicate the issue by bringing an AM into your question - you just want to invoke a business rule from Java.
    John

  • Using Rules Engines, & Batch jobs

    So, we're looking into the best method for storing our business rules. So far, we're investigating Rules Engines (Drools), using database Triggers, SOA, or coding those rules into the application itself.
    Currently, the bulk of our business rules are in table triggers. So, when our batch jobs execute, they pick up all of the business rules as they go.
    I like the concept of using a Rules Engine, though, especially if we could give some control over maintaining those rules to the customer.
    So here's my question, if we went to a Rules Engine approach, or chose one of the non-Trigger approaches, would our batch jobs now have to plug into those rules that applied to that particular process? I'm worried about losing those automatic business rule checks when the trigger executes for any interaction with the underlying table data. With a rules engine, it would seem, you'd have more planning b/c the batch job now has to call all rules that may apply.
    Am I missing the point of a Rules Engine, or is this the case?
    --=Chuck

    1) Oracle 10g includes a rules engine, so if you're going do that path, I'd consider strongly keeping everything in Oracle.
    2) What is the nature of the business rules? Are these validations? Calculations? Something else?
    3) Depending on the rules, and whether your batch process has to do anything to react to a rule (i.e. if you have a validation rule that indicates the batch job inserted an invalid entry, does the job need to do something? Or could a subsequent query alert the user to the problem), you can generally have the rules engine run all the rules at the end of the load (that's generally 1 command from the batch process to the rules engine). Or you could have the rules engine run everything periodically. With the internal Oracle rules engine, I believe you can also have things evaluate synchronously.
    Justin

  • Rules Engine Methodology

    Any tips on a development methodology for creating a rules
    engine? That is, a system to execute a couple of hundred
    triggers & functions on tables & views that produce a table or
    materialized view containing the records that meet all the rules?

    This is a complicated question but I will try my best to give you the best solution:
    #In answer to your question regarding the order that rules fire unless you use priority you cannot garantee the order that the rules fire. The Oracle rules engine uses the Rete algorithm to establish the order in which to fire the rules and this is generally based upon the data passed into the rules. Therefore if the result of rule 4 may effect rule 1 then the rules engine will run rule 4 before rule 1.
    The scenario you have provided is slightly different however and I woudl suggest the following.
    Instead of passing out a single result from your ruleset pass our an array of results meaning you could effectively run all your rules and pass out all rules that failed. Be wary of checking for nulls however because if nothing is passed into a field then the rules engine will not create that element in the rules fact and the rule will never fire.
    To create a array of results you will need to create a function which creates the result fact for you and then addes each result in turn.
    If you woudl like more information let me know and I will help out as much as I can.

  • Rules related to rule engine

    I have initiated to design rule engine.
    Please help me to know how should i design rules. Rules should be designed on the basis of 3 parameters : country,gender,time.
    Please help me with an example.
    Thanks & Regards
    Gaurav K

    Very interesting search ...
    Do you think we can't use google?
    I still see a question in your posts. Just adding a '?' doesn't makes your post a question anybody can answer.
    So please take your time and give us a full use case, your jdev version.
    Timo

  • Business Rule Error: Fact not found in the rule engine working memory, rule

    I am trying to create a simple decision table with an input(ValidateInput) and a output(ValidateOutput). The input and output schemas have unbounded and nested elements(Parent-child relationship). When I create a condition(specific condition on input) and in the action I am asserting the output object. But when I run using EM it throws the following exception. It would be helpful if somebody could tell me what could be the problem. Please note when I set the output as ValidateInput object then it runs fine. Also it executes fine with ValidateOutput if it doesn't have unbounded(List) element inside it.
    Error Message: {http://xmlns.oracle.com/OracleRules10/OracleRules10_DecisionService_1}operationErroredFault
    Fault ID     rules:211
    Fault Time     Jun 18, 2011 10:45:13 AM
    Non Recoverable Business Fault :
    Fact not found in the rule engine working memory, rule session execution failed. The rule session 270013 failed because an instance of the fact com.example.customer.ValidateResponse could not be found in the working memory of the rule session. This is most likely a rule modeling error. The decision service interaction expects the fact instance to exist in the working memory of the rule session. Check the rule actions in rule designer and make sure that a fact of the expected type is being asserted. If the error persists, contact Oracle Support Services. 270013
    Edited by: reachsky on 18 Jun, 2011 9:57 AM

    It's working now..I had to use Global variable to declare child element of the output variable and use the same during action.

  • Error when invoking Rule Engine using Java API

    Hi,
    I have implemented a Java class which calls the Rule Engine to execute the rules. If I test by setting the value of the input inside a main method and get the output, it is working fine. The ruleset is also invoked and there is no problem. However, when I expose this java class as a web service and invoke the web service, I get the below error. I dont get the error if the .rules file is not present in the loaction mentioned. I get the error when the .rules file is present in the location. Not sure if this is an issue with the java call outs or loading the dictionary.
    Error:_
    <faultcode>S:Server</faultcode>
    <faultstring>oracle/rules/sdk2/exception/SDKException</faultstring>
    <ns2:exception xmlns:ns2="http://jax-ws.dev.java.net/" note="To disable this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false" class="java.lang.NoClassDefFoundError">
    <message>oracle/rules/sdk2/exception/SDKException</message>
    <ns2:stackTrace>
    <ns2:frame line="38" file="ImplementRules.java" method="Query" class="oracle.rules.querystudentcriteria.ImplementRules"/>
    <ns2:frame line="native" file="NativeMethodAccessorImpl.java" method="invoke0" class="sun.reflect.NativeMethodAccessorImpl"/>
    <ns2:frame line="39" file="NativeMethodAccessorImpl.java" method="invoke" class="sun.reflect.NativeMethodAccessorImpl"/>
    <ns2:frame line="25" file="DelegatingMethodAccessorImpl.java" method="invoke" class="sun.reflect.DelegatingMethodAccessorImpl"/>
    <ns2:frame line="597" file="Method.java" method="invoke" class="java.lang.reflect.Method"/>
    <ns2:frame line="101" file="WLSInstanceResolver.java" method="invoke" class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker"/>
    <ns2:frame line="83" file="WLSInstanceResolver.java" method="invoke" class="weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker"/>
    <ns2:frame line="152" file="InvokerTube.java" method="invoke" class="com.sun.xml.ws.server.InvokerTube$2"/>
    <ns2:frame line="264" file="EndpointMethodHandler.java" method="invoke" class="com.sun.xml.ws.server.sei.EndpointMethodHandler"/>
    <ns2:frame line="93" file="SEIInvokerTube.java" method="processRequest" class="com.sun.xml.ws.server.sei.SEIInvokerTube"/>
    <ns2:frame line="604" file="Fiber.java" method="__doRun" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="563" file="Fiber.java" method="_doRun" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="548" file="Fiber.java" method="doRun" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="445" file="Fiber.java" method="runSync" class="com.sun.xml.ws.api.pipe.Fiber"/>
    <ns2:frame line="275" file="WSEndpointImpl.java" method="process" class="com.sun.xml.ws.server.WSEndpointImpl$2"/>
    <ns2:frame line="454" file="HttpAdapter.java" method="handle" class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit"/>
    <ns2:frame line="250" file="HttpAdapter.java" method="handle" class="com.sun.xml.ws.transport.http.HttpAdapter"/>
    <ns2:frame line="140" file="ServletAdapter.java" method="handle" class="com.sun.xml.ws.transport.http.servlet.ServletAdapter"/>
    <ns2:frame line="319" file="HttpServletAdapter.java" method="run" class="weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke"/>
    <ns2:frame line="232" file="HttpServletAdapter.java" method="post" class="weblogic.wsee.jaxws.HttpServletAdapter"/>
    <ns2:frame line="310" file="JAXWSServlet.java" method="doPost" class="weblogic.wsee.jaxws.JAXWSServlet"/>
    <ns2:frame line="727" file="HttpServlet.java" method="service" class="javax.servlet.http.HttpServlet"/>
    <ns2:frame line="87" file="JAXWSServlet.java" method="service" class="weblogic.wsee.jaxws.JAXWSServlet"/>
    <ns2:frame line="820" file="HttpServlet.java" method="service" class="javax.servlet.http.HttpServlet"/>
    <ns2:frame line="227" file="StubSecurityHelper.java" method="run" class="weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction"/>
    <ns2:frame line="125" file="StubSecurityHelper.java" method="invokeServlet" class="weblogic.servlet.internal.StubSecurityHelper"/>
    <ns2:frame line="292" file="ServletStubImpl.java" method="execute" class="weblogic.servlet.internal.ServletStubImpl"/>
    <ns2:frame line="26" file="TailFilter.java" method="doFilter" class="weblogic.servlet.internal.TailFilter"/>
    <ns2:frame line="56" file="FilterChainImpl.java" method="doFilter" class="weblogic.servlet.internal.FilterChainImpl"/>
    <ns2:frame line="326" file="DMSServletFilter.java" method="doFilter" class="oracle.dms.wls.DMSServletFilter"/>
    <ns2:frame line="56" file="FilterChainImpl.java" method="doFilter" class="weblogic.servlet.internal.FilterChainImpl"/>
    <ns2:frame line="3592" file="WebAppServletContext.java" method="run" class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction"/>
    <ns2:frame line="321" file="AuthenticatedSubject.java" method="doAs" class="weblogic.security.acl.internal.AuthenticatedSubject"/>
    <ns2:frame line="121" file="SecurityManager.java" method="runAs" class="weblogic.security.service.SecurityManager"/>
    <ns2:frame line="2202" file="WebAppServletContext.java" method="securedExecute" class="weblogic.servlet.internal.WebAppServletContext"/>
    <ns2:frame line="2108" file="WebAppServletContext.java" method="execute" class="weblogic.servlet.internal.WebAppServletContext"/>
    <ns2:frame line="1432" file="ServletRequestImpl.java" method="run" class="weblogic.servlet.internal.ServletRequestImpl"/>
    <ns2:frame line="201" file="ExecuteThread.java" method="execute" class="weblogic.work.ExecuteThread"/>
    <ns2:frame line="173" file="ExecuteThread.java" method="run" class="weblogic.work.ExecuteThread"/>
    </ns2:stackTrace>
    The Java class looks like:
    public PersonType Query (PersonType p)
    try {
    //FileReader reader = new FileReader("/home/orasoa/223345/STRS1.rules");
    //FileReader reader = new FileReader("D:\\Arun\\NGCE_WS\\POC1\\UHG\\QueryStudentCriteria\\oracle\\rules\\querystudentcriteria\\STRS1.rules");
    InputStream stream=ImplementRules.class.getResourceAsStream("/STRS1.rules");
    Reader reader=new InputStreamReader(stream);
    RuleDictionary dict = RuleDictionary.readDictionary(reader, new DecisionPointDictionaryFinder(null));
    List<SDKWarning> warnings = new ArrayList<SDKWarning>();
    dict.update(warnings);
    DecisionPoint decisionPoint = new DecisionPointBuilder().with("STRS1_DecisionService_1").with(dict).build();
    DecisionPointInstance point = decisionPoint.getInstance();
    ArrayList input=new ArrayList();
    input.add(p);
    point.setInputs(input);
    List<Object> output=point.invoke();
    catch (Exception e) {}
    return p;
    Cheers,
    - AR

    Hi, I am getting a similar error when I deploy my application on the weblogic server.
    Could you detail how this was resolved?
    Thanks,
    SB

  • Rules Engine using Web Dynpro ABAP

    Hi,
    Can we build a Rules Engine which works with Web Dynpro-ABAP?  Something similar to BRM in CE-7.2.
    Thanks,
    Prasanna

    Do you mean BRM or BRF.  BRF is the name of the business rules framework that is integrated in the ABAP engine. BRM is Business Rules Management and a part of NetWeaver CE - running on the Java Stack and a part of SAP NetWeaver BPM (Business Process Management).
    Generally if your work is all ABAP based you would use BRF.  Here is a small eLearning that shows the usage of BRF within Web Dynpro ABAP.
    http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/c0181bb1-28e7-2c10-538c-a093c616310e

  • Integration between Oracle BPM and RTD(rule engine)

    Hi,
    I have Oracle BPM - 10.3.2.0.0  Build 100141
    Oracle RTD(rules engine) - 3.0.0.1
    Please let me know whether the versions of RTD and Oracle BPM mentioned above can be integrated with each other.
    How the interaction between Oracle BPM enterprise and RTD will take place and how the data flow takes place between them.
    Thanks in advance

    Check this, u can get some info
    Re: What is a recommended approach to integrate Oracle BPM 10R3 and  Oracle UCM

  • Rules Engine - Updating JavaFact's

    Hi.
    We have started building some rules against a single JavaFact class. Around half way through building the rules we realised that a new 'business function' was required in the JavaFact.
    I can not find any way of updating the JavaFact without actually deleting all rules which depend on the fact. Deleting the rules allows me to delete the fact from the rules engine and then add my updated .jar file / java class as a new JavaFact.
    Is there another way to update the JavaFact to display new functions within the Java class without going through all this destruction!?
    Thanks
    Steve

    More explanation:
    1) If you want to change the name of a property in the Java class, you need to recreate any rules that use it, since it's essentially a different property.
    2) If you want to change the type of a property, you must first remove any references to that property in the rules (but not necesarily the fact type itself), then remove the property entirely from the Java class, reimport the class without the property, then add the property back to the class with the new type, and reimport the class again.
    3) non-property methods (i.e., ones that aren't get and set) can always be reimported regardless of whether or not there is a return type change. However, if the return type is changed, any rule patterns that use this function will be invalid. However, you will not see that they are invalid until you attempt to validate/save a rule again, so be careful about changing type.

  • How to use Hashtable in Rules Engine. And objects within objects in rules

    This is something to do with the JBoss Rules Engine.
    I have an object called 'Employee' containing variables name(string), age(int), sex(string), an object Skill and other fields not relevant.
    Now the Skill object contains name and desc as variables.
    And now i have another seperate object called Test containing two hashtable: inputHT and outputHT.
    i have appropriate data in each of the objects and the hashtable:
    Employee e = new Employee();
    e.setName("Name");
    e.setAge(18);
    e.setSex("f");
    e.getSkill().setSkill("Trainer");
    Hashtable ht = new Hashtable();
    ht.put("age", new Integer(e.getAge());
    ht.put("sex", e.getSex());
    Test t = new Test();
    t.setInputHT(ht);
    Since this is something to do with drools rules: I have the appropriate code even for that.
    Like obtaining the rules defined(.drl files) in a stream, constructing the package builder, rulebase and the working memory.
    I will now explain u my .drl files(ie the rules that i have defined) and the error that i am encountering
    when I have the rule as the following there is no error:
    rule "testRule1"
    when
    e:Employee(age >= 18, sex == "f")
    then
    System.out.println("The lady can marry");
    end
    In the above rule we can see that only two simple variables contained in the employee object is being accessed and there is no error encountered.
    But when I try to access the object "skill" in the employee object, the rule throws me an error when i am constructing the packageBuilder:
    rule "testRule2"
    when
    e:Employee(skill.name == "Trainer")
    then
    System.out.println("The skill is trainer");
    end
    The error thrown is : unexpected token 'skill' and many other dump errors and also error: expected token ')'
    I tried changing the when clause as the following:
    when
    e:Employee(skill.getName() == "Trainer")
    and also
    when
    e:Employee(skill.getName().equals("Trainer"))
    All of them throws the same above error.
    But at the same time if i access only object without its variables, it is working fine. Like:
    rule "testRule2"
    when
    e:Employee(skill == "Trainer")
    then
    System.out.println("The skill is trainer");
    end
    The above rule works properly and does not throw any error. But it is not a valid rule. But syntactically it is correct. and does not throw any error during packageBuilder.
    Similarly, the problem is with the Hashtable
    The below code works fine, but rulewise it is not valid, but syntactically correct. and does not throw any error
    rule "testHT1"
    when
    t:Test(inputHT == "f")
    then
    System.out.println("Print this");
    end
    But the following code throws error, telling unexpected token 'inputHT' :
    rule "testHT1"
    when
    t:Test(inputHT.get("sex") == "f")
    then
    System.out.println("Lady");
    end
    I even changed the when clause, but did not get the appropriate result and it threw me error.
    when
    t:Test(((String)input.get("sex")) == "f")
    and also many other variants but of no use.
    It would be of great help if u or anyone else could reply to this with some solution
    Thank you in advance

    http://forum.java.sun.com/thread.jspa?threadID=774018

Maybe you are looking for