4 Replies Latest reply: Jan 13, 2013 11:03 AM by 927943 RSS

    Determinations Engine API ERROR


      I am trying sample : SimpleBenfits given in OPA-10.6.pdf from below URL. Tutorials : Determinations Engine API


      For e.g in the BELOW class: It is referring to two classes: EngineFactory, SessionManagementMode . These classes are not found in OPA Installables (10.4.2) / jars.

      Is there any additional installation required to resolve the below? Kindly advice.


      * To change this template, choose Tools | Templates
      * and open the template in the editor.
      package com.myapp.opaclient;
      import java.util.Arrays;
      import com.oracle.determinations.engine.*;

      * @author sbhaskara
      public class SimpleBenefitsEngineTest {
      public static void main(String[] args){

      try {

      System.out.println("--- Creating local engine instance ---");
      Engine engine = EngineFactory.localEngine();

      System.out.println("Loading simple benefits rulebase");
      Rulebase simpleBenefits = engine.getRulebase(

      System.out.println("Creating a session");

      Session session = engine.createSession(simpleBenefits,

      // get the attributes entities that we are going to use
      // to set the values for assessing the claimants eligibility

      // we can just get the global entity instance, as every session
      // always has one
      EntityInstance global = session.getGlobalEntityInstance();
      Entity globalEntity = global.getEntity();
      Entity child = simpleBenefits.getEntity("child");

      Attribute claimant_income = globalEntity.getAttribute("claimant_income");
      Attribute claimant_public_housing_client = globalEntity
      Relationship claimantschildren = globalEntity

      Attribute child_age = child.getAttribute("child_age");

      System.out.println("Setting claimant_income to 13000.00");
      claimant_income.setValue(global, 13000.00);

      System.out.println("Setting claimant_public_housing_client to true");
      claimant_public_housing_client.setValue(global, true);

      // unlike the global entity instance, there can be many instances
      //of the child entity. In this case, we will create two child
      // instances.
      EntityInstance child1 = session.createEntityInstance(child);
      EntityInstance child2 = session.createEntityInstance(child);

      // set the age for each child using the child_age attribute.
      System.out.println("Setting child_age on child1 to 16");
      child_age.setValue(child1, 16);
      System.out.println("Setting child_age on child2 to 8");
      child_age.setValue(child2, 8);

      // this creates a relationship with the global as a source and
      // child1 and child2 as targets. Because the claimantschildren
      // relationship is a 1-to-many, the reverse relationship from each
      // to the source will also be created.
      System.out.println("Adding child1 and child2 to 'claimantschildren' relationship");
      Arrays.asList(new EntityInstance[] {child1, child2}));

      // This will fire any rule that relies on data that has changed.
      // Because this is the first time it has been called, that should
      // be everything.

      // outcomes
      Attribute eligible_low_income_allowance = globalEntity
      Attribute low_income_allowance_payment = globalEntity
      Attribute eligible_teenage_allowance = globalEntity

      // print out the results
      System.out.println("\n--- Results ----");

      if (eligible_low_income_allowance.isUnknown(global)) {
      System.out.println("eligible_low_income_allowance is unknown");
      else if (eligible_low_income_allowance.isUncertain(global)) {
      System.out.println("eligible_low_income_allowance is uncertain");
      else {
      System.out.println("eligible_low_income_allowance = "

      if (low_income_allowance_payment.isUnknown(global)) {
      System.out.println("low_income_allowance_payment is unknown");
      else if (low_income_allowance_payment.isUncertain(global)) {
      System.out.println("low_income_allowance_payment is uncertain");
      else {
      System.out.println("low_income_allowance_payment = "

      if (eligible_teenage_allowance.isUnknown(global)) {
      System.out.println("eligible_teenage_allowance is unknown");
      else if (eligible_teenage_allowance.isUncertain(global)) {
      System.out.println("eligible_teenage_allowance is uncertain");
      else {
      System.out.println("eligible_teenage_allowance = "

      catch(Exception e) {
      System.out.println("An error occurred"+ e.getMessage());