基于 where not in 的密码过滤关系
cypher filter relationship based on where not in
g.V().
hasLabel('Entity1').
has('name', within('BB', 'CC')).
in('Entity2').
where(
not(
__.out('Entity3').
__.out('Entity4').
has('name', within('ABC', 'XYZ')).
in('Entity5'))).
in('Entity6')
过滤节点,其中 entity3 与 ['ABC','XYZ']
中名称的 entity4 没有连接
以下密码查询有语法错误
MATCH(e1:Entity1{name:$name})<-[:Entity2]-()-[:Entity3]->(oEntity3)
where Not (oEntity3)-[:Entity4]->(oEntity4)
AND oEntity4 in ['ABC','XYZ']
MATCH
(e1:Entity1)<-[:Entity2]-(e2),
(e2)-[:Entity3]->()-[:Entity4]->(e4),
(e4)<-[:Entity5]-(e5)
WHERE
NOT e4.name in ["ABC","XYZ"]
AND e1.name in ["BB", "CC"]
WITH e2 as entity2
MATCH (entity2)<-[:Entity6]-(entity6)
RETURN entity6
我认为您在查询中错过了过滤 e1.name
,最初发布在问题中。
g.V().
hasLabel('Entity1').
has('name', within('BB', 'CC')).
in('Entity2').
where(
not(
__.out('Entity3').
__.out('Entity4').
has('name', within('ABC', 'XYZ')).
in('Entity5'))).
in('Entity6')
过滤节点,其中 entity3 与 ['ABC','XYZ']
中名称的 entity4 没有连接以下密码查询有语法错误
MATCH(e1:Entity1{name:$name})<-[:Entity2]-()-[:Entity3]->(oEntity3)
where Not (oEntity3)-[:Entity4]->(oEntity4)
AND oEntity4 in ['ABC','XYZ']
MATCH
(e1:Entity1)<-[:Entity2]-(e2),
(e2)-[:Entity3]->()-[:Entity4]->(e4),
(e4)<-[:Entity5]-(e5)
WHERE
NOT e4.name in ["ABC","XYZ"]
AND e1.name in ["BB", "CC"]
WITH e2 as entity2
MATCH (entity2)<-[:Entity6]-(entity6)
RETURN entity6
我认为您在查询中错过了过滤 e1.name
,最初发布在问题中。