Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-15-2019 06:58 AM
I'm using the latest versions of neo4j desktop and database. I'm doing some development locally and using this query:
match (w:Well)
where w.operator is not null
with w.operator as well_o
merge (o:Operator {name: well_o})
set (o)-[:OPERATES]->(w)
return o, w
I'm getting this error:
Neo.ClientError.Statement.SyntaxError: Invalid input 'r': expected whitespace, comment, a relationship pattern or '.' (line 6, column 1 (offset: 129))
"return o, w"
^
If I run the first half of the query it creates the operator nodes no problem. Am I running too many operations in one go? I'm not quite sure what else it's expecting.
Solved! Go to Solution.
01-15-2019 07:40 AM
Brrr.. Poor me.
match (w:Well)
match (o:Operator)
where w.operator = o.name
MERGE (o)-[r:OPERATES]->(w)
return r
SET is for putting property or labels
Replace MERGE by MATCH if you don't want create the relationship.
01-15-2019 07:04 AM
Hi !
Must be:
{name: "well_o"}
With quotes.
01-15-2019 07:10 AM
Thanks for the reply, I appreciate the help but that did not work. I'm still getting the same error as before.
01-15-2019 07:23 AM
I was able to return the pairs I wanted to return with:
match (w:Well)
match (o:Operator)
where w.operator = o.name
return o, w
but if I try to set a relationship between them I get errors.
match (w:Well)
match (o:Operator)
where w.operator = o.name
set(o)-[r:OPERATES]->(w)
return r
01-15-2019 07:40 AM
Brrr.. Poor me.
match (w:Well)
match (o:Operator)
where w.operator = o.name
MERGE (o)-[r:OPERATES]->(w)
return r
SET is for putting property or labels
Replace MERGE by MATCH if you don't want create the relationship.
01-15-2019 07:43 AM
Ah, you just reminded me what I was really trying to do. You're a prince among men. Here's what I was really after, I just forgot exactly how.
match (w:Well)
match (o:Operator)
where w.operator = o.name
CREATE (o)-[r:OPERATES]->(w)
return r
I forgot to use Create vs. Merge and set. Thank you for your help.
09-11-2020 01:09 AM
CREATE p=(MATHI{name:"SRIMATHI"})-[r:topper_of]-[]->(TAMIL{name :"TAMILNADU"})-[]->[r:winner_of]-[*]->(cse{name:"ANNA UNIVERSITY IN CSE DEPT"})
RETURN p
i dont get whats the error
11-29-2020 04:43 AM
Remember, you need to be explicit when you'are creating nodes. Or you give some empty types for relationships ( --> and star (-[*]->).
09-11-2020 08:07 AM
Welcome Joyous,
Do you might adding what error your getting? It's difficult helping without knowing what you're getting.
All the sessions of the conference are now available online