Procedure Function

apoc.create.vNode(labels LIST<STRING>, props MAP<STRING, ANY>) - returns a virtual NODE.

This procedure returns a virtual node that can only be accessed by other APOC procedures. For more information, see Virtual Nodes & Relationships (Graph Projections).


apoc.create.vNode(labels :: LIST<STRING>, props = {} :: MAP) :: NODE

Input parameters

Name Type Default







Usage Examples

The examples in this section are based on the following graph:

CREATE (s:Student {name: 'Alice', score: 71});
CREATE (s:Student {name: 'Mark', score: 95});
CREATE (s:Student {name: 'Andrea', score: 86});
CREATE (s:Student {name: 'Rajesh', score: 89});
CREATE (s:Student {name: 'Jennifer', score: 96});
CREATE (s:Student {name: 'Katarina', score: 80});

The apoc.create.vNode offers both a procedure and function version, so that we can create the virtual nodes independently or return them based on results of a query.

For instance, we might want to create virtual nodes for just the scores, so that researchers could retrieve the score, but not student data:

apoc.create.vNode Procedure
MATCH (s:Student)
CALL apoc.create.vNode(['Score'],{value: s.score}) YIELD node
RETURN node;
Table 1. Results







We could also create a virtual graph adhoc that separates students from their scores. This allows testing or querying the data in an alternate data model than what physically exists in the database.

apoc.create.vNode Function
MATCH (s:Student)
RETURN apoc.create.vNode(['Student'],{name: s.name}) as student,
       apoc.create.vNode(['Score'],{value: s.score}) as score;
Table 2. Results
student score