My Cypher query was:
MATCH p=(a:AbstractEvent)-[r:NEXT]->(c:AbstractEvent)
WHERE NOT id(a) in [115]
RETURN p
But the result still includes the 115 "Customer" node's outgoing relationship to "UI.Click" node. To make it clear, I still need the 115 "Customer" node, but without those outgoing relationships.
How to exclude all the outgoing relationship of a node when MATCH?
And btw, what's the difference between RETURN p
and RETURN a,r,c
in this example?
Any help would be appreciated, thanks.
CodePudding user response:
In Neo4j Browser setting, the 'Connect result nodes' option is enabled by default. All relationships between the nodes matched in your query will be displayed with this enabled, even if you haven't explicitly mentioned that path/pattern/relationship in your query.
You can find this option in the Browser Settings, available in the bottom left corner of your Neo4j Browser.
Adjust the Graph Visualization settings in the Browser Settings drawer
With this option enabled, RETURN p
, RETURN a,r,c
and RETURN a,c
will all show the same graph output.
But if you disable the 'Connect result nodes' option, the result graph will only include relationships that you specify in the Return statement.RETURN p
, RETURN a,r,c
will fetch the entire path but RETURN a,c
will only fetch the nodes.
CodePudding user response:
Neo4j UI option called 'Graph' will present you all the relationships between the selected nodes, regardless of the relationships returned from your query. So if node 115 is returned (as c), you will see all its relationships with other returned nodes. If you want to check your "real" query result, use 'Table', 'Text' or 'Code', options on the top left. Not 'Graph'.