agensgraph icon indicating copy to clipboard operation
agensgraph copied to clipboard

ERROR: only one relationship type is allowed for MERGE

Open VinACE opened this issue 6 years ago • 4 comments

MATCH (mc: mat_comp) MATCH (p:plant) MATCH (mb: material) WHERE mc.component = mb.material and mc.plant=p.b_plant MERGE (mc) <- [ comp_2_p] - ( p) ; ERROR: only one relationship type is allowed for MERGE

What mistake I am doing... because mc and plant has plant as common mater mat_comp has material column plant column

p: plant mb: material colum

MATCH (mc: mat_comp) MATCH (p:plant) MATCH (mb: material) WHERE mc.comp = mb.material and mc.plant=p.b_plant RETURN mc.comp, mb.material, mc.plant, p.b_plant; comp | material | plant | b_plant ------------+------------+-------+-------------- "10" | "10" | "33" | "33"

=# \d material material | character varying(50) | | | | b_plant | character varying(50) |

=# \d mat_comp material | character varying(50) | | | | comp | character varying(50) | | | | plant | character varying(50) | | | |

-# \d plant --------------+-----------------------+-----------+----------+---------+------------- b_plant | character varying(50) |

VinACE avatar Aug 24 '18 15:08 VinACE

Hi @VinACE

If 'comp_2_p' is an edge label, you can fix it by putting a semicolon on the edge.

htlim avatar Aug 27 '18 05:08 htlim

No that didn't

MATCH (mc: mat_comp) MATCH (p:plant) MATCH (mb: material) WHERE mc.component = mb.material and mc.plant=p.b_plant MERGE (mc) <- [ :comp_2_plant] - ( p); GRAPH WRITE (INSERT VERTEX 0, INSERT EDGE 0)

It didn't insert any edges... Is this related to hyperedge cases. https://markhneedham.com/blog/2013/10/22/neo4j-modelling-hyper-edges-in-a-property-graph/

VinACE avatar Aug 27 '18 08:08 VinACE

MATCH (mc: mat_comp)
MATCH (p:plant)
MATCH (mb: material)
WHERE mc.component = mb.material and mc.plant=p.b_plant
WITH count(mc) as c WITH c, count(mb) as b return b,c 

What's you get ?

ontologiae avatar Sep 02 '18 12:09 ontologiae

I will take some time to replicate the same, Thanks for your reply

VinACE avatar Sep 06 '18 06:09 VinACE