密码临时关系 [英] Cypher temp relationship

查看:42
本文介绍了密码临时关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将路径合并/合并为新关系.问题是我对存储它不感兴趣,而是作为密码查询的结果返回它.

I'm trying to combine / merge a path into a new relationship. The problem is that I'm not interested in storing it but rather return it as a result of a cypher query.

假设我有这样的事情:

(a)-[:CALLS_METHOD]->(b)-[:RETURNS_TYPE]->(c)

我如何建立这样的临时关系:

How can I create a temporary relationship like this one:

(a)-[:DEPENDS_ON]->(c)

仅针对该特定查询的结果,因此我不必存储它.因为我真的只对从 ac 的依赖感兴趣,而不对依赖的细节感兴趣.

Only for a result of that particular query, so that I don't have to store it. Because I'm really only interested in the dependency from a to c and not the details about of that dependency.

推荐答案

您无法从不存在的数据库中返回关系.查询的目的是返回确实存在的内容.

You can't return a relationship from the database that doesn't exist. The purpose of the queries is to return stuff that does exist.

也许您感兴趣的是推断对,而不是关系.类似的东西:

Perhaps what you're interested in is inferred pairs, rather than a relationship. Something like:

MATCH (a)-[r:CALLS_METHOD|RETURNS_TYPE*]->(b)
RETURN a, "depends on", b

您的另一种选择是实现/保存关系,然后查询它:

Your other alternative is to materialize/save the relationship, and then query for it:

MATCH (a)-[r:CALLS_METHOD|RETURNS_TYPE*]->(b)
CREATE a-[newRel:DEPENDS_ON]->b
RETURN newRel;

但这有创建它的副作用.

But this has the side-effect of creating it.

这篇关于密码临时关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