Unable to load NODE 4:db8c4fa9-255d-4df3-a0e1-0818e92d3b53:-2368

MATCH (account:Account:Iam)-[:DATE]->(date:Date)-[:ACTED]-(start_log:Log)-[:ACTED*1..]->(end_log:Log)-[:DETECTED]->(rule:Rule)
WHERE account.name = 'ar_hk'

WITH account, date, start_log, end_log, rule

MATCH path=(start_log)-[:ACTED*]->(end_log)

WITH account, date, start_log, end_log, rule, path

WITH account, date, start_log, end_log, rule, path,
     nodes(path) AS all_nodes

WITH account, date, start_log, end_log, rule, path, all_nodes,
     all_nodes[0] AS virtual_start,
     all_nodes[-1] AS virtual_end

WITH account, date, start_log, end_log, rule, virtual_start, virtual_end, length(path) AS path_length

CALL apoc.create.vNode(['Analysis'], {path_length: path_length}) YIELD node AS virtual_analysis

CREATE (virtual_start)-[:VIRTUAL_START]->(virtual_analysis)
CREATE (virtual_analysis)-[:VIRTUAL_END]->(virtual_end)

RETURN account, date, start_log, end_log, rule, virtual_analysis

Here's a cypher that finds a pattern, creates a virtual node, and then creates a relationship with the real node.

However, errors continue to occur.

Here is my second cypher :

MATCH (account:Account:Iam)-[:DATE]->(date:Date)-[:ACTED]-(start_log:Log)-[:ACTED*1..]->(end_log:Log)-[:DETECTED]->(rule:Rule)
WHERE account.name = 'ar_hk'

WITH account, date, start_log, end_log, rule

MATCH path=(start_log)-[:ACTED*]->(end_log)

WITH account, date, start_log, end_log, rule, path

WITH account, date, start_log, end_log, rule, path,
     nodes(path) AS all_nodes

WITH account, date, start_log, end_log, rule, path, all_nodes,
     all_nodes[0] AS virtual_start,
     all_nodes[-1] AS virtual_end

CALL apoc.create.vNode(['Analysis'], {path_length: length(path)}) YIELD node as virtual_analysis

WITH account, date, start_log, end_log, rule, virtual_start, virtual_analysis, virtual_end

CREATE (virtual_start)-[:START]->(virtual_analysis)-[:END]->(virtual_end)

RETURN account, date, start_log, end_log, rule, virtual_analysis

but, The error 'Unable to load NODE 4:db8c4fa9-255d-4df3-a0e1-0818e92d3b53:-2369' still occurs.

What did I do wrong?

Thank you.

I think your issue may that you are trying to create a path with a virtual node (virtual_analysis). Virtual nodes and relationships don’t actually exists, but are returned in the data for visualization only. You could create a virtual path or use virtual relationships instead it you are just trying to display the result.