com.oracle.determinations.engine
Class Attribute
This topic only applies to self-managed Intelligent Advisor edition
java.lang.Object
com.oracle.determinations.engine.Attribute
public final class Attribute
extends java.lang.Object
Represents an Attribute of a Rulebase as an in-memory object model.
An Attribute is a property or field, such as someone's date of birth or
surname, and is defined by the developer of the rulebase.
Attributes, Entities, and Relationships belong to the static view of a Rulebase. This is available outside of any Session of a Rulebase.
Method Summary
Modifier and Type | Method and Description |
---|---|
void | backwardChain(EntityInstance instance,
com.oracle.determinations.engine.eval.BackwardChainReporter reporter,
com.oracle.determinations.engine.eval.Relevance attributeRelevance) Entry point for performing backward chaining. |
java.lang.Object | evaluate(EntityInstance instance) Get the value of this attribute instance as an Object. |
void | generateRelevanceData(EntityInstance instance,
com.oracle.determinations.engine.RelevanceReport report) Generates relevance data for the instance of this attribute, adding it to the specified report. |
DecisionReportNode | getDecisionReport(EntityInstance instance) Generates a DecisionReport for the Attribute instance, explaining why the
Attribute instance has the value it does. |
DecisionReportNode | getDecisionReport(EntityInstance instance,
DecisionReportOptions options) Generates a DecisionReport for the Attribute instance, explaining why the
Attribute instance has the value it does. |
Entity | getEntity() Get the Entity which contains this Attribute. |
AttributeEnumeration | getEnumeration() Return an attribute enumeration in the default rulebase locale. |
AttributeEnumeration | getEnumeration(java.lang.String locale) Returns an attribute enumeration in the specified locale |
Attribute | getEnumFilterAttribute() If this attribute is filtered by some other attribute, return the
filtering attribute. |
java.lang.String | getFormattedValue(EntityInstance instance) Get the formatted value of this attribute instance using the current
formatter. |
InferencingType | getInferencingType() Return the inferencing effect this attribute has on the rulebase. |
java.lang.Object | getMaxValue() Gets the Maximum allowable value or null if unrestricted. |
java.lang.Object | getMinValue() Gets the Minimum allowable value or null if unrestricted. |
java.lang.String | getName() Get the name of this Attribute. |
com.oracle.determinations.engine.AbstractRule | getProvingRule() Return the proving rule of this attribute. |
java.lang.String | getRawText(EntityInstance instance,
SentenceForm sentenceForm) Returns the raw text for this attribute, in the form specified,
with substitution symbols left as-is. |
java.lang.String | getRawText(java.lang.String locale,
SentenceForm sentenceForm) Returns the raw text for this attribute, in the form specified,
with substitution symbols left as-is. |
java.lang.String | getRegExp() Gets the regular expression the value must conform to, or null
if unrestricted. |
com.oracle.determinations.engine.RelevanceReport | getRelevanceReport(EntityInstance instance) Generates a relevance report for the attribute instance, describing
the intermediate and base-level attributes that are required to
get a value for the attribute. |
java.lang.String | getStaticText(Session session,
SentenceForm sentenceForm) Returns the static text for this attribute, in the form specified,
with static text substitutions performed. |
java.lang.String | getStaticText(java.lang.String locale,
SentenceForm sentenceForm) Returns the static text for this attribute, in the form specified,
with static text substitutions performed. |
java.lang.String | getSubstitutedText(EntityInstance instance,
SentenceForm sentenceForm) Returns the text in the desired form for the instance of this attribute
stored within the specified entity instance. |
java.lang.Object | getUserData(EntityInstance instance) Returns the user data associated with this Attribute instance. |
java.lang.String | getUserValidationMessage(EntityInstance entityInstance) Returns the user defined error message for failed min/max/regexp validation. |
java.lang.Object | getValue(EntityInstance instance) Get the value of this attribute instance as its appropriate Object value. |
byte | getValueType() Get the type of this Attribute as a
AttributeType value. |
boolean | hasEnumeration() Returns true if the attribute has an attribute enumeration. |
boolean | hasPublicName() Returns true if the name of the attribute is a public name. |
boolean | isDisplayUnformatted() Returns true if the value should be unformatted by default. |
boolean | isEverUnknown(EntityInstance instance) For non-temporal values, this is equivalent to isUnknown. |
boolean | isInferred(EntityInstance instance) Returns true when the (non-unknown) attribute value has been inferred by
the engine. |
boolean | isIntegerOnly() Indicates whether the value must be an integer. |
boolean | isSeedableByQueryParameter() Determine whether the attribute may be seeded from a URL parameter. |
boolean | isUncertain(EntityInstance instance) Is the current value of an attribute instance uncertain. |
boolean | isUnknown(EntityInstance instance) Is the current value of an attribute instance unknown. |
boolean | isUserSet(EntityInstance instance) Has this attribute value been set by a user or inferred by the rulebase. |
void | setUserData(EntityInstance instance,
java.lang.Object data) Sets the user data that is associated with this Attribute instance. |
void | setValue(EntityInstance instance,
java.lang.Object value) Allow the user to set a value represented by the given Object. |
java.lang.String | toString() Returns a simple String indicating the public name of the Attribute, the
type, and its corresponding entity. |
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Method Detail
backwardChain
public void backwardChain(EntityInstance instance, com.oracle.determinations.engine.eval.BackwardChainReporter reporter, com.oracle.determinations.engine.eval.Relevance attributeRelevance)
Entry point for performing backward chaining. Backward chains perform
tasks such as decision reports, the get next question loop, and the
get all questions report.
- Parameters:
instance
- the entity instance to be used as initial context for the backward chainreporter
- the report accumulator object
evaluate
public java.lang.Object evaluate(EntityInstance instance)
Get the value of this attribute instance as an Object.
This includes unknown and uncertain values.
- Parameters:
instance
- the entity instance to be used as context for evaluating this attribute- Returns:
- the Object representation of this attribute instance
generateRelevanceData
public void generateRelevanceData(EntityInstance instance, com.oracle.determinations.engine.RelevanceReport report)
Generates relevance data for the instance of this attribute, adding it to the specified report.
getDecisionReport
public DecisionReportNode getDecisionReport(EntityInstance instance)
Generates a DecisionReport for the Attribute instance, explaining why the
Attribute instance has the value it does.
- Parameters:
instance
- an EntityInstance object defining the entity context within which to assess the decision for this attribute- Returns:
- the root decision report node for the decision report
getDecisionReport
public DecisionReportNode getDecisionReport(EntityInstance instance, DecisionReportOptions options)
Generates a DecisionReport for the Attribute instance, explaining why the
Attribute instance has the value it does.
- Parameters:
instance
- an EntityInstance object defining the entity context within which to assess the decision for this attributeoptions
- parameters to use when generating the decision report.- Returns:
- the root decision report node for the decision report
getEntity
public Entity getEntity()
Get the Entity which contains this Attribute.
- Returns:
- the owning Entity of this Attribute
getEnumeration
public AttributeEnumeration getEnumeration()
Return an attribute enumeration in the default rulebase locale.
- Returns:
- an AttributeEnumeration, or
null
if no enumeration exists
getEnumeration
public AttributeEnumeration getEnumeration(java.lang.String locale)
Returns an attribute enumeration in the specified locale
- Parameters:
locale
- the locale for the enumeration- Returns:
- an AttributeEnumeration, or
null
if no enumeration exists for the given locale
getEnumFilterAttribute
public Attribute getEnumFilterAttribute()
If this attribute is filtered by some other attribute, return the
filtering attribute.
- Returns:
- the filtering attribute, or
null
if there is no filtering attribute
getFormattedValue
public java.lang.String getFormattedValue(EntityInstance instance)
Get the formatted value of this attribute instance using the current
formatter.
- Parameters:
instance
- the entity instance to be used as context for evaluating this attribute- Returns:
- a String representation of this attribute instance
getInferencingType
public InferencingType getInferencingType()
Return the inferencing effect this attribute has on the rulebase.
- Returns:
- one of the InferencingType constants
getMaxValue
public java.lang.Object getMaxValue()
Gets the Maximum allowable value or
null
if unrestricted.
Not applicable to String or Boolean types.- Returns:
- the maximum allowable value, or
null
if not applicable
getMinValue
public java.lang.Object getMinValue()
Gets the Minimum allowable value or
null
if unrestricted.
Not applicable to String or Boolean types.- Returns:
- the minimum allowable value, or
null
if not applicable
getName
public java.lang.String getName()
Get the name of this Attribute.
- Returns:
- the name of this Attribute
getProvingRule
public com.oracle.determinations.engine.AbstractRule getProvingRule()
Return the proving rule of this attribute. Public solely for the benefit
of ExpressionAttributeRef, which is in the expression package. Should not
be used outside the engine.
- Returns:
- the proving rule for this attribute, if any
getRawText
public java.lang.String getRawText(EntityInstance instance, SentenceForm sentenceForm) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Returns the raw text for this attribute, in the form specified,
with substitution symbols left as-is. This is for backward compatibility
with the RuleBurst 8 engine, and allows substitutions to be deferred.
- Parameters:
instance
- the entity instance that contains useful information such the language/locale of the session and whether or not this sentence should use second person formssentenceForm
- the desired sentence form as a constant from the SentenceForm class- Returns:
- the static text for this attribute, or
null
if no text is available - Throws:
java.lang.IllegalStateException
- the rulebase does not contain any sentence text informationjava.lang.IllegalArgumentException
- the sentence form was inappropriate for this attribute or an invalid sentence form constant was passed in- Since:
- 11.0
getRawText
public java.lang.String getRawText(java.lang.String locale, SentenceForm sentenceForm) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Returns the raw text for this attribute, in the form specified,
with substitution symbols left as-is. This is for backward compatibility
with the RuleBurst 8 engine, and allows substitutions to be deferred.
- Parameters:
locale
- the locale of the text to be returned. The locale must be of the rulebase's supported locales as specified byRulebase.getAvailableLocales()
sentenceForm
- the desired sentence form as a constant from the SentenceForm class- Returns:
- the static text for this attribute, or
null
if no text is available - Throws:
java.lang.IllegalStateException
- the rulebase does not contain any sentence text informationjava.lang.IllegalArgumentException
- the sentence form was inappropriate for this attribute, or an invalid sentence form constant was passed in- Since:
- 10.2
getRegExp
public java.lang.String getRegExp()
Gets the regular expression the value must conform to, or
null
if unrestricted. Only applicable to String types- Returns:
- the regular expression as a String, or
null
if unrestricted
getRelevanceReport
public com.oracle.determinations.engine.RelevanceReport getRelevanceReport(EntityInstance instance)
Generates a relevance report for the attribute instance, describing
the intermediate and base-level attributes that are required to
get a value for the attribute. This is essentially a decision
report that mirrors the data-model structure rather than the rule
structure.
- Parameters:
instance
- an EntityInstance object defining the context within which to assess the decision for this attribute- Returns:
- a relevance report for the attribute
getStaticText
public java.lang.String getStaticText(Session session, SentenceForm sentenceForm) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Returns the static text for this attribute, in the form specified,
with static text substitutions performed.
- Parameters:
session
- the session, this contains useful information, like the language/localesentenceForm
- the desired sentence form as a constant from the SentenceForm class- Returns:
- the static text for this attribute, or
null
if no text is available - Throws:
java.lang.IllegalStateException
- the rulebase does not contain any sentence text informationjava.lang.IllegalArgumentException
- the sentence form was inappropriate for this attribute, or an invalid sentence form constant was passed in- Since:
- 10.1
getStaticText
public java.lang.String getStaticText(java.lang.String locale, SentenceForm sentenceForm) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
Returns the static text for this attribute, in the form specified,
with static text substitutions performed.
- Parameters:
locale
- the locale of the text to be returned. The locale must be of the rulebase's supported locales as specified byRulebase.getAvailableLocales()
sentenceForm
- the desired sentence form as a constant from the SentenceForm class- Returns:
- the static text for this attribute, or
null
if no text is available - Throws:
java.lang.IllegalStateException
- the rulebase does not contain any sentence text informationjava.lang.IllegalArgumentException
- the sentence form was inappropriate for this attribute, or an invalid sentence form constant was passed in- Since:
- 10.2
getSubstitutedText
public java.lang.String getSubstitutedText(EntityInstance instance, SentenceForm sentenceForm) throws java.lang.IllegalArgumentException
Returns the text in the desired form for the instance of this attribute
stored within the specified entity instance. Substitution will be
carried out if required.
- Parameters:
instance
- the entity instance for attribute text substitutionsentenceForm
- the desired sentence form as a constant from the SentenceForm class- Returns:
- the static text for this attribute, or
null
if no text is available - Throws:
java.lang.IllegalArgumentException
- the sentence form was inappropriate for this attribute, or an invalid sentence form constant was passed in
getUserData
public java.lang.Object getUserData(EntityInstance instance)
Returns the user data associated with this Attribute instance.
The user data is an Object of an application-defined format.
Regardless of whether or not an Attribute instance is unknown, uncertain, or inferred all data associated with it (user data, classes and grammatical person) persist for the life time of its housing EntityInstance.
- Parameters:
instance
- the entity instance used to resolve the attribute instance
getUserValidationMessage
public java.lang.String getUserValidationMessage(EntityInstance entityInstance)
Returns the user defined error message for failed min/max/regexp validation.
- Parameters:
entityInstance
- the current entity instance- Returns:
- the validation message set by user. If no message was specified in Policy Modeling, method returns null.
getValue
public java.lang.Object getValue(EntityInstance instance)
Get the value of this attribute instance as its appropriate Object value.
This includes unknown and uncertain values. Note that Date values are
always translated into the local timezone before being returned to the
caller.
- Parameters:
instance
- the entity instance to be used as context for evaluating this attribute- Returns:
- a String representation of this attribute instance
getValueType
public byte getValueType()
Get the type of this Attribute as a
AttributeType
value.- Returns:
- one of the types in AttributeType
hasEnumeration
public boolean hasEnumeration()
Returns true if the attribute has an attribute enumeration.
- Returns:
- whether the attribute has an attribute enumeration
hasPublicName
public boolean hasPublicName()
Returns true if the name of the attribute is a public name.
- Returns:
true
if the name of the attribute is a public name, otherwisefalse
isDisplayUnformatted
public boolean isDisplayUnformatted()
Returns true if the value should be unformatted by default.
- Returns:
- whether the value should be unformatted
isEverUnknown
public boolean isEverUnknown(EntityInstance instance)
For non-temporal values, this is equivalent to isUnknown. Where the attribute has a
temporal value, this is a test to see if the attribute is unknown at any point in time.
- Parameters:
instance
-- Returns:
- true if the attribute is unknown, or is unknown at some point in time.
isInferred
public boolean isInferred(EntityInstance instance)
Returns true when the (non-unknown) attribute value has been inferred by
the engine. Returns false if the value is user set, or if the value is
unknown.
- Parameters:
instance
- the entity instance used to resolve the attribute value- Returns:
true
if the value is inferred by the engine and is known, otherwisefalse
isIntegerOnly
public boolean isIntegerOnly()
Indicates whether the value must be an integer. Only applicable to Number or Currency types.
- Returns:
true
if the specified value must be an integer, otherwisefalse
isSeedableByQueryParameter
public boolean isSeedableByQueryParameter()
Determine whether the attribute may be seeded from a URL parameter.
Applicable to Intelligent Advisor interviews.
- Returns:
true
if the attribute may be seeded from a URL parameter, otherwisefalse
- Since:
- 12.2.2
isUncertain
public boolean isUncertain(EntityInstance instance)
Is the current value of an attribute instance uncertain.
- Parameters:
instance
- the entity instance to be used as context for evaluating this attribute- Returns:
true
if the evaluated value is uncertain, otherwisefalse
isUnknown
public boolean isUnknown(EntityInstance instance)
Is the current value of an attribute instance unknown.
- Parameters:
instance
- the entity instance to be used as context for evaluating this attribute- Returns:
true
if the evaluated value is unknown, otherwisefalse
isUserSet
public boolean isUserSet(EntityInstance instance)
Has this attribute value been set by a user or inferred by the rulebase.
- Parameters:
instance
- the entity instance used to resolve the attribute value- Returns:
true
if the value is set by a user, otherwisefalse
if the value is inferred by the engine or is unknown
setUserData
public void setUserData(EntityInstance instance, java.lang.Object data)
Sets the user data that is associated with this Attribute instance.
The user data is an Object of an application-defined format.
Regardless of whether or not an Attribute instance is unknown, uncertain, or inferred all data associated with it (user data, classes and grammatical person) persist for the life time of its housing EntityInstance.
- Parameters:
instance
- the entity instance used to resolve the attribute instancedata
- the user data to associate with this Attribute instance
setValue
public void setValue(EntityInstance instance, java.lang.Object value)
Allow the user to set a value represented by the given Object. The Object
should be of the correct type for this Attribute type.
String values are always defensively copied in order to prevent excessive
character buffer storage in certain cases.
- Parameters:
instance
- the entity instance in which the attribute instance value should be setvalue
- the value to be set- Throws:
java.lang.ClassCastException
- the object value is of an unexpected typejava.lang.IllegalArgumentException
- if either: the instance passed is not an instance of the entity to which this attribute belongs; any of the validations specified in the attribute's proeprties are of an invalid format; or he value fails the maximum, minimum or regular expression validations specifed in the attribute's properties.
toString
public java.lang.String toString()
Returns a simple String indicating the public name of the Attribute, the
type, and its corresponding entity.
- Overrides:
toString
in classjava.lang.Object
- Returns:
- a String representation of this Attribute