0
votes

I am trying to filter the graph with a relation attribute but I every time I do so, I get the graph with duplicated relations. To illustrate, I have the following query:

MATCH p=(j:JOB {job_id:138})-->(S:URL)-[r]->(T)
WHERE r.job_id=138 And s.netloc <> t.netloc
RETURN s,r,t

here I am trying to get all nodes and relation between S and T where node S is related to specific job. I am also trying to only SHOW the relations that has the attribute job_id == 138 because there are multiple relations r but only ONE relation has this attribute.

Every time I execute the query I keep getting all the relation as if I didn't have the WHERE clause.

I also tried it in the query in this way

MATCH p=(j:JOB {job_id:138})-->(S:URL)-[r:VISITED {job_id:138} ]->(T)
WHERE S.netloc <> T.netloc
RETURN S,r,T

However, I keep getting the same graph where I have multiple relations. Interestingly enough, when I look into the row view I only see the correct relations r. The ones that have job_id=138 only. Is this kind of a bug or something ???

1
What version of Neo4j are you using? - ceej
@ceej neo4j 2.2 latest ... - I.el-sayed
And you say that it is only the graph view in which you see the unwanted relationships? Have you got Auto-Complete on? This would automatically populate all relationships between the nodes S and T... - ceej

1 Answers

2
votes

Neo4j 2.2 includes various improvements, including some to the query pane in the Neo4j browser. One of these is auto-complete. This is controlled by way of a little slider switch at the bottom of the Graph pane. This does what it says: do you want to Auto-complete your graph, yes or no. It allows you to switch the browser from either showing ALL of the relationships between the subgraph in the resultset, or only showing those that you explicitly included in your “RETURN” statement.

In my experience, this is on by default and so would explain why you are seeing results that you do not expect in the 'graph' view, whilst the results in the 'rows' view is as expected. Switch it off by moving the slider to Off.