Skip navigation links

Oracle Business Rules Java API Reference
10g (10.1.3.1.0)

B28966-01


oracle.rules.sdk.dictionary
Class RuleDictionary

java.lang.Object
  extended byoracle.rules.sdk.dictionary.RuleDictionary


public class RuleDictionary
extends java.lang.Object

This class is the top level container for a rule project. a rule dictionary contains one datamodel and one or more rulesets


Constructor Summary
RuleDictionary(java.lang.String name)
           

 

Method Summary
 java.lang.String dataModelRL()
          Generate the RL for the data model.
 void debugDataModelRL(java.util.Map ruleSessionConfig)
          Syntax check the generated RL for the data model.
 void debugRuleSetRL(java.lang.String ruleSetName, java.util.Map ruleSessionConfig)
          Syntax check the generated RL for a RuleSet.
 oracle.rules.sdk.datamodel.DataModel getDataModel()
          Get the data model in the dictionary
 java.lang.String getDictionaryDescription()
          Get description of the dictionary.
 java.util.Locale getLocale()
          Get the Locale associated with the dictionary.
 java.lang.String getMarker()
           
 java.lang.String getMarkerDescription()
          Get description of the marker.
 java.lang.String getName()
          Get the name of the dictionary
 java.lang.String[] getRuleSetNames()
          Get an Array of RuleSet Names that are currently stored in in the Dictionary (in-memory copy).
 oracle.rules.sdk.ruleset.RuleSet removeRuleSet(java.lang.String rulesetName)
          Remove a ruleset from the rule dictionary.
 java.lang.String ruleSetRL(java.lang.String ruleSetName)
          Generate the RL for the given rule set.
 void setDataModel(oracle.rules.sdk.datamodel.DataModel dm)
          Set data model.
 void setDictionaryDescription(java.lang.String desc)
          Set description to the dictionary.
 void setLocale(java.util.Locale locale)
          Associate a Locale to the dictionary
 void setMarkerDescription(java.lang.String desc)
          Set description to the marker.
 java.lang.Object testRuleSets(java.lang.String functionName, java.lang.String[] ruleSetName, java.io.Writer writer, java.util.Map ruleSessionConfig)
          Create a RuleSession with the given rule sets, then call a data model function.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

RuleDictionary

public RuleDictionary(java.lang.String name)

Method Detail

getName

public java.lang.String getName()
Get the name of the dictionary
Returns:
name of the dictionay

getDataModel

public oracle.rules.sdk.datamodel.DataModel getDataModel()
Get the data model in the dictionary
Returns:
data model in the dictionary

setDataModel

public void setDataModel(oracle.rules.sdk.datamodel.DataModel dm)
                  throws RulesSDKException
Set data model. The DataModelManager provides APIs to create an empty datamodel or load an existing datamodel from XML
Parameters:
dm - the data model object
Throws:
RulesSDKException

dataModelRL

public java.lang.String dataModelRL()
                             throws RuleSetException
Generate the RL for the data model. The RL will be contained in a rule set with the same name as the data model. In order to execute a rule set from the dictionary, it is first necessary to execute the data model generated code first in the RuleSession.
Returns:
the RL for the data model rule set
Throws:
RuleSetException

debugDataModelRL

public void debugDataModelRL(java.util.Map ruleSessionConfig)
                      throws RuleSetException,
                             RLException
Syntax check the generated RL for the data model. See debugRuleSetRL(java.lang.String, java.util.Map).
Parameters:
ruleSessionConfig - optional. See RuleSession
Throws:
RuleSetException - if code cannot be generated due to internal system error.
RLException - if code was incorrectly generated due to internal system error.

ruleSetRL

public java.lang.String ruleSetRL(java.lang.String ruleSetName)
                           throws RuleSetException
Generate the RL for the given rule set. In order to execute a rule set from the dictionary, it is first necessary to execute the data model generated code first in the RuleSession.
Parameters:
ruleSetName - name of the ruleSet for which to generate code
Returns:
the RL for the data model rule set
Throws:
RuleSetException

debugRuleSetRL

