A new universe for your graph data.Meet Galactus DB
GALACTUS DB WIKIDeployment · Queries · Operations

APOC scalar functions

Wiki / APOC compatibility

On this page

APOC functions (apoc.*)

GDB implements the APOC functions documented here natively. Only the listed functions are supported; an apoc.* name does not imply full API compatibility. These utilities are built into the database; no plugin installation is required.

Everything below is a pure scalar function (usable anywhere an expression is, e.g. RETURN/WHERE/SET). A null collection/text/map argument propagates to null throughout. Set operations use GDB's value equality (so 1 and 1.0 are distinct, consistent with apoc.coll.toSet). Graph traversal, metadata and dynamic create/merge procedures are also available; see traversal and mutations. Background apoc.periodic.* jobs and apoc.node.degree are not implemented. Use native batching and gdb.degree.

apoc.util.* — hashing

FunctionDescriptionExample → result
apoc.util.md5(list)MD5 hex digestapoc.util.md5(['Michael']) → '3e06fa39…ce86'
apoc.util.sha1(list)SHA-1 hex digestapoc.util.sha1(['Michael']) → 'f8c38b21…8b6a'
apoc.util.sha256(list)SHA-256 hex digestapoc.util.sha256(['Michael']) → 'f089eaef…3176'
apoc.util.sha384(list)SHA-384 hex digestapoc.util.sha384(['Michael']) → '906f4540…aee8'
apoc.util.sha512(list)SHA-512 hex digestapoc.util.sha512(['Michael']) → 'e70bdf70…feb6'

Each takes one list argument, concatenates the string form of every element (no separator), hashes the UTF-8 bytes, and returns a lowercase hex string:

RETURN apoc.util.sha256(['Michael']) AS output;
// 'f089eaef57aba315bc0e1455985c0c8e40c247f073ce1f4c5a1f8ffde8773176'
RETURN apoc.util.sha256(['Michael', 42]) AS output;   // = sha256 of 'Michael42'

A non-list argument is an error (the APOC hashing functions are typed to a list). Use these functions for content hashing; they do not provide keyed message authentication.

apoc.text.* — strings

FunctionDescription
lpad(t, n[, d]) / rpad(t, n[, d])Pad to width n with d (default space)
capitalize(t) / decapitalize(t)Change case of the first character
capitalizeAll(t) / decapitalizeAll(t)…of every word
swapCase(t), upperCase(t), lowerCase(t), trim(t)Case / trim
camelCase(t), upperCamelCase(t), snakeCase(t)Reshape words ("a b"→"aB"/"AB"/"a_b")
slug(t[, delim="-"])Replace whitespace runs with delim
repeat(t, n), join(list, delim)Repeat / join
indexOf(t, sub[, from[, to]])First char index of sub, or -1
indexesOf(t, sub[, from[, to]])All char indices of sub
charAt(t, i) / code(cp)Codepoint at index / char for codepoint
byteCount(t[, charset])UTF-8 byte length (charset ignored)
base64Encode(t) / base64Decode(t)Standard Base64 (RFC 4648)
format(t, params[, lang])%s %d %f %x %X %b %% %n (+ .precision for %f)
distance / levenshteinDistance(a, b)Levenshtein edit distance
levenshteinSimilarity(a, b)1 - distance/maxLen, in [0, 1]
hammingDistance(a, b)Differing positions (requires equal length)
jaroWinklerDistance(a, b)Jaro-Winkler similarity, in [0, 1]
sorensenDiceSimilarity(a, b[, lang])Bigram Dice coefficient, in [0, 1]

format applies a subset of Java String.format: the listed conversions and an optional precision for %f; field width, flags and locale are not applied. Regex-based APOC text functions (replace, split, regexGroups) are not implemented (GDB has no regex engine). Word splitting for the case functions breaks on non-alphanumeric runs and lower→UPPER boundaries.

apoc.coll.* — collections

