Procedures & Functions

This is the page for APOC Extended documentation. For the officially supported APOC Core, go to the APOC Core page.

apoc.bolt

Qualified Name Type

apoc.bolt.load(url-or-key, kernelTransaction, params, config) - access to other databases via bolt for read

Procedure

Procedure

apoc.config

Qualified Name Type

apoc.config.list | Lists the Neo4j configuration as key,value table

Procedure

apoc.config.map | Lists the Neo4j configuration as map

Procedure

apoc.couchbase

Qualified Name Type

apoc.couchbase.append(hostOrKey, bucket, documentId, content, config) yield id, expiry, cas, mutationToken, content - append a couchbase json document to an existing one.

Procedure

apoc.couchbase.exists(hostOrKey, bucket, documentId, config) yield value - check whether a couchbase json document with the given ID does exist.

Procedure

apoc.couchbase.get(hostOrKey, bucket, documentId, config) yield id, expiry, cas, mutationToken, content - retrieves a couchbase json document by its unique ID.

Procedure

apoc.couchbase.insert(hostOrKey, bucket, documentId, jsonDocument, config) yield id, expiry, cas, mutationToken, content - insert a couchbase json document with its unique ID.

Procedure

apoc.couchbase.namedParamsQuery(hostkOrKey, bucket, statement, paramNames, paramValues, config) yield queryResult - executes a N1QL statement with named parameters.

Procedure

apoc.couchbase.posParamsQuery(hostOrKey, bucket, statement, params, config) yield queryResult - executes a N1QL statement with positional parameters.

Procedure

apoc.couchbase.prepend(hostOrKey, bucket, documentId, content, config) yield id, expiry, cas, mutationToken, content - prepend a couchbase json document to an existing one.

Procedure

apoc.couchbase.query(hostOrKey, bucket, statement, config) yield queryResult - executes a plain un-parameterized N1QL statement.

Procedure

apoc.couchbase.remove(hostOrKey, bucket, documentId, config) yield id, expiry, cas, mutationToken, content - remove the couchbase json document identified by its unique ID.

Procedure

apoc.couchbase.replace(hostOrKey, bucket, documentId, jsonDocument, config) yield id, expiry, cas, mutationToken, content - replace the content of the couchbase json document identified by its unique ID.

Procedure

apoc.couchbase.upsert(hostOrKey, bucket, documentId, jsonDocument) yield id, expiry, cas, mutationToken, content - insert or overwrite a couchbase json document with its unique ID.

Procedure

apoc.custom

Qualified Name Type

apoc.custom.declareFunction(signature, statement, forceSingle, description) - register a custom cypher function

Procedure

apoc.custom.declareProcedure(signature, statement, mode, description) - register a custom cypher procedure

Procedure

apoc.custom.list() - provide a list of custom procedures/function registered

Procedure

apoc.custom.removeFunction(name, type) - remove the targeted custom function

Procedure

apoc.custom.removeProcedure(name) - remove the targeted custom procedure

Procedure

apoc.cypher

Qualified Name Type

apoc.cypher.mapParallel(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _

Procedure

apoc.cypher.mapParallel2(fragment, params, list-to-parallelize) yield value - executes fragment in parallel batches with the list segments being assigned to _

Procedure

apoc.cypher.parallel(fragment, paramMap, keyList) yield value - executes fragments in parallel through a list defined in paramMap with a key keyList

Procedure

apoc.cypher.parallel2(fragment, paramMap, keyList) yield value - executes fragments in parallel batches through a list defined in paramMap with a key keyList

Procedure

apoc.cypher.runFile(file or url,[{statistics:true,timeout:10,parameters:{}}]) - runs each statement in the file, all semicolon separated - currently no schema operations

Procedure

apoc.cypher.runFiles([files or urls],[{statistics:true,timeout:10,parameters:{}}])) - runs each statement in the files, all semicolon separated

Procedure

apoc.cypher.runSchemaFile(file or url,[{statistics:true,timeout:10}]) - allows only schema operations, runs each schema statement in the file, all semicolon separated

Procedure

apoc.cypher.runSchemaFiles([files or urls],{statistics:true,timeout:10}) - allows only schema operations, runs each schema statement in the files, all semicolon separated

Procedure

apoc.data

Qualified Name Type

apoc.data.email('email_address') as {personal,user,domain} - extract the personal name, user and domain as a map

Function

apoc.dv

Qualified Name Type

Add a virtualized resource configuration

Procedure

List all virtualized resource configs

Procedure

Remove a virtualized resource config by name

Procedure

Query a virtualized resource by name and return virtual nodes

Procedure

Query a virtualized resource by name and return virtual nodes linked using virtual rels to the node passed as first param

Procedure

apoc.es

