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

  • 语句 1
    • 场景:搜索所有包含某个字符串或字串的点或边
    • 具体语句:
    match (v) with properties(v) as props, keys(properties(v)) as kk, v limit 10000 where [i in kk where props[i] == “Tony Parker”] return v
    
    match ()-[e]->() with e, properties(e) as props, keys(properties(e)) as kk limit 10000 where [i in kk where props[i] == 90] return e
    
  • 语句 2
    • 场景:yield 返回多个标签的所有属性
    • 具体语句:
    fetch prop on * "vertex_id" yield properties(vertex);
    
  • 语句 3
    • 场景:如何筛选没有出边的点
    • 具体语句:
    MATCH p=(v1:company)-[*1..10]->(v2:company)-[:SHList]->(v3:person)
    WHERE id(v1)=="company1"
    RETURN v3.person.name, p
    
  • 语句 4
    • 场景:获取该子图中边缘的点(入度为 0 的点的集合)
    • 具体语句:
    #GO
     GET SUBGRAPH 10 steps FROM "Tim Duncan" IN EdgeType YIELD VERTICES AS nodes | yield $-.nodes[6]
    
    #MATCH
    MATCH (v)<-[:EdgeType*1..10]-(n) 
    WHERE id(v)=="vid" AND NOT (n)<-[:EdgeType]-()
    RETURN n
    
  • 语句 5
    • 场景:两个 MATCH 交并差计算之后如何统计数量
    • 具体语句:
    MATCH (n:player)
    RETURN n.player.name AS name
    UNION
    MATCH (n:team)
    RETURN n.team.name AS name
    
  • 语句 6
    • 场景:如何限制节点扩展的数量
    • 具体语句:
    nebula> GO 3 STEPS FROM "player100" \
          OVER * \
          YIELD properties($).name AS NAME, properties($).age AS Age \
          LIMIT [3,3,3];
    
1 个赞