12match.mql 887 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. -- ============================================================
  2. -- Cypher match 查询测试
  3. -- ============================================================
  4. -- 1. match 所有节点
  5. match (n:test_graph) return n
  6. /**
  7. output()
  8. **/
  9. ;
  10. -- 2. match 带属性过滤
  11. match (n:test_graph) where n.g_value > 25 return n
  12. /**
  13. output()
  14. **/
  15. ;
  16. -- 3. match 多条件
  17. match (n:test_graph) where n.g_type='type_a' and n.g_value>=10 return n
  18. /**
  19. output()
  20. **/
  21. ;
  22. -- 4. match 关系路径
  23. match (a:test_graph) -[:connect]-> (b:test_graph) return a, b
  24. /**
  25. output()
  26. **/
  27. ;
  28. -- 5. match 带关系方向
  29. match (a:test_graph) -[:connect]-> (b:test_graph) where a.g_name='node_a' return a, b
  30. /**
  31. output()
  32. **/
  33. ;
  34. -- 6. match 无关系节点
  35. match (n:test_graph) where n.g_name='node_e' return n
  36. /**
  37. output()
  38. **/
  39. ;
  40. -- 7. match 返回特定字段
  41. match (n:test_graph) return n.g_name, n.g_value
  42. /**
  43. output()
  44. **/
  45. ;