Class VarTypes

java.lang.Object
com.articulate.sigma.parsing.VarTypes

public class VarTypes extends Object
Determine the types of variables by their appearance in relations, as well as whether constants or functions are allowed given their types
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    VarTypes(Collection<FormulaAST> set, KB kbinput)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Constrain variables found in the argument list of a predicate variable where the relation 'rel' will be substituted
    void
    Go through the equation map of a formula.
    void
    if a relation is used as an argument, add a suffix to that constant in the literal for the constant list.
    void
    Go through the argument map of a formula, which consists of all predicates and their arguments in each position, within this formula, and find the type of that argument.
    findTypeOfFunterm(com.articulate.sigma.parsing.SuokifParser.FuntermContext input)
    funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ;
    findTypeOfTerm(com.articulate.sigma.parsing.SuokifParser.TermContext input, String sigType)
    term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; Since types are not instances, always remove any trailing '+' denoting a class
    void
     
    boolean
    functionSpecializationAllowed(org.antlr.v4.runtime.tree.ParseTree c, String sigTypeNoSuffix)
    The type specialization of MeasureFn is a special case funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ;
    void
    printContexts(Map<Integer,Set<com.articulate.sigma.parsing.SuokifParser.ArgumentContext>> args)
     

    Methods inherited from class java.lang.Object

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

    • debug

      public boolean debug
  • Constructor Details

  • Method Details

    • findTypeOfFunterm

      public String findTypeOfFunterm(com.articulate.sigma.parsing.SuokifParser.FuntermContext input)
      funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ;
    • findTypeOfTerm

      public String findTypeOfTerm(com.articulate.sigma.parsing.SuokifParser.TermContext input, String sigType)
      term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ; Since types are not instances, always remove any trailing '+' denoting a class
    • findEquationType

      public void findEquationType(FormulaAST f)
      Go through the equation map of a formula. If the argument is a variable, add the type to the variable type map (varTypeMap) by finding the type of the other argument eqsent : '(' 'equal' term term ')' ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ;
    • constrainVars

      public FormulaAST constrainVars(String rel, String var, FormulaAST f)
      Constrain variables found in the argument list of a predicate variable where the relation 'rel' will be substituted
    • functionSpecializationAllowed

      public boolean functionSpecializationAllowed(org.antlr.v4.runtime.tree.ParseTree c, String sigTypeNoSuffix)
      The type specialization of MeasureFn is a special case funterm : '(' FUNWORD argument+ ')' ; argument : (sentence | term) ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ;
    • findRelationsAsArgs

      public void findRelationsAsArgs(FormulaAST f)
      if a relation is used as an argument, add a suffix to that constant in the literal for the constant list. It will be used later in conversion to TPTP.
    • findType

      public void findType(FormulaAST f)
      Go through the argument map of a formula, which consists of all predicates and their arguments in each position, within this formula, and find the type of that argument. If the argument is a variable, add the type to the variable type map (varTypeMap). If the argument is not a variable, make sure it is allowed as a argument, given the signature of the predicate. If not, report an error. Handling functions that are arguments requires a special case to call findTypeOfFunterm. MeasureFn is a special case of function arguments since the type of the measure indicates the return type of the function. argument : (sentence | term) ; sentence : (relsent | logsent | quantsent | variable) ; term : (funterm | variable | string | number | FUNWORD | IDENTIFIER ) ;
    • printContexts

      public void printContexts(Map<Integer,Set<com.articulate.sigma.parsing.SuokifParser.ArgumentContext>> args)
    • findTypes

      public void findTypes()