/** @throws ParseException */ public static boolean isFreeLiteral(Env env, String plit) throws ParseException { Literal pl = IndepPLiteral.toLiteral(plit, env, false); int arity = env.getSymTable().getArity(pl.getName(), TermTypes.PREDICATE); List<String> seenVar = new ArrayList<String>(); for (int i = 0; i < arity; i++) { String v = pl.getArg(i).toString(); if (!v.startsWith("_") || seenVar.contains(v)) return false; seenVar.add(v); } return true; }
public int getArity(Term t, Env env) { return env.getSymTable().getArity(t.getStartName(), t.getStartType()); }
public String getSymbol(Term t, Env env) { return env.getSymTable().get(t.getStartName(), t.getStartType()); }
/** * Gets the predicate of the literal. * * @param env The environment. * @param literal The literal. */ public static String getPredicate(Env env, Literal literal) { return env.getSymTable().get(literal.getName(), literal.getTerm().getStartType()); }