use of ai.grakn.graql.internal.parser.GraqlErrorListener in project grakn by graknlabs.
the class TemplateParser method parseTemplate.
/**
* Parse and resolve a graql template.
* @param templateString a string representing a graql template
* @param data data to use in template
* @return resolved graql query string
*/
public String parseTemplate(String templateString, Map<String, Object> data) {
GraqlErrorListener errorListener = GraqlErrorListener.of(templateString);
CommonTokenStream tokens = lexGraqlTemplate(templateString, errorListener);
ParseTree tree = parseGraqlTemplate(tokens, errorListener);
TemplateVisitor visitor = new TemplateVisitor(tokens, data, macros);
return visitor.visit(tree).toString();
}
Aggregations