public abstract class DelpRule extends RelationalFormula implements Rule<FolFormula,FolFormula>
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<FolFormula> |
body
The body of the rule (these must be a literals).
|
protected FolFormula |
head
The head of the rule (this must be a literal).
|
Constructor and Description |
---|
DelpRule(FolFormula head,
java.util.Collection<? extends FolFormula> body)
Default constructor; initializes head and body of the rule
|
Modifier and Type | Method and Description |
---|---|
void |
addPremise(FolFormula premise) |
void |
addPremises(java.util.Collection<? extends FolFormula> premises) |
Conjunction |
combineWithAnd(Conjuctable f)
Returns a conjunction of this and the given formula.
|
Disjunction |
combineWithOr(Disjunctable f) |
RelationalFormula |
complement() |
boolean |
containsQuantifier()
Checks whether this formula contains any quantification.
|
boolean |
equals(java.lang.Object o) |
java.util.Set<FOLAtom> |
getAtoms()
Processes the set of all atoms which appear in this formula
|
FolFormula |
getConclusion()
Returns the conclusion of this rule.
|
java.util.Set<Functor> |
getFunctors() |
java.util.Set<Predicate> |
getPredicates()
Processes the set of all predicates which appear in this
formula
|
java.util.Collection<? extends FolFormula> |
getPremise()
Returns the premise of this rule.
|
java.util.Set<Variable> |
getQuantifierVariables() |
FolSignature |
getSignature()
Returns the signature of the language of this formula.
|
(package private) abstract java.lang.String |
getSymbol() |
java.util.Set<Term<?>> |
getTerms() |
<C extends Term<?>> |
getTerms(java.lang.Class<C> cls)
Processes the set containing all terms of type C.
|
java.util.Set<Variable> |
getUnboundVariables() |
Probability |
getUniformProbability() |
int |
hashCode() |
boolean |
isApplicable(java.util.Collection<? extends FolFormula> literals)
Checks whether this rule is applicaple in the given context ,
|
boolean |
isClosed()
Checks whether this formula is closed, i.e.
|
boolean |
isClosed(java.util.Set<Variable> boundVariables)
Checks whether this formula is closed, i.e.
|
boolean |
isConstraint() |
boolean |
isFact() |
boolean |
isGround()
Checks whether there appear any variables in this rule
|
boolean |
isLiteral() |
boolean |
isWellBound()
Checks whether this formula is well-bound, i.e.
|
boolean |
isWellBound(java.util.Set<Variable> boundVariables)
Checks whether this formula is well-bound, i.e.
|
void |
setConclusion(FolFormula conclusion) |
abstract RelationalFormula |
substitute(Term<?> v,
Term<?> t)
Substitutes all occurrences of term "v" in this formula
by term "t" and returns the new formula.
|
java.lang.String |
toString() |
allGroundInstances, allSubstitutions, clone, containsTermsOfType, exchange, getFormula, getPredicateCls, getSatisfactionRatio, isWellFormed, substitute
protected FolFormula head
protected java.util.Set<FolFormula> body
DelpRule(FolFormula head, java.util.Collection<? extends FolFormula> body)
head
- a literalbody
- a set of literalsabstract java.lang.String getSymbol()
public boolean isApplicable(java.util.Collection<? extends FolFormula> literals)
literals
- a set of literalspublic boolean isGround()
isGround
in interface ComplexLogicalFormula
isGround
in class RelationalFormula
public java.util.Collection<? extends FolFormula> getPremise()
Rule
getPremise
in interface Rule<FolFormula,FolFormula>
public FolFormula getConclusion()
Rule
getConclusion
in interface Rule<FolFormula,FolFormula>
public Conjunction combineWithAnd(Conjuctable f)
Conjuctable
combineWithAnd
in interface Conjuctable
combineWithAnd
in class RelationalFormula
f
- a formula to be combined with AND and this.public Disjunction combineWithOr(Disjunctable f)
combineWithOr
in interface Disjunctable
combineWithOr
in class RelationalFormula
f
- a formula to be combined with OR and this.public RelationalFormula complement()
complement
in interface Invertable
complement
in class RelationalFormula
public java.util.Set<Predicate> getPredicates()
SimpleLogicalFormula
getPredicates
in interface SimpleLogicalFormula
public java.util.Set<FOLAtom> getAtoms()
SimpleLogicalFormula
getAtoms
in interface SimpleLogicalFormula
getAtoms
in class RelationalFormula
public boolean isLiteral()
isLiteral
in interface SimpleLogicalFormula
public java.util.Set<Term<?>> getTerms()
getTerms
in interface LogicStructure
public <C extends Term<?>> java.util.Set<C> getTerms(java.lang.Class<C> cls)
LogicStructure
getTerms
in interface LogicStructure
cls
- The Class structure containing type information about the
searched termpublic java.util.Set<Variable> getQuantifierVariables()
getQuantifierVariables
in interface QuantifiedFormula
public boolean isFact()
isFact
in interface Rule<FolFormula,FolFormula>
public boolean isConstraint()
isConstraint
in interface Rule<FolFormula,FolFormula>
public void setConclusion(FolFormula conclusion)
setConclusion
in interface Rule<FolFormula,FolFormula>
public void addPremise(FolFormula premise)
addPremise
in interface Rule<FolFormula,FolFormula>
public void addPremises(java.util.Collection<? extends FolFormula> premises)
addPremises
in interface Rule<FolFormula,FolFormula>
public boolean containsQuantifier()
QuantifiedFormula
containsQuantifier
in interface QuantifiedFormula
public abstract RelationalFormula substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
RelationalFormula
substitute
in interface ComplexLogicalFormula
substitute
in class RelationalFormula
v
- the term to be substituted.t
- the term to substitute.java.lang.IllegalArgumentException
- if "v" and "t" are of different sorts
(NOTE: this exception is only thrown when "v" actually appears in this
formula).public java.util.Set<Variable> getUnboundVariables()
getUnboundVariables
in interface QuantifiedFormula
public boolean isClosed()
QuantifiedFormula
isClosed
in interface QuantifiedFormula
public boolean isClosed(java.util.Set<Variable> boundVariables)
QuantifiedFormula
isClosed
in interface QuantifiedFormula
boundVariables
- the variables assumed to be bound.public boolean isWellBound()
QuantifiedFormula
isWellBound
in interface QuantifiedFormula
public boolean isWellBound(java.util.Set<Variable> boundVariables)
QuantifiedFormula
isWellBound
in interface QuantifiedFormula
boundVariables
- the variables assumed to be bound.public java.util.Set<Functor> getFunctors()
getFunctors
in class RelationalFormula
public Probability getUniformProbability()
getUniformProbability
in interface ProbabilityAware
getUniformProbability
in class RelationalFormula
public java.lang.String toString()
toString
in class RelationalFormula
public boolean equals(java.lang.Object o)
equals
in interface SimpleLogicalFormula
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface SimpleLogicalFormula
hashCode
in class java.lang.Object
public FolSignature getSignature()
Formula
getSignature
in interface Formula
getSignature
in interface Rule<FolFormula,FolFormula>
getSignature
in class RelationalFormula