Class DlgpWriter

java.lang.Object
fr.inria.rules.integraal.io.dlgp.DlgpWriter
All Implemented Interfaces:
Writer, Closeable, AutoCloseable

public class DlgpWriter extends Object implements Writer
Writes the content of the knowledge base as DLGP
Author:
Florent Tornil
  • Constructor Details

    • DlgpWriter

      public DlgpWriter()
      Default constructor writing in the standard output
    • DlgpWriter

      public DlgpWriter(Writer writer)
      Constructor writing with the given writer
      Parameters:
      writer - the writer to use
    • DlgpWriter

      public DlgpWriter(File file) throws IOException
      Creates a writer that writes to the supplied file.
      Parameters:
      file - file to write into
      Throws:
      IOException - if the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
    • DlgpWriter

      public DlgpWriter(String filepath) throws IOException
      Creates a writer that writes to the supplied file path.
      Parameters:
      filepath - filepath to write into
      Throws:
      IOException - if the file path exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason
  • Method Details

    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Description copied from interface: Writer
      Flush the writer if possible
      Specified by:
      flush in interface Writer
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Object object) throws IOException
      Description copied from interface: Writer
      Write the given object if possible
      Specified by:
      write in interface Writer
      Parameters:
      object - object to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(String str) throws IOException
      Write the given string
      Parameters:
      str - string to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(KnowledgeBase kb) throws IOException
      Write the given kb as DLGP
      Parameters:
      kb - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(FactBase fb) throws IOException
      Write the given fb as DLGP
      Parameters:
      fb - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Stream<Atom> atoms) throws IOException
      Write the given stream of atoms, treated as a conjunction, in DLGP
      Parameters:
      atoms - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(RuleBase rb) throws IOException
      Write the given rb as DLGP
      Parameters:
      rb - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(FORule rule) throws IOException
      Write the given rule as DLGP
      Parameters:
      rule - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(FOQuery<?> query) throws IOException
      Write the given query as DLGP
      Parameters:
      query - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(FOFormula formula) throws IOException
      Write the given formula as DLGP For now, only conjunction is handled (and flattened)
      Parameters:
      formula - to write
      Throws:
      IOException - If an I/O error occurs
    • writeConjunction

      public void writeConjunction(Collection<Atom> atoms) throws IOException
      Write the given atoms as a single conjunction as DLGP
      Parameters:
      atoms - conjunction to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Atom atom) throws IOException
      Write the given atom as DLGP
      Parameters:
      atom - to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Predicate p) throws IOException
      Write the given predicate as DLGP
      Parameters:
      p - predicate to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Term t) throws IOException
      Write the given term as DLGP
      Parameters:
      t - term to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(EvaluableFunction ef) throws IOException
      Write the given evaluable function as DLGP
      Parameters:
      ef - evaluable function to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Variable v) throws IOException
      Write the given variable as DLGP
      Parameters:
      v - variable to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Literal<?> l) throws IOException
      Write the given literal as DLGP. This is not yet fully implemented.
      Actually handles Integer, Double and Boolean. Other types are written as String.
      In order to add more types, you can extend this method.
      Parameters:
      l - literal to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(LogicalFunctionalTerm f) throws IOException
      Write the given functional term as DLGP. This is not yet fully implemented.
      The computed prefix is not added back !
      Parameters:
      f - functional term to write
      Throws:
      IOException - If an I/O error occurs
    • write

      public void write(Constant c) throws IOException
      Write the given constant as DLGP
      Parameters:
      c - constant to write
      Throws:
      IOException - If an I/O error occurs