use of org.opencypher.gremlin.translation.CypherAstWrapper in project cypher-for-gremlin by opencypher.
the class Translation method translateVerbose.
@Test
public void translateVerbose() throws Exception {
// freshReadmeSnippet: verbose
String cypher = "MATCH (p:Person) WHERE p.age > 25 RETURN p.name";
CypherAstWrapper ast = CypherAstWrapper.parse(cypher);
Translator<String, GroovyPredicate> translator = Translator.builder().gremlinGroovy().build();
String gremlin = ast.buildTranslation(translator);
// freshReadmeSnippet: verbose
assertThat(gremlin).startsWith("g.V()");
}
use of org.opencypher.gremlin.translation.CypherAstWrapper in project cypher-for-gremlin by opencypher.
the class NoCustomFunctionsTest method functionsAndPredicates.
@Test
public void functionsAndPredicates() {
String cypher = "MATCH (n:N) " + "WITH n.p AS s " + "WHERE s STARTS WITH 'x' " + "AND s ENDS WITH 'x' " + "AND s CONTAINS 'x' " + "RETURN length(s), toString(s)";
CypherAstWrapper ast = CypherAstWrapper.parse(cypher);
Translator<String, GroovyPredicate> translator = Translator.builder().gremlinGroovy().build(flavor);
assertThatThrownBy(() -> ast.buildTranslation(translator)).hasMessageContaining("contains, convertToString, endsWith, length, starsWith");
}
Aggregations