git地址:gitee.com/aslante/cyh…
使用实例:
@Test
public void buildCypherDsl() {
String cypherDsl = CypherDsl.node("Cat")
.withId("jerry")
.withNamed("a")
.create()
.buildDsl();
System.out.println(cypherDsl);
Map<String, Object> value = Maps.newHashMap();
value.put("weight", 3);
value.put("color", "black");
value.put("percent", 0.13);
System.out.println(CypherDsl.node("Dog")
.withId("tom")
.withNamed("c")
.withProperty(value)
.match()
.returning("c")
.buildDsl());
System.out.println(
CypherDsl.relation(CypherDsl.node("Cat").withNamed("a"), CypherDsl.node("Dog").withNamed("b"))
.withLabel("Follow")
.withNamed("r")
.withPair("step", 1)
.match()
.returning("a","b","r")
.limit(10)
.buildDsl()
);
}
输出结果: CREATE (a:Cat{id:'jerry'}) MATCH (c:Dog{id:'tom',color:'black',weight:3,percent:0.130000}) RETURN c MATCH (a:Cat)-(r:Follow{step:1})->(b:Dog) RETURN a,b,r LIMIT 10