Graph references

Graph references are values used to specify which graph to operate on in a query. They are principally used with the USE clause and graph functions, such as graph.byName().

Static graph references

A static graph reference is a direct reference to a graph in a database. These include:

  • Database and alias names when managing databases and aliases: CREATE DATABASE <symbolic-name>.

  • Database and alias names when selecting a graph with the USE clause: USE <symbolic-name> or USE <symbolic-name>.<symbolic-name> (for constituents of a composite databases).

Dynamic graph references

A dynamic graph reference is a reference to a graph using values that are evaluated during query execution using a function. These include:

  • Dynamic graph reference with the graph.byName() function, to access a graph of a given name: USE graph.byName(<string-expression>).

  • Dynamic graph references with the graph.byElementId() function, to access a graph of a given node or relationship: USE graph.byElementId(<element-id-string>).

  • Retrieving properties of a graph with the graph.propertiesByName() function: graph.propertiesByName(<string-expression>).

Rules

The following rules apply for graph references when using identifiers (static graph references, administration commands) or the graph.byName functions:

  • Unquoted dots are separators between a composite database and its constituent. For example, composite.db1 represents the constituent composite.db1 in the composite database composite. To refer to a database with a dot (.) in its name, quote the graph reference instead: `composite.db1`.

  • When resolving a graph reference within a graph function, the string argument is parsed like a static graph reference. Thus, USE graph.byName(<graph-reference>) is typically equivalent to USE <graph-reference>. However, escaping rules for symbolic names are applied to the argument. For STRING literals, both the escaping rules (during query parsing) and symbolic names (during graph reference evaluation) are applied. For example, the graph reference in USE graph.byName('composite.1\\u0041') resolves to the constituent composite.1a of the composite database composite.