How to make relationship between two nodes from different json file based on matching property value?


I'm using neo4j 4.3.2 version. I have two json files. I want to match and create relationship from first json to second json file based on the matching property between nodes from two json files. Please have look on the json file:

First Json as follows:


Second Json as follows:

"member": [
			"Authority": "xy",
			"Number": "999",
			"Code": "Z2",
			"Date": "1986-06-12",
			"publication": "123"

I want to match all nodes from first json which have property "id" value 123--->second json with all matching property "publication" value "123" and link them.

Below is code I have tried but , it shows "(no changes, no records)". What change i have make here in order to make it right. Hope for valuable suggestions.

Cypher query I have tried:
Load First Json

CALL apoc.load.json ("file:///D:/first.json") YIELD value AS data

Load Second Json

CALL apoc.load.json ("file:///D:/second.json") YIELD value AS data
FOREACH (idn IN data.member | MERGE(b:LabelB{Number:idn.Number})ON CREATE SET b.Publication=idn.Publication)

Tried to Match and create Relationship

create index on :LabelA(id);
create index on :LabelB(Publication);
MATCH (a:LabelA)
MATCH (b:LabelB)
WHERE b.Publication =
merge (a)-[:lin]->(b)	

It shows "(no changes, no records)"

Any suggestion would be great help.

Thank you

Try with this WHERE clause: In the first script the property of labelA is listed as 'A' and not 'id'

WHERE b.Publication = a.A

Thank you very much for your valuable suggestion. its really working now. :slight_smile: