bitnine-oss / agensgraph

AgensGraph, a transactional graph database based on PostgreSQL
http://www.agensgraph.org
Other
1.34k stars 149 forks source link

ERROR: only one relationship type is allowed for MERGE #425

Open VinACE opened 6 years ago

VinACE commented 6 years ago

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) |

htlim commented 6 years ago

Hi @VinACE

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

VinACE commented 6 years ago

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/

ontologiae commented 6 years ago
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 ?

VinACE commented 6 years ago

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