- 语句 1
- 场景:删除某个 tag 类型点,或者某个类型边
- 具体语句:
lookup on A yield id(vertex) as vid | delete vertex $-.vid lookup on E yield E._src as src,E._dst as dst|delete edge E $-.src->$-.dst
- 适合版本:v2.x 和 v3.x
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/10548
- 语句 2
- 场景:边属性比较
- 具体语句:
MATCH (v:player)-[e:follow]-(v2) WHERE id(v) == 'player100' AND e.degree > 85 RETURN v2.player.name, e.degree;
- 适合版本:v2.x 和 v3.x
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/10721
- 语句 3
- 场景:筛选特定出入度的点
- 具体语句:以出度为 2 为例
#大于等于 2 MATCH (:房间)<-[:入住]-(v:人)-[:入住]->(:房间) RETURN distinct v #大于 2 MATCH (v:人)-[:入住]->(:房间) where size((v)-[:入住]->())>2 RETURN distinct v
- 适合版本:v2.x 和 v3.x
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/10352/5
- 语句 4
- 场景:查询某个 vertex 为终点的路径
- 具体语句:
MATCH p=(v)-[*1..10]-(m) where id(v)=="host001" and all( midNode in [n in nodes(p) where id(n)<>id(v) | n] where "frontPort" not in tags(midNode)) RETURN p
- 适合版本:v3.x
- 语句出处:https://discuss.nebula-graph.com.cn/t/topic/10528/4
1 个赞