Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[PGQL] Insert edges without duplicates

User_XF0S0Apr 19 2021

Is it possible to insert only one edge between every distinct pair of matched vertexes?
Consider the following simple graph:
(A)-[r1]->(B)-[r2]->(C)
(A)-[r3]->(D)-[r4]->(C)
I would like to insert an edge between nodes n1 and n2 that satisfy this match pattern (n1)->()->(n2) without duplication of edges. So in the example, I would like to insert only one edge between A and C even if the path A->C is matched two times evaluating the pattern.
Making an analogy to Cypher query language, is there a way of expressing “ON CREATE” and “ON MATCH” clauses in a “MATCH … MERGE … ON CREATE … ON UPDATE …” statement?

Studying pypgx interface, there exists the method simplify that removes duplicates edges. However it does not guarantee any control over the deletion procedure, it applies to the whole graph and it is unclear how it deals with oriented relations.

Comments
Post Details
Added on Apr 19 2021
2 comments
179 views