I would like to create two types of nodes (CHEMICAL & DISEASE) and their relationships from Relation column. There could be 4 combinations (Source_CHEMICAL--Relation-->Target_CHEMICAL, Source_CHEMICAL--Relation-->Target_DISEASE,Source_DISEASE--Relation-->Target_CHEMICAL,Source_DISEASE--Relation-->Target_DISEASE)
id
SourceType_CHEMICAL
SourceType_DISEASE
Relation
TargetType_CHEMICAL
TargetType_DISEASE
1
cardiac myosin
induce
myocarditis
2
nitric
inhibit
chrysin
3
sesame peptide powder
exhibited
angiotensin
4
allergen
induce
hypersensitivity
5
leucoencephalopathy
caused
infection
I tried using below query, but it didn't work and gave an error for below line,
"MERGE(c1)-[:row.Relation]->(c2)"
Neo.ClientError.Statement.SyntaxError: Invalid input '.': expected
can someone help with this? Thanks
CREATE CONSTRAINT ON (n:CHEMICAL) ASSERT n.SourceType_CHEMICAL IS UNIQUE;
CREATE CONSTRAINT ON (n:CHEMICAL) ASSERT n.TargetType_CHEMICAL IS UNIQUE;
CREATE CONSTRAINT ON (n:DISEASE) ASSERT n.SourceType_DISEASE IS UNIQUE;
CREATE CONSTRAINT ON (n:DISEASE) ASSERT n.TargetType_DISEASE IS UNIQUE;
LOAD CSV WITH HEADERS FROM "file:///Chemical_Disease.csv" AS row
MERGE(c1:CHEMICAL{name:row.SourceType_CHEMICAL})
MERGE(c2:DISEASE{name:row.TargetType_DISEASE})
MERGE(c1)-[:row.Relation]->(c2)
MERGE(c3:CHEMICAL{name:row.SourceType_CHEMICAL})
MERGE(c4:CHEMICAL{name:row.TargetType_CHEMICAL})
MERGE(c3)-[:row.Relation]->(c4)
MERGE(c5):DISEASE{name:row.SourceType_DISEASE})
MERGE(c6:CHEMICAL{name:row.TargetType_CHEMICAL})
MERGE(c5)-[:row.Relation]->(c6)
MERGE(c7):DISEASE{name:row.SourceType_DISEASE})
MERGE(c8:DISEASE{name:row.TargetType_DISEASE})
MERGE(c7)-[:row.Relation]->(c8)
#cypher #query