Currently I use the following Cypher / APOC query to search the relationship type TO
by a certain property (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;
I want to make it posible to not only search the index TO
but also the index AT
(AT
type of relationships), so that the resulting rel
parameter contains both TO
and AT
relationships.
I would imagine it would be something as simple as adding an OR
operator, like this:
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;
But it doesn't work...
Maybe there's somethign I could do that I get the rel
s from these two apoc
s and then simply conflate them together into one rel
but I don't really get how to do that... Or maybe there's an easier way I don't see?