Package org.tweetyproject.lp.nlp.syntax
Class NLPProgram
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<NLPRule>,Collection<NLPRule>,Set<NLPRule>,BeliefBase,LogicProgram<FolFormula,FolFormula,NLPRule>
public class NLPProgram
extends RuleSet<NLPRule>
implements LogicProgram<FolFormula,FolFormula,NLPRule>
A nested logic program
- Author:
- Tim Janus
- See Also:
- Serialized Form
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFact(FolFormula fact)Adds the given fact to the programvoidaddFacts(FolFormula... facts)Adds the given facts to the programSubstitutes all occurrences of term "v" in this formula by term "t" and at the same time replaces all occurrences of term "t" by term "v" and eventually returns the new formula.getFacts()Returns the signature of the language of this knowledge base.substitute(Map<? extends Term<?>,? extends Term<?>> map)Substitutes all occurrences of all terms "v" in map.keyset() in this formula by map.get(v) and returns the new formula.substitute(Term<?> t, Term<?> v)Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.Methods inherited from class org.tweetyproject.commons.util.rules.RuleSet
getConclusions, getPremises, getRulesWithConclusion, getSyntacticModuleMethods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toStringMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.tweetyproject.logics.commons.syntax.interfaces.LogicProgram
toString
-
Constructor Details
-
NLPProgram
public NLPProgram()
-
-
Method Details
-
getFacts
- Returns:
- A set of facts as FOL formulas
-
addFact
Description copied from interface:LogicProgramAdds the given fact to the program- Specified by:
addFactin interfaceLogicProgram<FolFormula,FolFormula,NLPRule>- Parameters:
fact- a fact
-
addFacts
Description copied from interface:LogicProgramAdds the given facts to the program- Specified by:
addFactsin interfaceLogicProgram<FolFormula,FolFormula,NLPRule>- Parameters:
facts- some facts
-
getMinimalSignature
Description copied from interface:BeliefBaseReturns the signature of the language of this knowledge base.- Specified by:
getMinimalSignaturein interfaceBeliefBase- Specified by:
getMinimalSignaturein interfaceLogicProgram<FolFormula,FolFormula,NLPRule>- Returns:
- the signature of the language of this knowledge base.
-
substitute
Description copied from interface:LogicProgramSubstitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.- Specified by:
substitutein interfaceLogicProgram<FolFormula,FolFormula,NLPRule>- Parameters:
t- the term to be substituted.v- the term to substitute.- Returns:
- a formula where every occurrence of "v" is replaced by "t".
-
substitute
public NLPProgram substitute(Map<? extends Term<?>,? extends Term<?>> map) throws IllegalArgumentExceptionDescription copied from interface:LogicProgramSubstitutes all occurrences of all terms "v" in map.keyset() in this formula by map.get(v) and returns the new formula.- Specified by:
substitutein interfaceLogicProgram<FolFormula,FolFormula,NLPRule>- Parameters:
map- a mapping defining which terms to be substituted.- Returns:
- a formula where every term in map.keyset() has been replaced by map.get(v).
- Throws:
IllegalArgumentException- if any term and its mapping are of different sorts
-
exchange
Description copied from interface:LogicProgramSubstitutes all occurrences of term "v" in this formula by term "t" and at the same time replaces all occurrences of term "t" by term "v" and eventually returns the new formula.- Specified by:
exchangein interfaceLogicProgram<FolFormula,FolFormula,NLPRule>- Parameters:
v- a term.t- a term.- Returns:
- a new logical formula with both "v" and "t" exchanged.
- Throws:
IllegalArgumentException- if "v" and "t" are of different sorts
-