1

For the below cypher query, I am getting an error

Cypher Query tried:

match (n:attribAct) where not tolower(n.Aliases) contains tolower(n.name) set n.Aliases = n.name+","+n.Aliases as x return x;

Error:

Invalid input 's': expected 'n/N' (line 1, column 115 (offset: 114))
"match (n:attribAct) where not tolower(n.Aliases) contains tolower(n.name) set n.Aliases = n.name+","+n.Aliases as x return x;"

How could I fix this problem? Thank you so much!

Tono Kuriakose
  • 718
  • 6
  • 19

2 Answers2

0

As @BurakSerdar said, the SET command does not need an alias.

Your code:

match (n:attribAct)
where not tolower(n.Aliases) contains tolower(n.name)
set n.Aliases = n.name+","+n.Aliases as x
return x;

FIX:

match (n:attribAct) 
where not tolower(n.Aliases) contains tolower(n.name) 
set n.Aliases = n.name+","+n.Aliases 
return n;
jose_bacoy
  • 12,227
  • 1
  • 20
  • 38
0

The AS keyword can only be used in WITH and RETURN clauses.

You can return n this way:

MATCH (n:attribAct) 
WHERE NOT TOLOWER(n.Aliases) CONTAINS TOLOWER(n.name) 
SET n.Aliases = n.name + "," + n.Aliases 
RETURN n;

By the way, if n.Aliases was actually a list of strings (instead of a comma-delimited string), this would work:

MATCH (n:attribAct) 
WHERE NONE(a in n.Aliases WHERE TOLOWER(a) = TOLOWER(n.name)) 
SET n.Aliases = n.Aliases + n.name
RETURN n;
cybersam
  • 63,203
  • 6
  • 53
  • 76