apoc.meta.data.of

This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13). For more information, see the Cypher Manual → Parallel runtime.

Details

Syntax

apoc.meta.data.of(graph [, config ]) :: (label, property, count, unique, index, existence, type, array, sample, left, right, other, otherLabels, elementType)

Description

Examines the given sub-graph and returns a table of metadata.

Input arguments

Name

Type

Description

graph

ANY

The graph to extract metadata from.

config

MAP

Number of nodes to sample, setting sample to -1 will remove sampling; { sample = 1000 :: INTEGER } The default is: {}.

Return arguments

Name

Type

Description

label

STRING

The label or type name.

property

STRING

The property name.

count

INTEGER

The count of seen values.

unique

BOOLEAN

If all seen values are unique.

index

BOOLEAN

If an index exists for this property.

existence

BOOLEAN

If an existence constraint exists for this property.

type

STRING

The type represented by this row.

array

BOOLEAN

Indicates whether the property is an array. If the type column is "RELATIONSHIP," this will be true if there is at least one node with two outgoing relationships of the type specified by the label or property column.

sample

LIST<ANY>

This is always null.

left

INTEGER

The ratio (rounded down) of the count of outgoing relationships for a specific label and relationship type relative to the total count of those patterns.

right

INTEGER

The ratio (rounded down) of the count of incoming relationships for a specific label and relationship type relative to the total count of those patterns.

other

LIST<STRING>

The labels of connect nodes.

otherLabels

LIST<STRING>

For uniqueness constraints, this field shows other labels present on nodes that also contain the uniqueness constraint.

elementType

STRING

Whether this refers to a node or a relationship.

Config Parameters

This procedure supports the following config parameters:

Config parameters
Name Type Default Description

sample

INTEGER

1000

Number of nodes to sample. Setting sample to -1 will remove sampling.

Sampling

Specify the sample parameter (1000 by default) to analyze a subset of the data.

The sample, along with the count of nodes for each label, is used to calculate a skip value. Since this value is generated using a random number generator, results obtained through the sampling method may vary between subsequent runs.

Example 1. Calculating skip count for data sampling

If a database contains 500 nodes with the label Foo label, the skip count for that label is calculated as follows:

The skip count per node label is determined by generating a random number between (totalNodesForLabel / sample) ± 0.1.

Sample 10: skipCount = 500 / 10 = 50
The resulting skip count will be between 45 and 55.

Sample 50: skipCount = 500 / 50 = 10
The resulting skip count will be between 9 and 11.

Sample 100: skipCount = 500 / 100 = 5
The resulting skip count will be 5.

The skip count represents the number of nodes skipped before one is examined. For instance, with a skip count of 5, every 5th node is examined. Consequently, a higher sample number results in more nodes being sampled.

To stop sampling set sample: -1.

Usage Examples

Type of supported input graphs

Type Description

STRING

a Cypher query

Virtual Graph

a Virtual Graph returned by apoc.graph.*

MAP

a map with two field nodes (a list of nodes, mandatory), relationships (a list of relationships)

If you want more details you can look at apoc.meta.data documentation