Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 653: add support for merging virtual nodes / rels #134

Closed
wants to merge 5 commits into from
Closed

Conversation

vga91
Copy link
Owner

@vga91 vga91 commented Sep 22, 2021

Added CALL apoc.merge.vNodes(...) and CALL apoc.merge.vRelationships(...)


Resolve the Issue 1615 as well.
This one, cannot be solved by creating virtual entities in fabric subquery, because after that, throws an exception (Node with id (-number) not found).
I think because there is some native problem with the subquery, indeed executing the following query return an empty map:

UNWIND fabric.graphIds() AS graphId
CALL {
USE fabric.graph(x)
MATCH (m:Movie {title: 'The Matrix'})
RETURN m
}
RETURN properties(m)

so we can execute this query:

UNWIND fabric.graphIds() AS graphId
CALL {
USE fabric.graph(graphId)
MATCH g = (m:Movie {title: 'The Matrix'})<-[r]-(p:Person)
return labels(m) as lbl_movie, properties(m) as props_movie,
labels(p) as lbl_person, properties(p) as props_person,
type(r) as type_r, properties(r) as props_r
}
WITH apoc.create.vNode(lbl_movie, props_movie) as mV, 
    apoc.create.vNode(lbl_person, props_person) as pV, type_r, props_r // v nodes creation
WITH apoc.merge.vNodes(mV)[0] as start, collect([type_r, props_r, pV]) AS rows // merge movie v node
UNWIND rows as row
RETURN start, apoc.create.vRelationship(start, row[0], row[1], row[2]) as rel, row[2] as end// v rel creation

@vga91 vga91 changed the base branch from 4.3 to 4.2 September 28, 2021 10:18
@vga91 vga91 changed the base branch from 4.2 to 4.3 September 28, 2021 10:18
@vga91 vga91 changed the base branch from 4.3 to 4.2 September 28, 2021 10:21
@vga91 vga91 changed the base branch from 4.2 to 4.3 September 28, 2021 10:21
@vga91 vga91 changed the base branch from 4.3 to 4.2 September 29, 2021 07:33
@vga91 vga91 changed the base branch from 4.2 to 4.3 September 29, 2021 07:33
@vga91 vga91 changed the title WIP issue 653 Issue 653: add support for merging virtual nodes / rels Sep 29, 2021
@conker84
Copy link

Questa dobbiamo provarla con una aggregate function

@vga91 vga91 marked this pull request as draft February 27, 2024 09:16
@vga91 vga91 closed this Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants