cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Match doesn't work

Image -1

vence_andersen1_0-1661513342187.png

Image -2

vence_andersen1_1-1661513370247.png

Image -3

vence_andersen1_2-1661513388666.png

With reference to the above 3 images, all the 3 images have the same query but in the first 2 images we have a match query commented and we are getting the output. The problem is in 3rd image, when I match both suggestion and steps I am not getting the output, can someone explain what's the problem here.

 

Thanks in advance.

1 ACCEPTED SOLUTION

You should execute the 'load csv' and return 'line' without the match to make sure the data lines up between 'Suggestions' and 'Steps' to ensure you should have matches for both concurrently. When its done separately, you may be getting output from different lines, but you don't have matches for both one each line. Just a thought, because the syntax looks good.

View solution in original post

14 REPLIES 14

@vence_andersen1 

For the 3rd query after the 1st match add a 

with line

 

 

 

Hie, thanks for your reply but it doesn't work. I used "with line" at line 2 and 3, still getting nothing.

vence_andersen1_0-1661517420860.png

 

Can you try OPTIONAL MATCH for the second MATCH?

Hi, thanks for your reply, well on using OPTIONAL MATCH 

vence_andersen1_0-1661518199546.png

Although p is returning null, it has values

vence_andersen1_1-1661518297963.png

 

You should add OPTIONAL on both MATCH I guess and check if the nodes exists with properties you got from your CSV.

I did try OPTIONAL MATCH for both, using "WITH" and without it and got the same below output.

vence_andersen1_0-1661519690234.png

If the nodes have properties? The below snaps are taken after querying using the queries from Image -1 and Image -2 (beginning of the thread) like without matching steps and suggestions simultaneously.

vence_andersen1_1-1661519782642.png

vence_andersen1_2-1661519830241.png

 

You added an "s" to Suggestion and Step whereas there are no "s" on your nodes properties.

Hie, yeah that's the first thing I checked, well below is a snap from the CSV.

vence_andersen1_0-1661525139026.png

If what you mentioned is the issue, we shouldn't be seeing outputs even when I don't match steps and suggestions simultaneously, but I am getting output when I match only one at a time. 

You should execute the 'load csv' and return 'line' without the match to make sure the data lines up between 'Suggestions' and 'Steps' to ensure you should have matches for both concurrently. When its done separately, you may be getting output from different lines, but you don't have matches for both one each line. Just a thought, because the syntax looks good.

Or, add 'linenumber() AS number' to your output and run the query with the commented out matches to see if the line numbers are aligned. 

But I don't get how this impacts the KG from showing the output, as I just wanted those output which matches. Thanks a lot anyways.

Knowledge Graph.

Is the intent to use this file to create the data?  If so, switch your matches to merges and the missing data will be created and you can continue with your script.