在AGE中,是否有一种方法可以查询单个列中的顶点和边缘?

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

Is there a way to query for vertices and edges in a single column in AGE?

问题

假设我希望所有顶点和边(以及路径)都列在单个列中,按它们的类型排序,这是可能的吗?

文档中没有提到这一点,尽管它在orderability中提到了边、路径、顶点、地图?

可能的查询是什么?

编辑:
这是我寻找的输出的一部分

在AGE中,是否有一种方法可以查询单个列中的顶点和边缘?

它清楚地显示了路径、边和顶点之间的可排序性,然而,这仅适用于它们以不同顶点的属性形式存储的情况。

是否可能在单个列中查询所有路径、顶点和边?

英文:

Suppose that I want all vertices and edges (and paths) to be listed in a single column, ordered by their type, is it a possibility?

The documentation does not say anything about that even though it does mention edge, path, vertex, map in orderability?

What could be a possible query to achieve this?

EDIT:
This is somewhat of an output I am looking for

在AGE中,是否有一种方法可以查询单个列中的顶点和边缘?

It clearly displays the orderability between Path, edge, and vertex, however, this only works because they are stored in the form of a property of different vertices.

Is it possible to query for all paths, vertices, edges like this in a single column?

答案1

得分: 1

要获取单列中的顶点和边,您可以尝试类似以下的查询:

SELECT * FROM cypher('graph', $$
MATCH (n)-[e]->(m)
RETURN [n, e, m]
$$) AS (result agtype);

这将返回一个列表,其中包含构成关系的起始顶点、边和结束顶点。

如果您需要一个路径,则以下查询将起作用:

SELECT * FROM cypher('graph', $$
MATCH p = (n)-[e]->(m)
RETURN p        
$$) AS (result agtype);
英文:

To get the vertices, edge in a single column you can try something like:

SELECT * FROM cypher('graph', $$
MATCH (n)-[e]->(m)
RETURN [n, e, m]
$$) AS (result agtype);

This will return a list consisting of start vertex, edge, end vertex that make a relationship

In case you need a path, then the following query would work

SELECT * FROM cypher('graph', $$
MATCH p = (n)-[e]->(m)
RETURN p        
$$) AS (result agtype);

答案2

得分: 0

你可以取所有顶点和边的并集。添加一个额外的列来指示它是顶点还是边。然后可以使用这个额外的列进行排序。

英文:

You can take the union of a list of all the vertices and edges. Add an extra column that tells if it is a vertex or an edge. Then it can be ordered using the extra column.

答案3

得分: 0

你可以简单地查询路径,因为路径包含了顶点和它们之间的边。可以通过以下查询实现:

SELECT * FROM cypher('graphname', $$
MATCH p= (n1)-[r]->(n2)
RETURN p
$$) AS (outcome agtype);
英文:

You can simply query for paths since a path contains vertices and edges between them. This can be achieved with the query below:

SELECT * FROM cypher('graphname', $$
MATCH p= (n1)-[r]->(n2)
RETURN p
$$) AS (outcome agtype);

答案4

得分: 0

你可以使用这个查询来获取所有顶点和边。

SELECT * FROM cypher ('orderability_graph', $$
MATCH p = ()-[]-()
RETURN p
$$) AS (sorted agtype);

这个查询将显示一个由所有顶点和边组成的路径。

英文:

You could query for the all vertices and edges by using this query.

SELECT * FROM cypher ('orderability_graph', $$
MATCH p = ()-[]-()
RETURN p
$$) AS (sorted agtype);

This query will display a path consisting of all vertices and edges.

答案5

得分: 0

你可以使用这个查询来显示所有可用的边和顶点。

选择 * from cypher ('orderability_graph',$$ MATCH graph=(node1)-[rel]-(node2) Return graph $$) as (sorted agtype);

英文:

you can use this query to display all available edges and vertices

Select * from cypher ('orderability_graph',$$ MATCH graph=(node1)-[rel]-(node2) Return graph $$) as (sorted agtype);

huangapple
  • 本文由 发表于 2023年6月28日 23:54:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76574850.html
匿名

发表评论

匿名网友

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

确定