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

  • 语句 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
    
  • 语句 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
    
  • 语句 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);
    
2 个赞