0

Please see similar answer at : https://stackoverflow.com/a/14254214/1060044

I have a requirement where I have pattern like below:

MATCH (b:Label1{id:123})<--(Label2)<--(a:Label3) WHERE NOT (a)<--(Label4) return a;

I am getting syntax error with this query. Is there any efficient way to achieve this?

I am using neo4j community version 2.1.2

Community
  • 1
  • 1
Krishna Shetty
  • 1,361
  • 4
  • 18
  • 39

1 Answers1

1

When using labels in Cypher, you always have to use a colon : in front of them:

MATCH (b:Label1{id:123})<--(:Label2)<--(a:Label3) WHERE NOT (a)<--(:Label4) return a;

So from node 123 having label Label1 you follow a incoming relationship to a node with label Label2, to node a with label Label3 and you make sure that a is not connection with any node node labelled Label4.

Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97