• Stars
    star
    1,706
  • Rank 27,360 (Top 0.6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 27 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Awesome Procedures On Cypher for Neo4j - codenamed "apoc"                     If you like it, please ★ above ⇧            

Discourse users Discord

Awesome Procedures for Neo4j 5.10.0.x (Extended)

Introduction

apoc

Neo4j 3.x introduced the concept of user-defined procedures and functions. Those are custom implementations of certain functionality, that can’t be (easily) expressed in Cypher itself. They are implemented in Java and can be easily deployed into your Neo4j instance, and then be called from Cypher directly.

As of 5.0 APOC has been split into separate repositories, one being the main, officially supported, APOC Library. The other belonging to APOC Extended. This repository handles the extended part of APOC.

There are over 150 different procedures and functions in the Extended APOC library. Their purpose is to increase functionality in areas such as data integration, graph algorithms and data conversion.

License

Apache License 2.0

"APOC" Name history

Apoc was the technician and driver on board of the Nebuchadnezzar in the Matrix movie. He was killed by Cypher.

APOC was also the first bundled A Package Of Component for Neo4j in 2009.

APOC also stands for "Awesome Procedures On Cypher"

Feedback

Please provide feedback and report bugs as GitHub issues or join the Neo4j Community Forum and ask with the APOC tag.

Calling Procedures & Functions within Cypher

User defined Functions can be used in any expression or predicate, just like built-in functions.

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

But you can also integrate them into your Cypher statements which makes them so much more powerful.

Load JSON example
WITH 'https://raw.githubusercontent.com/neo4j-contrib/neo4j-apoc-procedures/5.4/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)

APOC Procedures & Functions Overview

All included procedures are listed in the overview in the documentation and detailed in subsequent sections.

Built in Help

apoc help apoc

call apoc.help('keyword')

lists name, description, signature, roles, based on keyword

Detailed Feature Documentation

See the APOC User Guide for documentation of each of the major features of the library, including data import/export, graph refactoring, data conversion, and more.

Procedure & Function Signatures

To call procedures correctly, you need to know their parameter names, types and positions. And for YIELDing their results, you have to know the output column names and types.

INFO:The signatures are shown in error messages, if you use a procedure incorrectly.

You can see the procedure’s signature in the output of CALL apoc.help("name")

CALL apoc.help("dijkstra")

The signature is always name : : TYPE, so in this case:

apoc.algo.dijkstra
 (startNode :: NODE?, endNode :: NODE?,
   relationshipTypesAndDirections :: STRING?, weightPropertyName :: STRING?)
:: (path :: PATH?, weight :: FLOAT?)
Table 1. Parameter Explanation
Name Type

Procedure Parameters

startNode

Node

endNode

Node

relationshipTypesAndDirections

String

weightPropertyName

String

Output Return Columns

path

Path

weight

Float

Manual Installation: Download the latest release

Since APOC relies on Neo4j’s internal APIs you need to use the matching APOC version for your Neo4j installation. Make sure that the first two version numbers match between Neo4j and APOC.

Go to here for all the APOC extended releases and download the binary jar to place into your $NEO4J_HOME/plugins folder.

Manual Configuration

Warning

For security reasons, procedures and functions that use internal APIs are disabled by default. Loading and enabling APOC procedures and functions can be configured using the Neo4j config file.

For more details, see the APOC installation documentation.

Version Compatibility Matrix

Since APOC relies in some places on Neo4j’s internal APIs you need to use the right APOC version for your Neo4j installaton.

APOC uses a consistent versioning scheme: <neo4j-version>.<apoc> version. The trailing <apoc> part of the version number will be incremented with every apoc release.

apoc version neo4j version

5.10.0

5.10.0 (5.10.x)

5.9.0

5.9.0 (5.9.x)

5.8.0

5.8.0 (5.8.x)

5.7.0

5.7.0 (5.7.x)

5.6.0

5.6.0 (5.6.x)

5.5.0

5.5.0 (5.5.x)

5.4.0

5.4.0 (5.4.x)

5.3.1

5.3.0 (5.3.x)

5.2.0

5.2.0 (5.2.x)

5.1.0

5.1.0 (5.1.x)

4.4.0.18

4.4.0 (4.4.x)

Using APOC with the Neo4j Docker image

To use APOC with Docker; download the APOC release matching your Neo4j version and copy it to a local folder, supplying it as a data volume mounted at /plugins.

The following downloads the APOC Library into the plugins directory and then mounts that folder to the Neo4j Docker container
mkdir plugins
pushd plugins
wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/5.10.0/apoc-5.10.0-extended.jar
popd
docker run --rm -e NEO4J_AUTH=none -p 7474:7474 -v $PWD/plugins:/plugins -p 7687:7687 neo4j:5.4

If you want to pass custom apoc config to your Docker instance, you can use environment variables, like here:

docker run \
    -p 7474:7474 -p 7687:7687 \
    -v $PWD/data:/data -v $PWD/plugins:/plugins \
    --name neo4j-apoc \
    -e NEO4J_apoc_export_file_enabled=true \
    -e NEO4J_apoc_import_file_enabled=true \
    -e NEO4J_apoc_import_file_use__neo4j__config=true \
    neo4j

Build & install the current development branch from source

git clone https://github.com/neo4j-contrib/neo4j-apoc-procedures
cd neo4j-apoc-procedures
sudo ./gradlew --init-script init.gradle shadow
cp build/extended/libs/apoc-<version>-extended.jar $NEO4J_HOME/plugins/
$NEO4J_HOME/bin/neo4j restart

A full build including running the tests can be run by sudo ./gradlew --init-script init.gradle build.

Note that --init-script init.gradle is not needed if you already loaded the gradle changes (e.g. via IntelliJ)

Applying Code-style

./gradlew spotlessApply

To apply the spotless code-style, run the above gradle command, this will remove all unused imports

More Repositories

1

neovis.js

Neo4j + vis.js = neovis.js. Graph visualizations in the browser with data from Neo4j.
TypeScript
1,601
star
2

neomodel

An Object Graph Mapper (OGM) for the Neo4j graph database.
Python
955
star
3

spatial

Neo4j Spatial is a library of utilities for Neo4j that faciliates the enabling of spatial operations on data. In particular you can add spatial indexes to already located data, and perform spatial operations on the data like searching for data within specified regions or within a specified distance of a point of interest. In addition classes are provided to expose the data to geotools and thereby to geotools enabled applications like geoserver and uDig.
Scheme
780
star
4

neo4j-graph-algorithms

Efficient Graph Algorithms for Neo4j
Java
771
star
5

neo4j-mazerunner

Mazerunner extends a Neo4j graph database to run scheduled big data graph compute algorithms at scale with HDFS and Apache Spark.
Java
381
star
6

django-neomodel

Neomodel plugin for Django
Python
286
star
7

neoclipse

Graph Database Tool
Java
219
star
8

neo4j-etl

Data import from relational databases to Neo4j.
HTML
215
star
9

neo4j-elasticsearch

Neo4j ElasticSearch Integration
Java
211
star
10

graphgist

Easy publishing with graph data included
JavaScript
208
star
11

neo4j-streams

Neo4j Kafka Connector
Kotlin
173
star
12

neo4j-helm

Helm Charts for running Neo4j on Kubernetes [DEPRECATED]
Shell
88
star
13

rabbithole

Interactive, embeddable Neo4j-Console
Java
79
star
14

neo4j-mobile-android

Neo4j for Android
Java
78
star
15

authentication-extension

Neo4j Server Auth Extension
Java
72
star
16

gists

Gists for use in GraphGists.
68
star
17

sparql-plugin

Java
67
star
18

kubernetes-neo4j

(RETIRED) Kubernetes experiments with Neo4j. See updated Helm Repo
60
star
19

neo4j-tableau

Neo4j Tableau Integration via WDC
Java
59
star
20

gremlin-plugin

A Plugin for the Neo4j server add Tinkerpop-related functionality
Java
55
star
21

neo4j-org

neo4j.org website
JavaScript
55
star
22

ec2neo

CloudFormation Templates for deploying Neo4j
Ruby
51
star
23

graph-collections

In-graph collections for the Neo4j graph database.
Java
49
star
24

twitter-neo4j

CSS
46
star
25

osm

OSM Data Model for Neo4j
Java
46
star
26

trumpworld-graph

Import, Extend, Query & Visualize the TrumpWorld Graph with Neo4j & Cypher (originally based on the BuzzFeed data)
Jupyter Notebook
43
star
27

fast-http

Fast HTTP protocol with separate netty+disruptor based server
Java
42
star
28

neo4j-meetups-reporting

This is an end-to-end graph-based reporting sample built on Neo4j for tracking and measuring meetup group membership statistics over time.
JavaScript
38
star
29

neo4j-ml-procedures

This project provides procedures and functions to support machine learning applications with Neo4j.
Java
37
star
30

training

HTML
36
star
31

neo4j-faker

Use faker cypher functions to generate demo and test data with cypher
Java
34
star
32

neo4j-guides

Tooling to create Neo4j Browser Guides from AsciiDoc Content
HTML
33
star
33

neo4j-puppet

Puppet module for installing Neo4j on Linux systems
Puppet
30
star
34

sql2cypher

Experimental SQL to Cypher Transpiler using jooq and cypher-dsl
Java
26
star
35

ImageToGraph

A CLI tool to convert images into graphs
Java
25
star
36

python-embedded

Python bindings for Neo4j
Python
25
star
37

neo4j-tinkerpop-api-impl

Implementation of Apache Licensed Neo4j API for Tinkerpop3
Java
24
star
38

training-v3

(new) Neo4j Training Material
Jupyter Notebook
21
star
39

neo4j-csv-import-web

Prototype web app to automate data import of csv files into Neo4j
HTML
21
star
40

spatial-algorithms

Spatial algorithms for both cartesian and geographic data
Java
21
star
41

northwind-neo4j

21
star
42

py2neo

EOL! Py2neo is a comprehensive Neo4j driver library and toolkit for Python.
Python
20
star
43

neo4j-geoff

GEOFF file loader plugin for Neo4j
Java
19
star
44

neo4j-script-procedures

Neo4j Procedures to declare, store and run Javascript, Python, R, Ruby based procedures
Java
18
star
45

training-v2

HTML
14
star
46

sandbox-guides

Resources for building and deploying Neo4j Browser Guides including with sandbox instances
HTML
12
star
47

neo4j-osgi

Java
12
star
48

asciidoc-slides

HTML
11
star
49

javascript-plugin

JavaScript plugin for Neo4j Server.
Java
11
star
50

neo4j-dwh-connector

Scala
11
star
51

neo4j-temp-db

JavaScript
9
star
52

manual-chinese

Shell
9
star
53

neo4j-cassandra-connector

Python command line application for inserting data from Cassandra into Neo4j
Python
8
star
54

m2

Maven Repository
8
star
55

neo4j-jfr

Toolbox to help monitor Neo4j internals with Java Flight Recorder
Java
7
star
56

graph-refactoring

Procedures for Graph Refactorings
Java
7
star
57

datascience-ml-training

Python
6
star
58

developer-resources-fr

French Translation Developer Resources
Shell
6
star
59

script-extension

Server Extension for JVM scripting languages
Java
6
star
60

neo4j-tinkerpop-api

Apache Licensed Neo4j API for Tinkerpop3
Java
6
star
61

neo4j-alexa-skills

Amazon Echo Alexa Skills for querying Neo4j
PHP
6
star
62

cypher-http-examples

Examples on how to connect to the Cypher endpoints from Java with different http libraries
Java
6
star
63

waza-zen-table

Zen-Table Hacking for http://waza.heroku.com
JavaScript
5
star
64

graphgist-portal-v3

GraphGist Portal v3 (JavaScript)
JavaScript
5
star
65

node-neo4j-demo

Template application for Neo4j using Node.js
JavaScript
5
star
66

geoff-plugin

Java
4
star
67

relate-at-graphconnect

Relate! at Graph Connect
4
star
68

neo4j-rdf-sparql

Java
4
star
69

neo4j-rdf

Java
4
star
70

manual-french

Shell
4
star
71

neo_lock_down

Security Rule for Neo4j that disables Traversal REST API
Java
4
star
72

neo4splunk

Neo4Splunk is a Neo4j Splunk Connector using Spunks Python APIs and the Neo4j Python Driver (Proof of Concept)
Python
3
star
73

neo4j-lucene5-index

Neo4j Lucene 5 Integration
Java
3
star
74

local-dataflow-runner

Local Dataflow Runner for the googlecloud-to-neo4j template
Java
3
star
75

neo4j-sproc-compiler

Compile-time annotation processor to verify Neo4j procedure|functions validity
Java
3
star
76

neo4j-community-api

API for Neo4j Community Management
Python
3
star
77

neo4j-data-science-yelp

Online Data Science Class with the Yelp Dataset
Jupyter Notebook
3
star
78

neo4j-contrib.github.io

Neo4j Contrib Landing Page
HTML
2
star
79

design-patterns

2
star
80

community

Neo4j Community Working Group
2
star
81

neo4j-com-examples

Example code for the website
Java
2
star
82

neo4j-utils

Java
2
star
83

training-backend

Neo4j Training Backend for Online Course with Versal
Java
2
star
84

neo4j-library-resources

A resource for neo4j driver/library creators to help creating a helpful website
2
star
85

neo4j-rdf-sail

Java
2
star
86

neo4j-learn

JavaScript
2
star
87

neo4j-dcos

Mesopshere Universe Package(s) for Neo4j Cluster
Shell
2
star
88

neo4j-http

PoC for an external HTTP API using Bolt.
Java
2
star
89

j2ee

Java
2
star
90

neo4j-website

Neo4j Website
JavaScript
2
star
91

neo4j-graph-matching

Java
2
star
92

neo4j-meta-model

Java
2
star
93

legacy-index

Legacy index implementation for Neo4j, i.e. IndexService and LuceneIndexService
Java
2
star
94

sandbox-code-updater

Code Updater for the sandbox repositories in github.com/neo4j-graph-examples
Java
2
star
95

classmarker-integration

HTML
1
star
96

applied-graph-algorithms-training

HTML
1
star
97

neo4j-movies

Basic Graph Domain Model for Movies and Import/Export/Examples/Integration
1
star
98

GSoC

Neo4j Google Summer of Code Projects
1
star
99

aura-professional-on-GCP

Instructions for getting started with Aura
JavaScript
1
star
100

tooling

Java
1
star