Package net.sf.tweety.lp.nlp.syntax
Class NLPProgram
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<T>
-
- net.sf.tweety.commons.util.rules.RuleSet<NLPRule>
-
- net.sf.tweety.lp.nlp.syntax.NLPProgram
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<NLPRule>
,java.util.Collection<NLPRule>
,java.util.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
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
kill warning
-
Constructor Summary
Constructors Constructor Description NLPProgram()
-
Method Summary
Modifier and Type Method Description void
addFact(FolFormula fact)
Adds the given fact to the programNLPProgram
exchange(Term<?> v, Term<?> t)
Substitutes 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.java.util.Set<FolFormula>
getFacts()
FolSignature
getMinimalSignature()
Returns the signature of the language of this knowledge base.NLPProgram
substitute(java.util.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.NLPProgram
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 net.sf.tweety.commons.util.rules.RuleSet
getConclusions, getPremises, getRulesWithConclusion, getSyntacticModule
-
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size, spliterator
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.tweety.logics.commons.syntax.interfaces.LogicProgram
toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
kill warning- See Also:
- Constant Field Values
-
-
Method Detail
-
getFacts
public java.util.Set<FolFormula> getFacts()
- Returns:
- A set of facts as FOL formulas
-
addFact
public void addFact(FolFormula fact)
Description copied from interface:LogicProgram
Adds the given fact to the program- Specified by:
addFact
in interfaceLogicProgram<FolFormula,FolFormula,NLPRule>
- Parameters:
fact
- a fact
-
getMinimalSignature
public FolSignature getMinimalSignature()
Description copied from interface:BeliefBase
Returns the signature of the language of this knowledge base.- Specified by:
getMinimalSignature
in interfaceBeliefBase
- Specified by:
getMinimalSignature
in interfaceLogicProgram<FolFormula,FolFormula,NLPRule>
- Returns:
- the signature of the language of this knowledge base.
-
substitute
public NLPProgram substitute(Term<?> t, Term<?> v)
Description copied from interface:LogicProgram
Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.- Specified by:
substitute
in 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(java.util.Map<? extends Term<?>,? extends Term<?>> map) throws java.lang.IllegalArgumentException
Description copied from interface:LogicProgram
Substitutes all occurrences of all terms "v" in map.keyset() in this formula by map.get(v) and returns the new formula.- Specified by:
substitute
in 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:
java.lang.IllegalArgumentException
- if any term and its mapping are of different sorts
-
exchange
public NLPProgram exchange(Term<?> v, Term<?> t) throws java.lang.IllegalArgumentException
Description copied from interface:LogicProgram
Substitutes 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:
exchange
in interfaceLogicProgram<FolFormula,FolFormula,NLPRule>
- Parameters:
v
- a term.t
- a term.- Returns:
- a new logical formula with both "v" and "t" exchanged.
- Throws:
java.lang.IllegalArgumentException
- if "v" and "t" are of different sorts
-
-