Rule Execution Server API

Package ilog.rules.res.session.ruleset

Provides the interfaces for execution traces.

See:
          Description

Interface Summary
IlrExecutionEvent IlrExecutionEvent represents an execution event.
IlrExecutionTrace IlrExecutionTrace represents the detailed information about ruleset execution.
IlrRuleAction Represents an action part of a rule, when executing with the decision engine.
IlrRuleEvent IlrRuleEvent represents an executed rule.
IlrRuleflowElementInformation Information about a ruleflow element, whether a task or a rule.
IlrRuleInformation IlrRuleInformation represents information about a Rule.
IlrTaskEvent IlrTaskEvent represents an executed task.
IlrTaskInformation IlrTaskInformation represents information about a task.
 

Class Summary
IlrBusinessExecutionTrace IlrBusinessExecutionTrace is a wrapper for IlrExecutionTrace.
 

Package ilog.rules.res.session.ruleset Description

Provides the interfaces for execution traces.

Overview

An execution trace is a dynamic body of information that spans the process of a ruleset going in and coming out of the rule engine.

When a trace is enabled, an execution request is notified by means of a Boolean value. The IlrSessionRequest class is initialized with a ruleset path, then the execution trace is enabled using a session descriptor. You also use this descriptor to set and retrieve the filters used for the session request.

After the ruleset is executed, the execution results are accessible in the form of an execution response. The IlrSessionResponse interface is used to access the properties and the result of the execution trace. The execution trace is gathered throughout the process of ruleset execution.

Trace filters

The following filters can be used to build the execution trace:

Code example

The following code example shows how to retrieve the standard and business trace information for an executed ruleset:

  IlrSessionFactory sessionFactory = getFactory();

  // Create a session request object
  IlrSessionRequest sessionRequest = sessionFactory.createRequest();
  String rulesetPath = "/miniloanruleapp/miniloanrules";
  if (!rulesetVersion.equalsIgnoreCase("Latest")) {
    rulesetPath = rulesetPath + "/" + rulesetVersion;
  }
  sessionRequest.setRulesetPath(IlrPath.parsePath(rulesetPath));
  // Enable trace to retrieve info on executed rules
  sessionRequest.setTraceEnabled(true);
  // get all traces
  sessionRequest.getTraceFilter().setInfoAllFilters(true);
  // Set the input parameters for the execution of the rules
  Map<String,Object> inputParameters = sessionRequest.getInputParameters();
  inputParameters.put("loan", loan);
  inputParameters.put("borrower", borrower);

  IlrStatelessSession session = sessionFactory.createStatelessSession();

  // execute and get the response for this request
  IlrSessionResponse response = session.execute(sessionRequest);

  // get the execution Trace
  IlrExecutionTrace sessionTrace = response.getRulesetExecutionTrace();

  // number of rules fired
  int rulesNumber = sessionTrace.getTotalRulesFired() ;
      
  // Get the Business version of execution trace
  IlrBusinessExecutionTrace execResult = new IlrBusinessExecutionTrace(response.getRulesetExecutionTrace());

  // Get the list of rules fired (Business names)
  List<String> rulesFired =   execResult.getRuleFiredBusinessNames();

  // including output parameters state
  loan = (Loan) response.getOutputParameters().get("loan");


Rule Execution Server API

© Copyright IBM Corp. 1987, 2013