Virtual relationships between Real Node and Virtual Node from CSV file

Hi,

I'm struggling in creating a virtual relationship between 1 real node (let's call it "R") and 1 virtual node ("V").

I successfully created V. What I aim to do now is to establish a virtual relationship between R and V based on a given mapping stored on a CSV file.

For example: let's suppose I create V, which has 3 instances (V1, V2, V2). I want to create virtual relationships with 3 instances of R (R1, R2, R3). That V1 should be linked to R1, V2 with R2, and V3 with R3 is stored in the CSV file.

What follows is the final part of the query I tried to run to create virtual relationships:

with R, V
call  apoc.create.vRelationship(V, 'has_rel', {R:row.rel_with_V},V) yield rel
RETURN
R, V, has_rel

I guess this query is completely wrong as it misses a reference to the CSV file, but hope it may help as a starting point.

Thanks a lot!

Hello @francesco.villa1994 :slight_smile:

I guess you should update your WITH clause:

WITH R, V, row

Moreover, what is has_rel in the RETURN clause? Maybe it should be in the WITH clause too.

Regards,
Cobra

Hi @Cobra

has_rel is the name of the relationship I wish to create.

Indeed, you may notice in the CALL clause that I'm trying to create relationships between V and R by drawing from the csv file that contains these relationships.

What I miss here is a way to tell N4J to look at this file and create relationships. I successfully created the virtual nodes that I need, but I can't create rels with the real nodes.

Hope it can help. Thanks a lot!