返回边的查询

huangapple go评论57阅读模式
英文:

Query for returning edge

问题

MATCH (a:Person)-[l:workWith]-(b:Person) RETURN l

英文:
MATCH (a:Person)-[l:workWith]-(b:Person) RETURN a, l, b

If I execute a query and it returns three values (start node, edge, and end node), how can I modify the query to retrieve only the information about the edge

答案1

得分: 3

你可以将它修改为:

MATCH (a:Person)-[l:workWith]-(b:Person) RETURN l

以仅检索有关边的信息。

由于你只想打印边,所以不会显示任何图形。

你可以在age-viewer GUI中的选项中选择表格,以查看此特定查询的图形或表格。

返回边的查询

英文:

You can just modify it to:

MATCH (a:Person)-[l:workWith]-(b:Person) RETURN l

to retrieve only the information about the edge.

Since you are only trying to print the edges so no graph will show up.

You can choose the Table from the option given viewing graph or Table for this specific query in age-viewer GUI.

返回边的查询

答案2

得分: 0

The return statement at the end of your query indicates what needs to be returned based on the labels following RETURN. The 'a' and 'b' labels in your query are for two individual vertices. The 'l' label is an edge label. Change your return statement to RETURN l should work.

英文:

The return statement at the end of your query indicates what needs to be returned based on the labels following RETURN. The 'a' and 'b' labels in your query are for two individual vertices. The 'l' label is an edge label. Change your return statement to RETURN l should work.

答案3

得分: 0

在你的查询中,MATCH (a:Person)-[l:workWith]-(b:Person) RETURN a, l, b 。你正在返回 a,l 和 b。

这里,

a 是你的起始节点。

b 也是你的结束节点。

l 是你的边 edge workWith。

因为你正在返回 abl,所以你获取到了起始节点、边和结束节点。
如果你只返回 l,你将只获取边的信息。

为此,你的查询将被修改为,

MATCH (a:Person)-[l:workWith]-(b:Person) RETURN l

英文:

In your query MATCH (a:Person)-[l:workWith]-(b:Person) RETURN a, l, b .You are returning a , l and b.

Here,

a is your start node.

b is also your end node.

and l is your edge workWith.

As you are returning a , b and l . So you are getting start node, edge and end node.
If you return only l you will get only the information of edge.

For this your query will be modified as,

MATCH (a:Person)-[l:workWith]-(b:Person) RETURN l

答案4

得分: 0

只返回边而不是所有节点。另外,您可以避免使用变量来优化查询中不会被处理的节点。

MATCH (:Person)-[e:workWith]-(:Person) RETURN e

英文:

Return only the edges instead of all nodes. Additionally, you can avoid using variables for nodes that won't be processed to optimize the query.

 MATCH (:Person)-[e:workWith]-(:Person) RETURN e

huangapple
  • 本文由 发表于 2023年2月24日 04:40:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75550104.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定