Reputation: 5
I have a node called "COG1476" which has different relationships with other nodes but I would like to get only those relationships that have a score> = 700 and I would also like to get the graph.
MATCH (cog1 {name: 'COG1497'})-[rel:coexpression|cooccurence|database|experimental|fusion|neighborhood|score|textmining]->(cog2)
WHERE toInteger(rel.score)>=700, toInteger(rel.cooccurence)>=700, toInteger(rel.coexpression)>=700, toInteger(rel.database)>=700, toInteger(rel.experimental)>=700, toInteger(rel.fusion)>=700, toInteger(rel.neighborhood)>=700,toInteger(rel.textmining)>=700
RETURN cog1, cog2, rel.score>=700, rel.cooccurence>=700, rel.coexpression>=700, rel.fusion>=700, rel.database=700, rel.experimental>=700, rel.neighborhood>=700, rel.textmining>=700
Neo.ClientError.Statement.SyntaxError: Invalid input ',': expected 0..9, '.', 'e', 'E', an identifier character, whitespace, node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', '~', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, FROM GRAPH, CONSTRUCT, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE UNIQUE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, CALL, RETURN, UNION, ';' or end of input (line 2, column 32 (offset: 160))
"WHERE toInteger(rel.score)>=700, toInteger(rel.cooccurence)>=700, toInteger(rel.coexpression)>=700, toInteger(rel.database)>=700, toInteger(rel.experimental)>=700, toInteger(rel.fusion)>=700, toInteger(rel.neighborhood)>=700,toInteger(rel.textmining)>=700"
^
Upvotes: 0
Views: 36
Reputation: 2905
Based on your comments, I think two things are wrong:
WHERE
clause, which we fix by replacing the commas with OR
sFirst let's fix the query:
MATCH (cog1 {name: 'COG1497'})-[rel:coexpression|cooccurence|database|experimental|fusion|neighborhood|score|textmining]->(cog2)
WHERE toInteger(rel.score)>=700 OR toInteger(rel.cooccurence)>=700 OR toInteger(rel.coexpression)>=700 OR toInteger(rel.database)>=700 OR toInteger(rel.experimental)>=700 OR toInteger(rel.fusion)>=700 OR toInteger(rel.neighborhood)>=700 OR toInteger(rel.textmining)>=700
RETURN cog1, cog2, rel
That should return data and not blow up with an error. However, in the Browser you'll still see all the relationships between the nodes even though some of those relationships don't match our WHERE
clause - that's just the default behaviour of the Neo4j Browser when visualising a graph.
To fix that, hit the Settings cog icon at the bottom left of the screen and untick the checkbox marked 'Connect result nodes' at the end of the configuration options. You'll now only see connections between nodes that you've explicitly selected - you may want to toggle this back on after you're done.
You can also check your results by using the Table view, which will show only those relationships that matched the criteria in your WHERE clause.
Upvotes: 1