Package org.tweetyproject.lp.nlp.syntax
Class NLPRule
- java.lang.Object
-
- org.tweetyproject.logics.commons.syntax.ComplexLogicalFormulaAdapter
-
- org.tweetyproject.lp.nlp.syntax.NLPRule
-
- All Implemented Interfaces:
Formula,Rule<FolFormula,FolFormula>,ComplexLogicalFormula,LogicStructure,SimpleLogicalFormula
public class NLPRule extends ComplexLogicalFormulaAdapter implements ComplexLogicalFormula, Rule<FolFormula,FolFormula>
A rule of a nested logic program. A nested logic program contains not quantified first order formulas.- Author:
- Tim Janus
-
-
Constructor Summary
Constructors Constructor Description NLPRule()NLPRule(FolFormula conclusion)NLPRule(FolFormula conclusion, java.util.Collection<FolFormula> premise)NLPRule(FolFormula conclusion, FolFormula premise)NLPRule(NLPRule other)
-
Method Summary
Modifier and Type Method Description voidaddPremise(FolFormula premise)Add the given premise to this rule.voidaddPremises(java.util.Collection<? extends FolFormula> premises)Add the given premises to this rule.NLPRuleclone()Creates a deep copy of this formulabooleanequals(java.lang.Object other)java.util.Set<FolAtom>getAtoms()Processes the set of all atoms which appear in this formulaFolFormulagetConclusion()Returns the conclusion of this rule.java.lang.Class<? extends Predicate>getPredicateCls()java.util.Set<Predicate>getPredicates()Processes the set of all predicates which appear in this formulajava.util.Collection<FolFormula>getPremise()Returns the premise of this rule.FolSignaturegetSignature()Returns the signature of the language of this formula.java.util.Set<Term<?>>getTerms()inthashCode()booleanisConstraint()booleanisFact()voidsetConclusion(FolFormula conclusion)Set the conclusion of this rule.NLPRulesubstitute(Term<?> v, Term<?> t)Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.-
Methods inherited from class org.tweetyproject.logics.commons.syntax.ComplexLogicalFormulaAdapter
containsTermsOfType, exchange, getTerms, isGround, isLiteral, isWellFormed, substitute
-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.ComplexLogicalFormula
exchange, isGround, isWellFormed, substitute
-
Methods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.LogicStructure
containsTermsOfType, getTerms
-
Methods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.SimpleLogicalFormula
isLiteral
-
-
-
-
Constructor Detail
-
NLPRule
public NLPRule()
-
NLPRule
public NLPRule(NLPRule other)
-
NLPRule
public NLPRule(FolFormula conclusion)
-
NLPRule
public NLPRule(FolFormula conclusion, FolFormula premise)
-
NLPRule
public NLPRule(FolFormula conclusion, java.util.Collection<FolFormula> premise)
-
-
Method Detail
-
addPremise
public void addPremise(FolFormula premise) throws LanguageException
Description copied from interface:RuleAdd the given premise to this rule.- Specified by:
addPremisein interfaceRule<FolFormula,FolFormula>- Parameters:
premise- some formula- Throws:
LanguageException
-
addPremises
public void addPremises(java.util.Collection<? extends FolFormula> premises)
Description copied from interface:RuleAdd the given premises to this rule.- Specified by:
addPremisesin interfaceRule<FolFormula,FolFormula>- Parameters:
premises- some formulas
-
setConclusion
public void setConclusion(FolFormula conclusion) throws LanguageException
Description copied from interface:RuleSet the conclusion of this rule.- Specified by:
setConclusionin interfaceRule<FolFormula,FolFormula>- Parameters:
conclusion- some formula- Throws:
LanguageException
-
getPremise
public java.util.Collection<FolFormula> getPremise()
Description copied from interface:RuleReturns the premise of this rule.- Specified by:
getPremisein interfaceRule<FolFormula,FolFormula>- Returns:
- the premise of this rule.
-
getConclusion
public FolFormula getConclusion()
Description copied from interface:RuleReturns the conclusion of this rule.- Specified by:
getConclusionin interfaceRule<FolFormula,FolFormula>- Returns:
- the conclusion of this rule.
-
getSignature
public FolSignature getSignature()
Description copied from interface:FormulaReturns the signature of the language of this formula.- Specified by:
getSignaturein interfaceFormula- Specified by:
getSignaturein interfaceRule<FolFormula,FolFormula>- Returns:
- the signature of the language of this formula.
-
isFact
public boolean isFact()
- Specified by:
isFactin interfaceRule<FolFormula,FolFormula>
-
isConstraint
public boolean isConstraint()
- Specified by:
isConstraintin interfaceRule<FolFormula,FolFormula>
-
getAtoms
public java.util.Set<FolAtom> getAtoms()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Returns:
- The set of all atoms
-
getPredicates
public java.util.Set<Predicate> getPredicates()
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Specified by:
getPredicatesin interfaceSimpleLogicalFormula- Returns:
- all predicates that appear in this formula
-
getPredicateCls
public java.lang.Class<? extends Predicate> getPredicateCls()
- Specified by:
getPredicateClsin interfaceSimpleLogicalFormula- Returns:
- The class description of the predicate used by this formula.
-
getTerms
public java.util.Set<Term<?>> getTerms()
- Specified by:
getTermsin interfaceLogicStructure- Returns:
- a set containing all terms of this logical structure
-
substitute
public NLPRule substitute(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
Description copied from interface:ComplexLogicalFormulaSubstitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.- Specified by:
substitutein interfaceComplexLogicalFormula- Parameters:
v- the term to be substituted.t- the term to substitute.- Returns:
- a formula where every occurrence of "v" is replaced by "t".
- Throws:
java.lang.IllegalArgumentException- if "v" and "t" are of different sorts
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceSimpleLogicalFormula- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Specified by:
equalsin interfaceSimpleLogicalFormula- Overrides:
equalsin classjava.lang.Object
-
clone
public NLPRule clone()
Description copied from interface:SimpleLogicalFormulaCreates a deep copy of this formula- Specified by:
clonein interfaceComplexLogicalFormula- Specified by:
clonein interfaceSimpleLogicalFormula- Specified by:
clonein classComplexLogicalFormulaAdapter- Returns:
- the cloned formula
-
-