我可以重写此 Cypher 查询以与 Redis Graph 兼容吗?

Can I rewrite this Cypher query to be compatible with Redis Graph?

我的用例是我在组织结构中有一些代理。我想select找一些代理人我可以)看总和(金额) 代理下属(及其下属的下属等...)与按合同类别分组的客户创建的所有合同。

问题是 Redis Graph do not currently support all 谓词。但我需要过滤代理之间的关系,因为我们有多个 "modules" 具有不同的组织结构,我当时只需要来自一个模块的报告。

我当前的 Cypher 查询是:

MATCH path = (:agent {id: 482})<-[:supervised *]-(b:agent)
    WHERE all(rel IN relationships(path) WHERE
        rel.module_id = 1
        AND rel.valid_from < '2020-05-29'
        AND '2020-05-29' < rel.valid_to)
WITH b as mediators
MATCH (mediators)-[:mediated]->(c:contract)
    RETURN
        c.category as category,
        count(c) as contract_count,
        sum(c.sum) as sum
    ORDER BY sum DESC, category

此查询适用于 Neo4j。

我不知道是否针对我想要的结果类型正确编写了此查询。

出于性能原因,我的老板真的很想使用 Redis Graph 而不是 Neo4j,但我找不到任何方法来重写此查询以使其在 Redis 图中发挥作用。有可能吗?

编辑 1: 有人告诉我,我们将仅针对当前有效数据和一个模块使用图形,因此我不再需要功能性 all 谓词,但是我仍然对答案感兴趣。

目前不支持 ALL 功能,我们确实打算在不久的将来添加它,实现与 ALL 功能相同效果的尴尬方式是UNWINDcount

的组合
MATCH path = (:agent {id: 482})<-[:supervised *]-(b:agent)
WITH b AS b, relationships(path) AS edges, size(relationships(path)) AS edge_count
UNWIND edges AS r
WITH b AS b, edge_count AS edge_count, r AS r
WHERE r.module_id = 1 AND r.valid_from < '2020-05-29' AND '2020-05-29' < r.valid_to
WITH b AS b, edge_count AS edge_count, count(r) AS filter_edge_count
WHERE edge_count = filter_edge_count
....