Cypher(神奇的WITH)

做了一段时间cypher,发现几乎每一段复杂的query都需要一个with

start n=node(*)
with n as n_alias
return n_alias

换一种方式试试

start n=node(*)
match n-->m
return collect([n,percentile_cont(id(m),.5)])
Error
start n=node(*)
match n-->m
with n,percentile_cont(id(m),.5) as median_id
return collect(median_id);
start n=node(*)
where 1=2
with n
return n;

在with未得到任何指示时不传递任何信息。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MyBatis is a Java-based persistence framework that provides mapping between relational databases and Java objects. It helps simplify database access by handling database communication and SQL generation. On the other hand, Cypher is a query language specifically designed for querying graph databases, such as Neo4j. It allows you to express patterns and relationships in your data in a simple and intuitive way. If you're looking to use Cypher with MyBatis, it's important to note that MyBatis is primarily designed for relational databases, so it may not have built-in support for Cypher out of the box. However, you can still use MyBatis with Cypher by writing custom SQL queries that execute Cypher statements against a graph database. To do this, you can use the MyBatis `@SelectProvider` annotation along with a custom SQL provider class. In the SQL provider class, you can write the logic to generate the necessary Cypher queries and execute them against the graph database. Here's an example of how you can use MyBatis with Cypher: First, define your Cypher query in the SQL provider class: ``` public class CypherSqlProvider { public String getNodes() { return "MATCH (n) RETURN n"; } } ``` Next, use the `@SelectProvider` annotation in your MyBatis mapper interface: ``` @Mapper public interface NodeMapper { @SelectProvider(type = CypherSqlProvider.class, method = "getNodes") List<Node> getNodes(); } ``` In this example, the `getNodes` method in the `CypherSqlProvider` class generates a Cypher query that matches all nodes in the graph database and returns them. The `@SelectProvider` annotation in the `NodeMapper` interface associates the method with the SQL provider class. Please note that this is just a basic example, and depending on your specific use case, you may need to modify it accordingly. I hope this answers your question. Let me know if you have any further queries!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值