I had created two group of nodes in graph using the following cypher query
pharma group
CREATE ( p1:pharma { name: " Magnesium ", id: " 12 " } )
CREATE ( p2:pharma { name: " Hyoscine Butylbromide ", id: " 22 " } )
CREATE ( p3:pharma { name: " Propantheline Bromide ", id: " 23 ", } );
ind group
CREATE ( i1:ind { id: '1', name: 'Dyspepsia', pdfk: '12'})
CREATE ( i2:ind { id: '5', name: 'Symptomic relief of intestinal disorder', pdfk: '22'})
CREATE ( i3:ind { id: '6', name: 'Symptomic relief of disorder', pdfk: '22'})
CREATE ( i4:ind { id: '7', name: 'Bowel colic', review: 'False', pdfk: '23'});
its just like relational database tabels, Now I want to define relation ship between these two group of nodes..
relationship like = node in pharma with id 12 has a relationship name HAS_IND with node in ind with id 1 ?
somewhere like this
MATCH (a:pharma),(b:ind)
WHERE a.id = '12' AND b.id = '1'
CREATE (a)-[:has_ind]->(b);
I tried these too
MATCH (a:pharmaDrug),(b:indication)
WHERE a.name = 'Magnesium Carbonate' AND b.name = 'Dyspepsia'
CREATE (a)-[:has_indication]->(b);
but both are giving Returned 0 rows in 530 ms in the console ?
Please help me to find the correct cypher query for this purpose. Thanks in advance.
========================================================================
My changes are as follows
CREATE ( p1:pharma { name: "Magnesium", id: 12 } )
CREATE ( p2:pharma { name: "Hyoscine Butylbromide", id: 22 } )
CREATE ( p3:pharma { name: "Propantheline Bromide", id: 23 } );
CREATE ( i1:ind { id: 1, name: 'Dyspepsia', pdfk: '12'})
CREATE ( i2:ind { id: 5, name: 'Symptomic relief of intestinal disorder', pdfk: '22'})
CREATE ( i3:ind { id: 6, name: 'Symptomic relief of disorder', pdfk: '22'})
CREATE ( i4:ind { id: 7, name: 'Bowel colic', review: 'False', pdfk: '23'});
this create nodes under two labels
MATCH (a:pharma),(b:ind)
WHERE a.id = ' 12 ' AND b.id = ' 1 '
CREATE (a)-[:has_indication]->(b);
this give zero rows affected with no output ?