SHOW QUERY,这里有社区用户常用的 nGQL 查询语句

  • 语句 1
    • 场景:如何合并两个子图
    • 具体语句:
    get subgraph 5 step from pod in have,belong yield vertices as nodes, edges as relationshiops
    union all
    get subgraph 5 step from pod out have,belong yield vertices as nodes, edges as relationshiops
    
  • 语句 2
    • 场景:自定义排序规则
    • 具体语句:
    MATCH (a)-[e1]->(b)-[e2]->(c)
    WITH e1.cost+e2.cost as cost, c ORDER BY cost
    RETURN c
    
  • 语句 3
    • 场景:一跳,返回这个点的所有连接到的点,然后这个连接到的点, 进行一个分组限制每种类型只返回10个,然后每种类型的10个点进行二跳
    • 具体语句:
    MATCH (a)-[b]->(c) where id(a)="*****"
    WITH labels(c) AS ctype, collect(distinct c)[0..10] AS c_with_same_type
    UNWIND c_with_same_type AS cc
    OPTIONAL MATCH (cc)-[d]->(e) 
    RETURN cc, d, e
    
1 个赞