Graph functions
graph.names()
Returns a list containing the names of all graphs on the current composite database. It is only supported on composite databases.
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()
Returns a map containing the properties associated with the given graph. The properties are set on the aliasthat adds the graph as a constituent of a composite database. It is only supported on composite databases.
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"
.
graph.byName()
Resolves a constituent graph by name.
It is only supported in the USE
clause, on composite databases.
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.
graph.byElementId()
This feature was introduced in Neo4j 5.13.
The graph.byElementId()
function is used in the USE clause to resolve a constituent graph to which a given element id belongs.
If the constituent database is not a standard database in the DBMS, an error will be thrown.
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
Was this page helpful?