Package net.sf.tweety.logics.fol.writer
Class TPTPWriter
- java.lang.Object
-
- net.sf.tweety.logics.fol.writer.TPTPWriter
-
- All Implemented Interfaces:
FolWriter
public class TPTPWriter extends java.lang.Object implements FolWriter
Prints single first-order logic formulas and full knowledge bases to TPTP format.- Author:
- Nils Geilen, Anna Gessler
- See Also:
EFOLReasoner
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.io.WriterwriterOutput is redirected to this writer
-
Constructor Summary
Constructors Constructor Description TPTPWriter()Creates new TPTPWriterTPTPWriter(java.io.Writer writer)Creates new TPTPWriter
-
Method Summary
Modifier and Type Method Description voidclose()Closes the Writer.private <T> java.lang.Stringjoin(java.util.Collection<T> c, java.lang.String delimiter)Joins the elements of c.private java.lang.StringmakeAxiom(java.lang.String name, java.lang.String body)Creates a TPTP axiom out of a given name and formula.private java.lang.Stringparens(java.lang.String str)Puts str in parentheses.voidprintBase(FolBeliefSet b)Prints formatted representation of a knowledge base.voidprintEquivalence(FolFormula a, FolFormula b)Prints an Equivalence.private java.lang.StringprintFormula(RelationalFormula f)Creates a TPTP representation of a formula.voidprintQuery(FolFormula query)Prints formatted representation of a query.private java.lang.StringprintVar(Variable v)Crates a type check or type def for a variablejava.lang.StringtoString()
-
-
-
Method Detail
-
printQuery
public void printQuery(FolFormula query) throws java.io.IOException
Description copied from interface:FolWriterPrints formatted representation of a query.- Specified by:
printQueryin interfaceFolWriter- Parameters:
query- the formula to be queried- Throws:
java.io.IOException- if an IO issue occurs.
-
printEquivalence
public void printEquivalence(FolFormula a, FolFormula b) throws java.io.IOException
Description copied from interface:FolWriterPrints an Equivalence.- Specified by:
printEquivalencein interfaceFolWriter- Parameters:
a- formula on one side of the equationb- formula on the other side of the equation- Throws:
java.io.IOException- if an IO issue occurs.
-
printBase
public void printBase(FolBeliefSet b) throws java.io.IOException
Description copied from interface:FolWriterPrints formatted representation of a knowledge base.
-
makeAxiom
private java.lang.String makeAxiom(java.lang.String name, java.lang.String body)Creates a TPTP axiom out of a given name and formula.- Parameters:
name- the identifying name of the axiombody- the axiom's formula in TPTP format- Returns:
- the axiom as a string
-
printVar
private java.lang.String printVar(Variable v)
Crates a type check or type def for a variable- Parameters:
v- a variable- Returns:
- type(var)
-
printFormula
private java.lang.String printFormula(RelationalFormula f)
Creates a TPTP representation of a formula.- Parameters:
f- a formula- Returns:
- a string that represents the formula in TPTP format
-
parens
private java.lang.String parens(java.lang.String str)
Puts str in parentheses.- Parameters:
str- a string- Returns:
- (str)
-
join
private <T> java.lang.String join(java.util.Collection<T> c, java.lang.String delimiter)Joins the elements of c.- Parameters:
c- a collectiondelimiter- will separate elements- Returns:
- a string representation of the elements of c separated by the delimiter
-
close
public void close() throws java.io.IOExceptionDescription copied from interface:FolWriterCloses the Writer.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-