use of catdata.fql.parse.FqlTokenizer in project fql by CategoricalData.
the class Chase method run.
private static Pair<String, String> run(String eds, String inst, KIND kind) throws Exception {
Partial<List<EmbeddedDependency>> xxx = eds_p.parse(new FqlTokenizer(eds));
List<EmbeddedDependency> eds0 = xxx.value;
if (!xxx.tokens.toString().trim().isEmpty()) {
throw new FQLException("Unconsumed input: " + xxx.tokens);
}
Partial<List<Pair<String, List<Pair<String, String>>>>> yyy = inst_p.parse(new FqlTokenizer(inst));
Map<String, Set<Pair<Object, Object>>> inst0 = conv(yyy.value);
if (!yyy.tokens.toString().trim().isEmpty()) {
throw new FQLException("Unconsumed input: " + yyy.tokens);
}
Pair<List<Triple<List<String>, List<Triple<String, String, String>>, List<Triple<String, String, String>>>>, List<Triple<List<String>, List<Triple<String, String, String>>, List<Pair<String, String>>>>> zzz = split(eds0);
if (inst0.isEmpty()) {
return new Pair<>(printNicely3(zzz), "");
}
Map<String, Set<Pair<Object, Object>>> res = chase(new HashSet<>(), zzz, inst0, kind);
return new Pair<>(printNicely3(zzz), printNicely(res));
}
use of catdata.fql.parse.FqlTokenizer in project fql by CategoricalData.
the class Path method parsePath.
// private static List<String> convert(
// List<Pair<Pair<String, String>, String>> l) {
// List<String> ret = new LinkedList<>();
// for (Pair<Pair<String, String>, String> x : l) {
// ret.add(x.second);
// }
// return ret;
// }
public static Path parsePath(Signature a, String s) throws FQLException {
try {
Tokens t = new FqlTokenizer(s);
PathParser pp = new PathParser();
Partial<List<String>> r = pp.parse(t);
if (!r.tokens.toString().trim().isEmpty()) {
throw new FQLException("Invalid path: " + s);
}
return new Path(a, r.value);
} catch (Exception e) {
throw new FQLException("Invalid path: " + s);
}
}
Aggregations