FunctionDescription
sort(l) / sortDesc(l) / reverse(l)Order / reverse (GDB value order)
toSet(l) / flatten(l)Distinct / concatenate one level of nesting
contains(l, v) / indexOf(l, v) / occurrences(l, v)Membership / index / count
min(l) / max(l) / sum(l) / sumLongs(l) / avg(l)Extremes / sums / mean
stdev(l[, biasCorrected=true])Sample (/(n-1)) or population (/n) std-dev
union(a, b) / intersection(a, b)Distinct union / intersection
subtract(a, b) / disjunction(a, b)Distinct difference / symmetric difference
removeAll(a, b)a minus b's elements, keeping a's duplicates
containsAll(a, b) / isEqualCollection(a, b)Subset / multiset equality
frequencies(l) / frequenciesAsMap(l)[{item, count}] / {item: count}
duplicates(l) / duplicatesWithCount(l)Items occurring > 1 (with counts)
zip(a, b) / pairs(l) / pairsMin(l)Pair by position / adjacent pairs
partition(l, size)Split into consecutive batches
combinations(l, min[, max])Combinations sized min..max (max = min default)
runningTotal(l)Cumulative sums

apoc.map.* — maps

FunctionDescription
fromPairs([[k, v], …])Map from key/value pair lists
fromLists(keys, values)Zip two lists (to the shorter)
fromValues([k, v, k, v, …])Map from alternating entries
merge(a, b) / mergeList([m, …])Shallow merge, right/later wins
setKey(m, k, v)Copy with an entry added/updated
removeKey(m, k) / removeKeys(m, keys)Copy without key(s) (shallow; config ignored)
clean(m, keys, values)Drop entries whose key ∈ keys or value ∈ values
values(m, keys[, addNulls])Values for keys, in order
get(m, k[, default[, fail]])Lookup with default / error on missing
submap(m, keys[, values[, fail]])Restrict to keys (missing → default / error)
flatten(m[, delim="."])Flatten nested maps into dotted keys
sortedProperties(m[, ignoreCase])[key, value] pairs sorted by key
groupBy(listOfMaps, key)Map keyed by each element's key (last wins)

apoc.convert.* — conversions (incl. JSON)

FunctionDescription
toJson(value)Serialise any value to a JSON string
fromJsonMap(str) / fromJsonList(str)Parse a JSON object / array
toString(v)String form (null → null)
toInteger(v) / toFloat(v)Coerce numeric (null when unparseable)
toBoolean(v)true/false string or 0/1 (else null)
toList(v) / toSet(l) / toMap(v)Shape coercions

toJson serialises nodes/relationships as their underlying value-map (the reserved _id/_labels/… keys included) and point/temporal values as their ISO/WKT string form; map keys are emitted in sorted order. A JSON number decodes to INTEGER when it fits an i64 and has no fraction/exponent, else FLOAT.

RETURN apoc.convert.toJson({name: 'Bob', tags: ['a', 'b']}) AS j;
// '{"name":"Bob","tags":["a","b"]}'
RETURN apoc.convert.fromJsonMap('{"a": 1, "b": [2, 3]}').b AS b;   // [2, 3]

apoc.number.* — numbers

FunctionDescription
parseInt(str) / parseFloat(str)Parse a number (,/whitespace stripped; null on failure)
format(n[, pattern[, lang]])Group thousands + fix decimals (subset of DecimalFormat)
arabicToRoman(n) / romanToArabic(str)Roman numerals (1..3999)

format honours grouping (a , in pattern) and the number of decimals (0/# after a .); locale is ignored. apoc.number.exact.* (Java BigDecimal) is not implemented.

apoc.meta.* and apoc.any.*

FunctionDescription
apoc.meta.type(value)GDB type name, plus NODE/RELATIONSHIP for element-maps
apoc.meta.isType(value, type)Whether type(value) matches (case-insensitive)
apoc.meta.types(map)Map of each key to its meta.type
apoc.any.properties(node[, keys])A node/rel's properties (meta keys stripped)
apoc.any.property(node, key)A single property value, or null

apoc.meta.type returns GDB's canonical type names (STRING, INTEGER, FLOAT, BOOLEAN, LIST, MAP, POINT, DATE, DURATION, …) — one consistent vocabulary rather than APOC's version-varying Java names.


Procedures, subqueries and parameters · Batched subqueries and logical interchange · Graph data science

Planning a deployment? Review compatibility and licence setup for your instance.