apoc.create.clonePathToVirtual

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

Syntax

apoc.create.clonePathToVirtual(path) :: (path)

Description

Takes the given PATH and returns a virtual representation of it.

Input arguments

Name

Type

Description

path

PATH

The path to create a virtual path from.

Return arguments

Name

Type

Description

path

PATH

The path result.

Example

Given this dataset:

CREATE (:Person {name: 'Alice'})-[:KNOWS {since: 2020}]->(:Person {name: 'Bob'})

The following query matches a path and returns a virtual clone of it:

MATCH p = (:Person {name: 'Alice'})-[:KNOWS]->(:Person {name: 'Bob'})
CALL apoc.create.clonePathToVirtual(p) YIELD path
RETURN path AS virtualPath
Results
virtualPath

(:Person {name: "Alice"})-[:KNOWS {since: 2020}]→(:Person {name: "Bob"})

The returned path is a virtual copy - any modifications made to its nodes or relationships do not affect the original graph data.