apoc.schema.relationships
This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime. For more information, see the Cypher Manual → Parallel runtime. |
Syntax |
|
||
Description |
Returns the indexes and constraints information for all the relationship types in the database. It is possible to define a set of relationship types to include or exclude in the config parameters. |
||
Input arguments |
Name |
Type |
Description |
|
|
|
|
Return arguments |
Name |
Type |
Description |
|
|
A generated name for the index or constraint. |
|
|
|
The type of the index or constraint. |
|
|
|
The property keys associated with the constraint or index. |
|
|
|
The status of the constraint or index. |
|
|
|
The relationship type associated with the constraint or index. |
Config parameters
Name | Type | Default | Description |
---|---|---|---|
|
|
[] |
Relationship types to include. Default is to include all relationship types. |
|
|
[] |
Relationship types to exclude. Default is to include all relationship types. |
It’s not possible to valuate both relationships
and excludeRelationships
.
In this case, the error Parameters relationships and excludeRelationships are both valued.
will be returned.
Usage Examples
The type
result can have one of the following values:
name | Schema type |
---|---|
"RELATIONSHIP_PROPERTY_EXISTENCE" |
Relationship property existence constraints |
"FULLTEXT" |
Full-text index |
"TEXT" |
Text index |
"RANGE" |
Range index |
"POINT" |
Point index |
"LOOKUP" |
Lookup index |
Given the following schema:
CREATE FULLTEXT INDEX fullIdx FOR ()-[n:MOVIE|BOOK]-() ON EACH [n.title, n.description];
CREATE POINT INDEX pointIdx FOR ()-[n:PLACE]-() ON (n.address);
CREATE TEXT INDEX textIdx FOR ()-[n:GAME]-() ON (n.title);
CREATE RANGE INDEX rangeIdx FOR ()-[n:FOO_BAR]-() ON (n.name);
It is possible to execute the following query:
CALL apoc.schema.relationships()
name | type | properties | status | relationshipType |
---|---|---|---|---|
":PLACE(address)" |
"POINT" |
["address"] |
"ONLINE" |
"PLACE" |
":GAME(title)" |
"TEXT" |
["title"] |
"ONLINE" |
"GAME" |
":[BOOK, MOVIE],(title,description)" |
"FULLTEXT" |
["title", "description"] |
"ONLINE" |
["BOOK", "MOVIE"] |
":FOO_BAR(name)" |
"RANGE" |
["name"] |
"ONLINE" |
"FOO_BAR" |
Given the following schema:
CREATE CONSTRAINT likesDay
FOR ()-[like:LIKED]-()
REQUIRE (like.day) IS NOT NULL;
It is possible to execute the following query:
CALL apoc.schema.relationships()
name | type | properties | status | relationshipType |
---|---|---|---|---|
"CONSTRAINT ON ()-[liked:LIKED]-() ASSERT liked.day IS NOT NULL" |
"RELATIONSHIP_PROPERTY_EXISTENCE" |
["day"] |
"" |
["BOOK", "MOVIE"] |