Class ClingoWriter


  • public class ClingoWriter
    extends java.lang.Object
    Prints ASP programs and single rules to the Clingo input format (https://potassco.org/clingo/). The Clingo input format adheres (mostly) to the ASP-Core-2 language standard. Also works for the basic elements of the DLV input format.
    Author:
    Anna Gessler
    See Also:
    ClingoSolver, DLVSolver
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean usePredicateWhitelist  
      (package private) java.io.Writer writer  
    • Constructor Summary

      Constructors 
      Constructor Description
      ClingoWriter()  
      ClingoWriter​(java.io.Writer writer)
      Create a new ClingoWriter with the given writer.
      ClingoWriter​(java.io.Writer writer, boolean b)  
    • Method Summary

      Modifier and Type Method Description
      void close()  
      void printProgram​(Program p)
      Prints program
      private java.lang.String printRule​(ASPRule r)
      Creates string representation of a single rule in Clingo format.
      void usePredicateWhitelist​(boolean b)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • writer

        java.io.Writer writer
      • usePredicateWhitelist

        private boolean usePredicateWhitelist
    • Constructor Detail

      • ClingoWriter

        public ClingoWriter​(java.io.Writer writer)
        Create a new ClingoWriter with the given writer.
        Parameters:
        writer - a writer
      • ClingoWriter

        public ClingoWriter()
      • ClingoWriter

        public ClingoWriter​(java.io.Writer writer,
                            boolean b)
    • Method Detail

      • printProgram

        public void printProgram​(Program p)
                          throws java.io.IOException
        Prints program
        Parameters:
        p - a program
        Throws:
        java.io.IOException - if an IO issue occurs.
      • printRule

        private java.lang.String printRule​(ASPRule r)
        Creates string representation of a single rule in Clingo format.
        Parameters:
        r - an ASP rule
        Returns:
        String representation of the rule
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • usePredicateWhitelist

        public void usePredicateWhitelist​(boolean b)