谓词函数

    Nebula Graph支持以下谓词函数。

    如果列表为空,或者列表中的所有元素都为空,则返回NULL。

    在 openCypher 中只定义了函数exists(),其他几个函数依赖于具体实现。

    示例

    1. nebula> RETURN any(n IN [1, 2, 3, 4, 5, NULL] \
    2. WHERE n > 2) AS r;
    3. +------+
    4. | r |
    5. +------+
    6. | true |
    7. +------+
    8. nebula> RETURN single(n IN range(1, 5) \
    9. WHERE n == 3) AS r;
    10. +------+
    11. | r |
    12. +------+
    13. | true |
    14. +------+
    15. nebula> RETURN none(n IN range(1, 3) \
    16. WHERE n == 0) AS r;
    17. +------+
    18. | r |
    19. +------+
    20. | true |
    21. nebula> WITH [1, 2, 3, 4, 5, NULL] AS a \
    22. RETURN any(n IN a WHERE n > 2);
    23. +-------------------------+
    24. | any(n IN a WHERE (n>2)) |
    25. +-------------------------+
    26. | true |
    27. +-------------------------+
    28. nebula> MATCH p = (n:player{name:"LeBron James"})<-[:follow]-(m) \
    29. RETURN nodes(p)[0].name AS n1, nodes(p)[1].name AS n2, \
    30. all(n IN nodes(p) WHERE n.name NOT STARTS WITH "D") AS b;
    31. +----------------+-------------------+-------+
    32. | n1 | n2 | b |
    33. +----------------+-------------------+-------+
    34. | "LeBron James" | "Danny Green" | false |
    35. | "LeBron James" | "Dejounte Murray" | false |
    36. | "LeBron James" | "Chris Paul" | true |
    37. | "LeBron James" | "Kyrie Irving" | true |
    38. | "LeBron James" | "Carmelo Anthony" | true |
    39. | "LeBron James" | "Dwyane Wade" | false |
    40. nebula> MATCH p = (n:player{name:"LeBron James"})-[:follow]->(m) \
    41. +------+
    42. | b |
    43. +------+
    44. | true |
    45. +------+
    46. nebula> MATCH (n:player) \
    47. RETURN exists(n.id), n IS NOT NULL;
    48. +--------------+---------------+
    49. | exists(n.id) | n IS NOT NULL |
    50. +--------------+---------------+
    51. | false | true |
    52. +--------------+---------------+
    53. ...
    54. nebula> MATCH (n:player) \
    55. WHERE exists(n['name']) \
    56. RETURN n;
    57. +---------------------------------------------------------------+
    58. | n |
    59. +---------------------------------------------------------------+
    60. | ("player105" :player{age: 31, name: "Danny Green"}) |
    61. | ("player109" :player{age: 34, name: "Tiago Splitter"}) |
    62. | ("player111" :player{age: 38, name: "David West"}) |