- All Superinterfaces:
Visitable
- All Known Subinterfaces:
ProcedureCall
,ResultStatement
,Statement.RegularQuery
,Statement.SingleQuery
,Statement.UnionQuery
,Statement.UseStatement
Shall be the common interfaces for queries that we support.
For reference see: Cypher.
We have skipped the intermediate "Query" structure so a statement in the context of this generator is either a
Statement.RegularQuery
or a StandaloneCall
.
- Since:
- 1.0
- Author:
- Michael J. Simons
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
RepresentsRegularQuery
.static interface
Represents aSingleQuery
.static interface
Represents aUnionQuery
.static interface
Represents aUSE
statement, utilizing a composite graph call. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull StatementBuilder
builder()
static @NotNull StatementBuilder.OngoingStandaloneCallWithoutArguments
default boolean
@NotNull StatementCatalog
Analyzes the statement and provides access to the resolved properties, their (potential) owners and the context in which they have been resolved.@NotNull StatementContext
@NotNull String
This method uses the default renderer to create a String representation of this statement.@NotNull Collection
<Expression> Deprecated, for removal: This API element is subject to removal in a future version.@NotNull Collection
<String> Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.boolean
Some constants may be rendered as parameters.static @NotNull Statement
Creates a statement based on a list ofclauses
.void
setRenderConstantsAsParameters
(boolean renderConstantsAsParameters) Use this method to configure whether some constant values should be rendered as parameters or as literals before the first call togetParameters()
orgetCypher()
.static @NotNull Statement
usingPeriodic
(Integer batchSize, @NotNull List<Clause> clauses) Creates a statement based on a list ofclauses
and prepends it with USING PERIODIC COMMIT.
-
Method Details
-
builder
- Returns:
- A new statement builder.
-
of
Creates a statement based on a list ofclauses
. It is your task to provide a sanity check of the clauses. The builder will use the clauses "as is", neither change their order nor their type.- Parameters:
clauses
- A list of clauses, must not be null- Returns:
- A statement
- Since:
- 2021.3.0
-
usingPeriodic
@API(status=STABLE, since="2021.3.0") @NotNull static @NotNull Statement usingPeriodic(Integer batchSize, @NotNull @NotNull List<Clause> clauses) Creates a statement based on a list ofclauses
and prepends it with USING PERIODIC COMMIT. It is your task to provide a sanity check of the clauses. The builder will use the clauses "as is", neither change their order nor their type.The USING PERIODIC HINT is only valid right before the LOAD CSV clause.
- Parameters:
batchSize
- The batch size to pass to PERIODIC COMMIT.clauses
- A list of clauses, must not be null- Returns:
- A statement
- Since:
- 2021.3.0
-
call
@NotNull @Contract(pure=true) static @NotNull StatementBuilder.OngoingStandaloneCallWithoutArguments call(String... namespaceAndProcedure) - Parameters:
namespaceAndProcedure
- The fully qualified name of a stored procedure. Each part can be given as a separate String, but a fully qualified String is ok as well.- Returns:
- An entry point into a statement that starts with a call to stored procedure.
-
getParameters
@NotNull @Contract(pure=true) @Deprecated(forRemoval=true, since="2023.2.0") @NotNull Map<String,Object> getParameters()Deprecated, for removal: This API element is subject to removal in a future version.After a statement has been build, all parameters that have been added to the statement can be retrieved through this method. The result will only contain parameters with a defined value. If you are interested in all parameter names, usegetParameterNames()
.The map can be used for example as an argument with various methods on the Neo4j Java Driver that allow the execution of parameterized queries.
This method is threadsafe
- Returns:
- A map of all parameters with a bound value.
- Since:
- 2021.0.0
-
getParameterNames
@NotNull @Contract(pure=true) @Deprecated(forRemoval=true, since="2023.2.0") @NotNull Collection<String> getParameterNames()Deprecated, for removal: This API element is subject to removal in a future version.After the statement has been build, this method returns a list of all parameter names used, regardless whether a value was bound to the parameter o not.This method is threadsafe
- Returns:
- A set of parameter names being used.
- Since:
- 2021.0.0
-
getIdentifiableExpressions
@NotNull @Contract(pure=true) @Deprecated(forRemoval=true, since="2023.1.0") @NotNull Collection<Expression> getIdentifiableExpressions()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- The set of identifiable expressions that are available when this statement ends.
- Since:
- 2021.3.2
-
getCatalog
Analyzes the statement and provides access to the resolved properties, their (potential) owners and the context in which they have been resolved. Also, a view ongetIdentifiableExpressions()
is provided.- Returns:
- An immutable object representing properties resolved in a statement together with their context and owner
- Since:
- 2023.1.0
-
getCypher
This method uses the default renderer to create a String representation of this statement. The generated Cypher will use escaped literals and correct placeholders like$param
for parameters. The placeholders for parameters can be retrieved viagetParameterNames()
. Bounded values for parameters can be retrieved viagetParameters()
.This method is threadsafe
- Returns:
- A valid Cypher statement
- Since:
- 2021.0.0
-
getContext
@API(status=INTERNAL, since="2021.0.0") @NotNull @Contract(pure=true) @NotNull StatementContext getContext()- Returns:
- The context of this statement, allowing access to parameter names etc.
-
isRenderConstantsAsParameters
@Contract(pure=true) boolean isRenderConstantsAsParameters()Some constants may be rendered as parameters.- Returns:
- True if literal parameters hav
-
setRenderConstantsAsParameters
void setRenderConstantsAsParameters(boolean renderConstantsAsParameters) Use this method to configure whether some constant values should be rendered as parameters or as literals before the first call togetParameters()
orgetCypher()
.Renderers are free to chose to ignore this.
- Parameters:
renderConstantsAsParameters
- Set to true to render constants as parameters (when usinggetCypher()
.
-
doesReturnOrYield
default boolean doesReturnOrYield()- Returns:
- True if this statement can be assured to return something.
-
getCatalog()
andStatementCatalog.getIdentifiableExpressions()