Qualified Name Type

apoc.es.get(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a GET operation on elastic search

Procedure

apoc.es.getRaw(host-or-port,path,payload-or-null) yield value - perform a raw GET operation on elastic search

Procedure

apoc.es.post(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a POST operation on elastic search

Procedure

apoc.es.postRaw(host-or-port,path,payload-or-null) yield value - perform a raw POST operation on elastic search

Procedure

apoc.es.put(host-or-port,index-or-null,type-or-null,id-or-null,query-or-null,payload-or-null) yield value - perform a PUT operation on elastic search

Procedure

apoc.es.query(host-or-port,index-or-null,type-or-null,query-or-null,payload-or-null) yield value - perform a SEARCH operation on elastic search

Procedure

apoc.es.stats(host-url-Key) - elastic search statistics

Procedure

apoc.export

Qualified Name Type

apoc.export.xls.all(file,config) - exports whole database as xls to the provided file

Procedure

apoc.export.xls.data(nodes,rels,file,config) - exports given nodes and relationships as xls to the provided file

Procedure

apoc.export.xls.graph(graph,file,config) - exports given graph object as xls to the provided file

Procedure

apoc.export.xls.query(query,file,{config,…​,params:{params}}) - exports results from the cypher statement as xls to the provided file

Procedure

apoc.generate

Qualified Name Type

apoc.generate.ba(noNodes, edgesPerNode, label, type) - generates a random graph according to the Barabasi-Albert model

Procedure

apoc.generate.complete(noNodes, label, type) - generates a random complete graph

Procedure

apoc.generate.er(noNodes, noEdges, label, type) - generates a random graph according to the Erdos-Renyi model

Procedure

apoc.generate.simple(degrees, label, type) - generates a simple random graph according to the given degree distribution

Procedure

apoc.generate.ws(noNodes, degree, beta, label, type) - generates a random graph according to the Watts-Strogatz model

Procedure

apoc.gephi

Qualified Name Type

apoc.gephi.add(url-or-key, workspace, data, weightproperty, ['exportproperty']) | streams passed in data to Gephi

Procedure

apoc.get

Qualified Name Type

apoc.get.nodes(node|id|[ids]) - quickly returns all nodes with these id’s

Procedure

apoc.get.rels(rel|id|[ids]) - quickly returns all relationships with these id’s

Procedure

apoc.load

Qualified Name Type

apoc.load.csv('urlOrBinary',{config}) YIELD lineNo, list, map - load CSV from URL as stream of values, config contains any of: {skip:1,limit:5,header:false,sep:'TAB',ignore:['tmp'],nullValues:['na'],arraySep:';',mapping:{years:{type:'int',arraySep:'-',array:false,name:'age',ignore:false}}

Procedure

apoc.load.csvParams('urlOrBinary', {httpHeader: value}, payload, {config}) YIELD lineNo, list, map - load from CSV URL (e.g. web-api) while sending headers / payload to load CSV from URL as stream of values, config contains any of: {skip:1,limit:5,header:false,sep:'TAB',ignore:['tmp'],nullValues:['na'],arraySep:';',mapping:{years:{type:'int',arraySep:'-',array:false,name:'age',ignore:false}}

Procedure

apoc.load.directory('pattern', 'urlDir', {config}) YIELD value - Loads list of all files in folder specified by urlDir or in import folder if urlDir string is empty or not specified

Procedure

apoc.load.directory.async.add(name, cypher, pattern, urlDir, {}) YIELD name, status, pattern, cypher, urlDir, config, error - Add or replace a folder listener with a specific name, pattern and url directory that execute the specified cypher query when an event is triggered and return listener list

Procedure

apoc.load.directory.async.list() YIELD name, status, pattern, cypher, urlDir, config, error - List of all folder listeners

Procedure

apoc.load.directory.async.remove(name) YIELD name, status, pattern, cypher, urlDir, config, error - Remove a folder listener by name and return remaining listeners, if any

Procedure

apoc.load.directory.async.removeAll() - Remove all folder listeners

Procedure

apoc.load.driver('org.apache.derby.jdbc.EmbeddedDriver') register JDBC driver of source database

Procedure

apoc.load.html('url',{name: jquery, name2: jquery}, config) YIELD value - Load Html page and return the result as a Map

Procedure

apoc.load.htmlPlainText('urlOrHtml',{name: jquery, name2: jquery}, config) YIELD value - Load Html page and return the result as a Map

Procedure

apoc.load.jdbc('key or url','table or statement', params, config) YIELD row - load from relational database, from a full table or a sql statement

Procedure

apoc.load.jdbcUpdate('key or url','statement',[params],config) YIELD row - update relational database, from a SQL statement with optional parameters

Procedure

apoc.load.ldap("key" or {connectionMap},{searchMap}) Load entries from an ldap source (yield entry)

Procedure

apoc.load.xls('url','selector',{config}) YIELD lineNo, list, map - load XLS fom URL as stream of row values, config contains any of: {skip:1,limit:5,header:false,ignore:['tmp'],arraySep:';',mapping:{years:{type:'int',arraySep:'-',array:false,name:'age',ignore:false, dateFormat:'iso_date', dateParse:['dd-MM-yyyy']}}

Procedure

apoc.log

Qualified Name Type

apoc.log.debug(message, params) - logs debug message

Procedure

apoc.log.error(message, params) - logs error message

Procedure

apoc.log.info(message, params) - logs info message

Procedure

apoc.log.warn(message, params) - logs warn message

Procedure

apoc.metrics

Qualified Name Type

apoc.metrics.get(metricName, {}) - retrieve a system metric by its metric name. Additional configuration options may be passed matching the options available for apoc.load.csv.

Procedure

apoc.metrics.list() - get a list of available metrics

Procedure

apoc.metrics.storage(directorySetting) - retrieve storage metrics about the devices Neo4j uses for data storage. directorySetting may be any valid neo4j directory setting name, such as 'server.directories.data'. If null is provided as a directorySetting, you will get back all available directory settings. For a list of available directory settings, see the Neo4j operations manual reference on configuration settings. Directory settings are not paths, they are a neo4j.conf setting key name

Procedure

apoc.model

Qualified Name Type

apoc.model.jdbc('key or url', {schema:'<schema>', write: <true/false>, filters: { tables:[], views: [], columns: []}) YIELD nodes, relationships - load schema from relational database

Procedure

apoc.mongo

Qualified Name Type

apoc.mongo.aggregate(uri, pipeline, $config) yield value - perform an aggregate operation on mongodb collection

Procedure

apoc.mongo.count(uri, query, $config) yield value - perform a count operation on mongodb collection

Procedure

apoc.mongo.delete(uri, query, $config) - delete the given documents from the mongodb collection and returns the number of affected documents

Procedure

apoc.mongo.find(uri, query, $config) yield value - perform a find operation on mongodb collection

Procedure

apoc.mongo.insert(uri, documents, $config) yield value - inserts the given documents into the mongodb collection

Procedure

apoc.mongo.update(uri, query, update, $config) - updates the given documents from the mongodb collection and returns the number of affected documents

Procedure

apoc.mongodb

Qualified Name Type

apoc.mongodb.get.byObjectId(hostOrKey, db, collection, objectIdValue, config(default:{})) - get the document by Object id value

Procedure

apoc.monitor

Qualified Name Type

apoc.monitor.ids() returns the object ids in use for this neo4j instance

Procedure

apoc.monitor.kernel() returns informations about the neo4j kernel

Procedure

apoc.monitor.store() returns informations about the sizes of the different parts of the neo4j graph store

Procedure

apoc.monitor.tx() returns informations about the neo4j transaction manager

Procedure

apoc.nlp

Qualified Name Type

Creates a (virtual) entity graph for provided text

Procedure

Returns a stream of entities for provided text

Procedure

Creates a (virtual) key phrases graph for provided text

Procedure

Returns a stream of key phrases for provided text

Procedure

Creates a (virtual) sentiment graph for provided text

Procedure

Returns stream of sentiment for items in provided text

Procedure

Creates a (virtual) entity graph for provided text

Procedure

Provides a entity analysis for provided text

Procedure

Creates a (virtual) key phrase graph for provided text

Procedure

Provides a entity analysis for provided text

Procedure

Creates a (virtual) sentiment graph for provided text

Procedure

Provides a sentiment analysis for provided text

Procedure

Classifies a document into categories.

Procedure

Classifies a document into categories.

Procedure

Creates a (virtual) entity graph for provided text

Procedure

Returns a stream of entities for provided text

Procedure

apoc.redis

Qualified Name Type

apoc.redis.append(uri, key, value, {config}) | Execute the 'APPEND key value' command

Procedure

apoc.redis.configGet(uri, parameter, {config}) | Execute the 'CONFIG GET parameter' command

Procedure

apoc.redis.configSet(uri, parameter, {config}) | Execute the 'CONFIG SET parameter value' command

Procedure

apoc.redis.copy(uri, source, destination, {config}) | Execute the 'COPY source destination' command and returns true if source was copied and false otherwise

Procedure

apoc.redis.eval(uri, script, outputType, keys, values, {config}) | Execute the 'EVAL script' command. In the parameters provided to the procedure, keys are bound to the KEYS[n] like special array of the Lua script and values are bound to the ARGV[n] like special array of the Lua script.

Procedure

apoc.redis.exists(uri, keys, {config}) | Execute the 'EXISTS keys' command

Procedure

apoc.redis.get(uri, key, {config}) | Execute the 'GET key' command

Procedure

apoc.redis.hdel(uri, key, fields, {config}) | Execute the 'HDEL key fields' command

Procedure

apoc.redis.hexists(uri, key, field, {config}) | Execute the 'HEXISTS key field' command

Procedure

apoc.redis.hget(uri, key, field, {config}) | Execute the 'HGET key field' command

Procedure

apoc.redis.hgetall(uri, key, {config}) | Execute the 'HGETALL key' command

Procedure

apoc.redis.hincrby(uri, key, field, amount, {config}) | Execute the 'HINCRBY key field amount' command

Procedure

apoc.redis.hset(uri, key, field, value, {config}) | Execute the 'HSET key field value' command and returns true if it is a new field in the hash or false if the field already exists

Procedure

apoc.redis.incrby(uri, key, amount, {config}) | Execute the 'INCRBY key increment' command

Procedure

apoc.redis.info(uri, {config}) | Execute the 'INFO' command

Procedure

apoc.redis.lrange(uri, key, start, stop, {config}) | Execute the 'LRANGE key start stop' command

Procedure

apoc.redis.persist(uri, key, {config}) | Execute the 'PERSIST key' command

Procedure

apoc.redis.pexpire(uri, key, time, isExpireAt {config}) | Execute the 'PEXPIRE key time' command, or the 'PEPXPIREAT' if isExpireAt=true

Procedure

apoc.redis.pop(uri, key, {config}) | Execute the 'LPOP key' command, or the 'RPOP' if config right=true (default)

Procedure

apoc.redis.pttl(uri, key, {config}) | Execute the 'PTTL key' command

Procedure

apoc.redis.push(uri, key, values, {config}) | Execute the 'LPUSH key field values' command, or the 'RPUSH' if config right=true (default)

Procedure

apoc.redis.sadd(uri, key, members, {config}) | Execute the 'SADD key members' command

Procedure

apoc.redis.scard(uri, key, {config}) | Execute the 'SCARD key' command

Procedure

apoc.redis.smembers(uri, key, {config}) | Execute the 'SMEMBERS key' command

Procedure

apoc.redis.spop(uri, key, {config}) | Execute the 'SPOP key' command

Procedure

apoc.redis.sunion(uri, keys, {config}) | Execute the 'SUNION keys' command

Procedure

apoc.redis.zadd(uri, keys, scoresAndMembers, {config}) | Execute the 'ZADD key scoresAndMembers' command, where scoresAndMembers is a list of score,member,score,member,…​

Procedure

apoc.redis.zcard(uri, key, {config}) | Execute the 'ZCARD key' command

Procedure

apoc.redis.zrangebyscore(uri, key, min, max, {config}) | Execute the 'ZRANGEBYSCORE key min max' command

Procedure

apoc.redis.zrem(uri, key, members, {config}) | Execute the 'ZREM key members' command

Procedure

apoc.static

Qualified Name Type

apoc.static.list(prefix) - returns statically stored values from config (apoc.static.<prefix>.*) or server lifetime storage

Procedure

apoc.static.set(name, value) - stores value under key for server lifetime storage, returns previously stored or configured value

Procedure

apoc.static.get(name) - returns statically stored value from config (apoc.static.<key>) or server lifetime storage

Function

apoc.static.getAll(prefix) - returns statically stored values from config (apoc.static.<prefix>.*) or server lifetime storage

Function

apoc.systemdb

Qualified Name Type

Procedure

Procedure

Procedure

apoc.ttl

Qualified Name Type

CALL apoc.ttl.expire(node,time,'time-unit') - expire node at specified time by setting :TTL label and ttl property

Procedure

CALL apoc.ttl.expireIn(node,timeDelta,'time-unit') - expire node after specified length of time time by setting :TTL label and ttl property

Procedure

Function

apoc.uuid

Qualified Name Type

CALL apoc.uuid.install(label, {addToExistingNodes: true/false, uuidProperty: 'uuid'}) yield label, installed, properties, batchComputationResult | it will add the uuid transaction handler for the provided label and uuidProperty, in case the UUID handler is already present it will be replaced by the new one

Procedure

CALL apoc.uuid.list() yield label, installed, properties | provides a list of all the uuid handlers installed with the related configuration

Procedure

CALL apoc.uuid.remove(label) yield label, installed, properties | remove previously added uuid handler and returns uuid information. All the existing uuid properties are left as-is

Procedure

CALL apoc.uuid.removeAll() yield label, installed, properties | it removes all previously added uuid handlers and returns uuids information. All the existing uuid properties are left as-is

Procedure