Introduction

As of Neo4j 5.0, the APOC library has been split into two separate repositories: APOC Core and APOC Extended. APOC Core is officially supported by Neo4j. APOC Extended is not supported by Neo4j and is maintained by members of the community.

This documentation handles the officially supported APOC Core Library.

For more information about the APOC Extended library, visit the APOC Extended page.

Neo4j supports the APOC (Awesome Procedures on Cypher) Core library. The APOC Core library provides access to user-defined procedures and functions which extend the use of the Cypher query language into areas such as data integration, graph algorithms, and data conversion.

These procedures and functions are implemented in Java and can be deployed into a Neo4j instance, and then be called from Cypher directly.

A full list of all the functions and procedures available in the APOC Core library can be found on the Procedures & Functions page.

For a brief introduction to the history and development of the APOC Library by Michael Hunger, Senior Director of User Innovation at Neo4j, watch this short video:

APOC availability

APOC is available in Neo4j AuraDB. For a full list of the APOC procedures and functions supported by Aura, go to the Aura page for APOC. APOC is also available in Neo4j Sandbox, Docker, and Neo4j Desktop. Finally, the APOC library can be made available in self-hosted databases by installing the APOC jar.

Example

User defined functions can be used in any expression or predicate, similar to built-in functions.

Procedures can be called stand-alone using CALL procedure.name();

Procedures can also be integrated into Cypher statements.

The below example demonstrates how the procedure apoc.load.json can be integrated in a Cypher statement:

Load JSON example
WITH 'https://raw.githubusercontent.com/neo4j/apoc/5.0/src/test/resources/person.json' AS url

CALL apoc.load.json(url) YIELD value as person

MERGE (p:Person {name: person.name})
   ON CREATE SET p.age = person.age, p.children = size(person.children)

For further examples using specific APOC procedures and functions, please see the Procedures & Functions page.

Note about the Neo4j memory tracker

Before using the APOC library, it is important to note that APOC procedures are not detected by the Neo4j Memory Tracker. They will, therefore, not terminate if they exceed the available memory in the database.

For example, the procedure apoc.path.expand will not stop if db.memory.transaction.max or db.memory.transaction.total.max are reached.

Moreover, it is not possible to use the SHOW TRANSACTIONS YIELD currentQuery, estimatedUsedHeapMemory command to monitor the memory usage of a query.

In order to avoid Java Heap Space errors, the APOC procedures should therefore be used carefully.