Class KIFAST

java.lang.Object
com.articulate.sigma.KIFAST

public class KIFAST extends Object
  • Field Details

    • count

      public static int count
      A numeric constant denoting normal parse mode, in which syntax constraints are enforced.
    • terms

      public Set<String> terms
      The set of all terms in the knowledge base. This is a set of Strings.
    • termFrequency

      public Map<String,Integer> termFrequency
      A hashMap to store term frequencies for each term in knowledge base
    • formulas

      public Map<String,List<FormulaAST>> formulas
      A HashMap of ArrayLists of Formulas. Each String key points to a list of String formulas that correspond to that key. For example, "arg-1-Foo" would be one of several keys for "(instance Foo Bar)". see #createKey(String, boolean, boolean, int, int) for key format.
    • formulaMap

      public Map<String,FormulaAST> formulaMap
      A HashMap of String keys representing the formula, and Formula values. For example, "(instance Foo Bar)" is a String key that might point to a Formula that is that string, along with information about at what line number and in what file it appears.
    • filename

      public String filename
    • warningSet

      public Set<String> warningSet
      warnings generated during parsing
    • errorSet

      public Set<String> errorSet
      errors generated during parsing
  • Constructor Details

    • KIFAST

      public KIFAST()
  • Method Details

    • readFile

      public Set<String> readFile(String fname) throws Exception
      Read a KIF file.
      Parameters:
      fname - - the full pathname of the file.
      Throws:
      Exception
    • parseBody

      public Set<String> parseBody(String s, int startLine, int endLine)
      Returns:
      a Set of warnings that may indicate syntax errors, but not fatal parse errors.
    • parseNew

      public Set<String> parseNew(StreamTokenizer_s st)
      Get a formula at a time and send to parseBody()
      Returns:
      a Set of warnings that may indicate syntax errors, but not fatal parse errors.
    • parse

      public Set<String> parse(Reader r)
      This method has the side effect of setting the contents of formulaMap and formulas as it parses the file. It throws a ParseException with file line numbers if fatal errors are encountered during parsing. Keys in variable "formulas" include the string representation of the formula.
      Returns:
      a Set of warnings that may indicate syntax errors, but not fatal parse errors.
    • main

      public static void main(String[] args) throws IOException
      Test method for this class. TODO: Currently throws a stack overflow. 2/4/25 tdn
      Throws:
      IOException