public void debugRuleSetRL(java.lang.String ruleSetName,
                           java.util.Map ruleSessionConfig)
                    throws RuleSetException,
                           RLException
Syntax check the generated RL for a RuleSet. In order to use this feature, Java classes referenced in the data model must be on the caller's classpath. If they are not, oracle.rules.rl.exceptions.UndefinedException will be thrown. Other subclasses of RLException which are of special interest are TypeCheckException, ParseException, and MultipleInheiritanceException. The following code can be used to return the line in error:
 try {
     debugRuleSetRL ("myName")
 }
 catch (RLException e) {
     String[] ln = ruleSetRL ("myName").split
                (System.getProperty("line.separator");
     String errorLine = ln [e.getLine()];
     int errorColumn = e.getColumn();
 }
 
Parameters:
ruleSetName - name of the ruleSet for which to generate code
ruleSessionConfig - optional. See RuleSession
Throws:
RuleSetException - if code cannot be generated due to internal system error.
RLException - if code was incorrectly generated due to internal system error.

testRuleSets

public java.lang.Object testRuleSets(java.lang.String functionName,
                                     java.lang.String[] ruleSetName,
                                     java.io.Writer writer,
                                     java.util.Map ruleSessionConfig)
                              throws RuleSetException,
                                     RLException
Create a RuleSession with the given rule sets, then call a data model function. In order to use this feature, Java classes referenced in the data model must be on the caller's classpath. If the are not, oracle.rules.rl.exceptions.UndefinedException will be thrown.

RL is generated for the rule sets and loaded into a rule session, but they are not pushed onto the stack or run. The test function should do this.

 A typical test function looks like:

 void testFunction()
 {

     // assert test facts
     assert new myClass (value: 1);
     assert new myClass (value: 2);

     // pushRuleset then run it
     pushRuleset("myRuleSet");
     run();
 }

 The corresponding test call looks like:

 testRuleSets ("DM.testFunction", new String[]{"myRuleSet"}, null);
 
Parameters:
functionName - the name of an RL function in the data model.
ruleSetName - an array of rule set names in the dictionary.
writer - optional. where to write output of println(), default System.out
ruleSessionConfig - optional. See RuleSession
Returns:
the return value of the called function
Throws:
RuleSetException
RLException

getRuleSetNames

public java.lang.String[] getRuleSetNames()
Get an Array of RuleSet Names that are currently stored in in the Dictionary (in-memory copy). A RuleSet must have been created before its name will appear in this list. If an edit instance of a RuleSet has been new'd but not updated, that RuleSet name will not appear in the list.
Returns:
Array of RuleSet names

removeRuleSet

public oracle.rules.sdk.ruleset.RuleSet removeRuleSet(java.lang.String rulesetName)
                                               throws RulesSDKException
Remove a ruleset from the rule dictionary.
Parameters:
rulesetName - name of the ruleset to be removed
Returns:
the ruleset matching the given name
Throws:
RulesSDKException

getMarker

public java.lang.String getMarker()

getDictionaryDescription

public java.lang.String getDictionaryDescription()
Get description of the dictionary.
Returns:
Description of the dictionary. "" if the dictionary does not have a description.

setDictionaryDescription

public void setDictionaryDescription(java.lang.String desc)
Set description to the dictionary.
Parameters:
desc - description of the dictionary.

getMarkerDescription

public java.lang.String getMarkerDescription()
Get description of the marker.
Returns:
Description of the marker. "" if the marker does not have a description.

setMarkerDescription

public void setMarkerDescription(java.lang.String desc)
Set description to the marker.
Parameters:
desc - description of the marker.

getLocale

public java.util.Locale getLocale()
Get the Locale associated with the dictionary.
Returns:
Locale of the dictionary.

setLocale

public void setLocale(java.util.Locale locale)
Associate a Locale to the dictionary
Parameters:
locale - Locale to be associated.

Skip navigation links

Oracle Business Rules Java API Reference
10g (10.1.3.1.0)

B28966-01


Copyright © 2006, Oracle. All rights reserved.