- 语句 1
- 场景:nGQL 中同 SQL 的 Having 类似的操作
- 具体语句:
LOOKUP ON ip YIELD id(vertex) as id | GO FROM $-.id over activeIn REVERSELY WHERE head(labels($)) == 'equipment' YIELD id($) as dst, id($^) as src | GO FROM $-.dst over login REVERSELY WHERE head(labels($)) == 'account' YIELD id($) as dst, id($^) as src |GROUP BY $-.src YIELD $-.src as src,count($-.src) as degree | YIELD $-.src as src where $-.degree > $p0 | GO FROM $-.src over login REVERSELY YIELD properties($).accountUuid as accountUuid
- 适合版本:v3.3.0
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/11125
- 语句 2
- 场景:根据边的终点,找寻该点下的所有边
- 具体语句:
go from "dst ip" over url_ip REVERSELY yield id($) as url | go from $-.url over * yield type(edge) as et, edge as e
- 适合版本:v2.x 和 v3.x
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/10864
- 语句 3
- 场景:同一类型的边,保留 rank 最大、最小值的边
- 具体语句:
match (v1:player)-[e:serve]->(v2:team) with max(rank(e)) as max_rank match (v3:player)-[e2:serve]->(v4:team) where rank(e2) == max_rank return count(e2);
- 适合版本:v2.x 和 v3.x
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/10843
2 个赞