Graph functions
graph.names()
Syntax |
| ||
Description | Lists the names of graphs in the current database. | ||
Returns |
|
|
CREATE DATABASE dba; CREATE DATABASE dbb; CREATE DATABASE dbc; CREATE COMPOSITE DATABASE composite; CREATE ALIAS composite.first FOR DATABASE dba; CREATE ALIAS composite.second FOR DATABASE dbb; CREATE ALIAS composite.third FOR DATABASE dbc;
RETURN graph.names() AS name
The names of all graphs on the current composite database are returned.
name |
---|
|
|
|
Rows: 3 |
graph.propertiesByName()
Syntax |
| ||
Description | Returns the | ||
Arguments | Name | Type | Description |
|
| The name of the graph from which all associated properties will be returned. | |
Returns |
|
|
The properties in the returned |
CREATE DATABASE dba; CREATE DATABASE dbb; CREATE DATABASE dbc; CREATE COMPOSITE DATABASE composite; CREATE ALIAS composite.first FOR DATABASE dba PROPERTIES {number: 1, tags: ['A', 'B']}; CREATE ALIAS composite.second FOR DATABASE dbb PROPERTIES {number: 0, tags: ['A']}; CREATE ALIAS composite.third FOR DATABASE dbc PROPERTIES {number: 2, tags: ['B', 'C']};
UNWIND graph.names() AS name RETURN name, graph.propertiesByName(name) AS props
Properties for all graphs on the current composite database are returned.
name | props |
---|---|
|
|
|
|
|
|
Rows: 3 |
UNWIND graph.names() AS name WITH name, graph.propertiesByName(name) AS props WHERE "A" IN props.tags CALL () { USE graph.byName(name) MATCH (n) RETURN n } RETURN n
Returns all nodes from a subset of graphs that have a tags
property containing "A"
.
The above query uses an empty variable scope clause: CALL () { … } (introduced in Neo4j 5.23). If you are using an older version of Neo4j, use CALL { … } instead. For more information, see CALL subqueries → Importing variables. |
graph.byName()
Syntax |
| ||
Description | Returns the graph reference of the given name. | ||
Arguments | Name | Type | Description |
|
| The name of the graph to be resolved. | |
Returns |
|
|
UNWIND graph.names() AS graphName CALL () { USE graph.byName(graphName) MATCH (n) RETURN n } RETURN n
Returns all nodes from all graphs on the current composite database.
The above query uses an empty variable scope clause: CALL () { … } (introduced in Neo4j 5.23). If you are using an older version of Neo4j, use CALL { … } instead. For more information, see CALL subqueries → Importing variables. |
graph.byElementId()Introduced in 5.13
Syntax |
| ||
Description | Returns the graph reference with the given element id. | ||
Arguments | Name | Type | Description |
|
| An element id of a node or relationship. | |
Returns |
|
If the constituent database is not a standard database in the DBMS, an error will be thrown. |
|
As of Neo4j 5.26, |
On a standard database, a |
In this example, it is assumed that the DBMS contains a composite database constituent, which contains the element id 4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0
.
USE graph.byElementId("4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0") MATCH (n) RETURN n