|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.aspic.inference.Element
org.aspic.inference.Constant
org.aspic.inference.Term
org.aspic.inference.Rule
public class Rule
A Rule is a specialised Term, rule/4. The four parameters are:
consequent
(a Constant or Term)antecedent
(an ElementList of Constants or Terms) dob
(a numeric Constant) name
(a Constant) The first two parameters arise naturally from a prolog (i.e. horn clause based) rule system. The last two parameters fix us into the argumentation space and need some explanation.
dob
allows us to place an ordering over arguments that
are developed from facts and rules,List
name
allows a particular rule to be undercut by other
rules and facts. It is itself a Term and can be thought of as a "hidden premise".
because when developing an argument based on a rule, the algorithm checks
that it can develop arguments for each of the rule's premises
(members of the antecedent) *and* it's name.
A KnowledgeBase contains a list of rules. Facts and beliefs are represented in a KnowledgeBase as Rules with an empty antecedent. In order to distinguish between proper rules (i.e. those that have non-empty antecendents) and facts/beliefs a helper method, isFact() is provided.
Because of the "hidden premise" nature of a rule's name, a knowledge
base automatically adds a rule's name as a fact/belief when you add
a rule to the knowledge base. This automatically generated fact/belief
is known as the rule hook. If the rule is proper and unnamed then
the knowledge base automatically assigns the rule a name and adds
that name to the knowledgebase. Care is taken that automatically
assigned names do not conflict with user assigned names. To help
with this process, isAutoNamed
and isAutoGenerated
properties are provided.
Caption and Description fields allow human users to mark-up a rule with a human-readable identifier (caption) and description.
Constructor Summary | |
---|---|
Rule()
Default constructor. |
|
Rule(Constant fact)
Constructor for a fact |
|
Rule(Constant belief,
java.lang.Double dob)
Constructor for a belief (a defeasible assertion, with belief less than 1.0) |
|
Rule(Constant consequent,
ElementList antecedent)
Constructor for a strict rule |
|
Rule(Constant consequent,
ElementList antecedent,
java.lang.Double dob)
Constructor for a defeasible rule |
|
Rule(Constant consequent,
ElementList antecedent,
java.lang.Double dob,
Constant name)
General purpose constructor |
Method Summary | |
---|---|
Rule |
apply(Substitution subs)
Return copy of this Element with the substitution applied. |
java.lang.Object |
clone()
An element is incompletely cloned. |
boolean |
equals(java.lang.Object obj)
|
ElementList |
getAntecedent()
Getter for Rule's antecendent. |
java.lang.String |
getCaption()
Getter for caption. |
java.lang.String |
getClaimCaption()
|
java.lang.String |
getClaimDescription()
|
Constant |
getConsequent()
Getter for Rule consequent. |
java.lang.String |
getDescription()
Getter for description. |
java.lang.Double |
getDob()
Getter for Rule's Degree of Belief. |
Constant |
getName()
Getter for Rule name. |
int |
hashCode()
|
java.lang.String |
inspect()
(idea from the Ruby prototype) inspect allows us to see a representation of the text expression that the object is based on. |
java.lang.String |
inspect(boolean showAutoGeneratedRuleNames,
boolean showRuleHooks)
A version of inspect that allows you to optionally hide all of the auto generated artifacts. |
boolean |
isFact()
Interrogation method to see if this rule actually is a rule, or a rule without a body, which is a fact. |
boolean |
isStrict()
Check whether Rule is defeasible or strict. |
void |
setAntecedent(ElementList antecedent)
Setter for Rule's antecedent. |
void |
setCaption(java.lang.String caption)
Setter for caption. |
void |
setClaimCaption(java.lang.String claimCaption)
|
void |
setClaimDescription(java.lang.String claimDescription)
|
void |
setConsequent(Constant consequent)
Setter for the Rule's consequent. |
void |
setDescription(java.lang.String description)
Setter for description. |
void |
setDob(java.lang.Double dob)
Setter for Rule's Degree of Belief. |
void |
setName(Constant name)
Setter for Rule name. |
void |
write(KnowledgeWriter writer)
Using the Visitor pattern, this method allows the details of an Element to be written in different ways. |
Methods inherited from class org.aspic.inference.Term |
---|
addArg, getArg, isEqualModuloVariables, isGrounded, isUnifiable, negation, numberOfArgs, ruleTag, setArg, setArgList, setKnowledgeBase, unify |
Methods inherited from class org.aspic.inference.Constant |
---|
getFunctor, setFunctor |
Methods inherited from class org.aspic.inference.Element |
---|
getId, getKnowledgeBase, setId, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rule()
public Rule(Constant fact)
fact
- strict constant/termpublic Rule(Constant belief, java.lang.Double dob)
belief
- defeasible constant/termdob
- degree of belief (0, 1.0]public Rule(Constant consequent, ElementList antecedent)
consequent
- claimantecedent
- premisespublic Rule(Constant consequent, ElementList antecedent, java.lang.Double dob)
consequent
- claimantecedent
- premisesdob
- degree of belief (0, 1.0]public Rule(Constant consequent, ElementList antecedent, java.lang.Double dob, Constant name)
consequent
- claimantecedent
- premisesdob
- degree of belief (0, 1.0]name
- consumer supplied rule nameMethod Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class Term
public int hashCode()
hashCode
in class Term
public Constant getConsequent()
public void setConsequent(Constant consequent)
consequent
- A Constants or Terms.public ElementList getAntecedent()
public void setAntecedent(ElementList antecedent)
antecedent
- An ElementList of Constants or Terms.public java.lang.Double getDob()
public void setDob(java.lang.Double dob)
dob
- Degree of Belief (0, 1.0]public Constant getName()
public void setName(Constant name)
name
- the rule's name to set.public java.lang.String inspect()
Element
inspect
in class Term
public java.lang.String inspect(boolean showAutoGeneratedRuleNames, boolean showRuleHooks)
showAutoGeneratedRuleNames
- Allows you to hide automatically generated rule namesshowRuleHooks
- Allows you to hide the automatically generated "rule hook" rules
public Rule apply(Substitution subs)
Element
apply
in class Term
subs
- Substitution to apply
public boolean isFact()
public boolean isStrict()
public void write(KnowledgeWriter writer)
Element
write
in class Term
writer
- the object that does the writing.public java.lang.Object clone()
Element
clone
in class Term
public java.lang.String getCaption()
public void setCaption(java.lang.String caption)
caption
- human readable identifier for rule.public java.lang.String getDescription()
public void setDescription(java.lang.String description)
description
- Human readable description of rule.public java.lang.String getClaimCaption()
public void setClaimCaption(java.lang.String claimCaption)
public java.lang.String getClaimDescription()
public void setClaimDescription(java.lang.String claimDescription)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |