cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax error in Neo4j query which I cannot understand

ag2022
Node Link

I am new to Cypher query , I am trying to fetch the details of a product which does not have a relationship attached to it. I am attaching the image of the graph query and giving it a red border along with the error it throws.Screenshot from 2022-11-01 16-02-26.png

 

 

1 ACCEPTED SOLUTION

glilienfield
Ninja
Ninja

 You don't have a full match pattern in your 'where' clause. I will assume you don't want the 'product' not to be related to any node via an the listed relationship types. Try this:

match (n:SHIPMENT{uuid: 'replace with uuid'})-[:SHIPS]->(product:PRODUCT_LOT_1)
where not exists ( (product)-[:ADJUST|PICKS|WAS_ADJUST]-() ) 
and product.initial_qty = product.lot_quantity
return product.uuid as product_uuid

View solution in original post

4 REPLIES 4

glilienfield
Ninja
Ninja

 You don't have a full match pattern in your 'where' clause. I will assume you don't want the 'product' not to be related to any node via an the listed relationship types. Try this:

match (n:SHIPMENT{uuid: 'replace with uuid'})-[:SHIPS]->(product:PRODUCT_LOT_1)
where not exists ( (product)-[:ADJUST|PICKS|WAS_ADJUST]-() ) 
and product.initial_qty = product.lot_quantity
return product.uuid as product_uuid

ag2022
Node Link

Thanks, it works. But could you please explain why is there a blank () after the relationship tags. What does that blank () signify? @glilienfield 

glilienfield
Ninja
Ninja

It means to match to any node, regardless of labels and properties. I figured that would work in your case since you explicitly specified the relationship types.  

ag2022
Node Link

Okay thanks for explaining @glilienfield