USE

Introduction

The USE clause determines which graph a query, or query part, is executed against.

This functionality is currently only available in Neo4j Fabric. Find out more about this feature in Operations Manual → Fabric.

Syntax

The USE clause can only appear as the first clause of:

  • Queries:

    USE <graph>
    <other clauses>
  • Union parts:

    USE <graph>
    <other clauses>
      UNION
    USE <graph>
    <other clauses>
  • Subqueries:

    CALL {
      USE <graph>
      <other clauses>
    }

    In subqueries, a USE clause may appear as the second clause, if directly following an importing WITH clause

Examples

In the following examples we assume that we have configured a Fabric database called exampleFabricSetup.

Query graph by name

The graph that we wish to query is configured to be referred to by the name exampleDatabaseName.

Query.
USE exampleFabricSetup.exampleDatabaseName

Query graph by graph ID

The graph we wish to query is configured with the graph id 0, which is why we can refer to it using the built-in function graph() with the argument 0:

Query.
USE exampleFabricSetup.graph(0)