目前我使用以下 Cypher / APOC 查询TO
通过某个属性(user
id )搜索关系类型:
CALL apoc.index.relationships('TO','user:16c01100-aa92-11e3-a3f6-35e25c9775ff') YIELD rel, start, end
WITH DISTINCT rel, start, end
MATCH (ctx:Context)
WHERE rel.context = ctx.uid
ETURN DISTINCT start.uid AS source_id,
start.name AS source_name,
end.uid AS target_id,
end.name AS target_name,
rel.uid AS edge_id,
ctx.name AS context_name,
rel.statement AS statement_id,
rel.weight AS weight;
我希望不仅可以搜索索引TO
,还可以搜索索引AT
(AT
关系类型),以便生成的rel
参数同时包含TO
和AT
关系。
我想这就像添加一个OR
运算符一样简单,如下所示:
CALL apoc.index.relationships('TO','user:16c01100-aa92-11e3-a3f6-35e25c9775ff') OR
apoc.index.relationships('AT','user:16c01100-aa92-11e3-a3f6-35e25c9775ff') YIELD rel, start, end
WITH DISTINCT rel, start, end
MATCH (ctx:Context)
WHERE rel.context = ctx.uid
RETURN DISTINCT start.uid AS source_id,
start.name AS source_name,
end.uid AS target_id,
end.name AS target_name,
rel.uid AS edge_id,
ctx.name AS context_name,
rel.statement AS statement_id,
rel.weight AS weight;
但它不起作用...
也许我可以做一些事情,我rel
从这两个apoc
s 中获取 s,然后简单地将它们合并为一个rel
,但我真的不知道如何做到这一点......或者也许有一种更简单的方法我没有看到?