cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to turn Virtual Objects into Real One?

I'm learning about Virtual Objects in Neo4j.
I'd like to know if there is any possibility to store that Virtual Objects (turn them into regular objects)?

1 ACCEPTED SOLUTION

@marcelix161

One way is to use the
You could use the apoc.create.node and/or apoc.create.relationship procedures
using the apoc.node.labels and apoc.any.properties functions, because "classic" neo4j statement like labels(n) and properties(n)` doesn't work with virtual entities. Or the apoc.rel.type in case of relationship.


For example:

CALL apoc.create.vNode(['MyLabel'], {prop1: 'myValue'})  // virtual node entity
YIELD node as virtual
CALL apoc.create.node(apoc.node.labels(virtual), apoc.any.properties(virtual))  // convert to real using apoc.node.labels and  apoc.any.properties
yield node as real
return real

View solution in original post

1 REPLY 1

@marcelix161

One way is to use the
You could use the apoc.create.node and/or apoc.create.relationship procedures
using the apoc.node.labels and apoc.any.properties functions, because "classic" neo4j statement like labels(n) and properties(n)` doesn't work with virtual entities. Or the apoc.rel.type in case of relationship.


For example:

CALL apoc.create.vNode(['MyLabel'], {prop1: 'myValue'})  // virtual node entity
YIELD node as virtual
CALL apoc.create.node(apoc.node.labels(virtual), apoc.any.properties(virtual))  // convert to real using apoc.node.labels and  apoc.any.properties
yield node as real
return real