13subquery.mql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. -- ============================================================
  2. -- Cypher 子查询测试
  3. -- ============================================================
  4. -- 1. Cypher 子查询 - where in match (已知解析器不支持 CypherCtrl 级别的 where + 子查询)
  5. match (a:test_graph) -[:connect]-> (b:test_graph) where a.g_name in (match (n:test_graph) where n.g_type='type_a' return n.g_name) return a, b
  6. /**
  7. onerror(continue,'expected [')
  8. output()
  9. **/
  10. ;
  11. -- 2. Cypher 嵌套子查询 (已知服务端单节点cypher不支持)
  12. match (a:test_graph) where a.g_value = (match (n:test_graph) where n.g_name='node_c' return max(n.g_value)) return a.g_name, a.g_type, a.g_value
  13. /**
  14. onerror(continue,'unsupport single node','expected')
  15. output()
  16. **/
  17. ;
  18. -- 3. Cypher 聚合子查询 (已知服务端单节点cypher不支持)
  19. match (a:test_graph) where a.g_type='type_a' return a.g_type, count(*)
  20. /**
  21. onerror(continue,'expected','After')
  22. output()
  23. **/
  24. ;
  25. -- 4. Cypher 带 limit 的子查询 (已知服务端单节点cypher不支持)
  26. match (a:test_graph) return a.g_name, a.g_type, a.g_value limit 3
  27. /**
  28. onerror(continue,'expected','After')
  29. output()
  30. **/
  31. ;