java.lang.Object
org.neo4j.cypherdsl.core.Clauses
Builder / factory for various
clauses
. It's mostly useful for building a Cypher-DSL AST
outside of the fluent API.- Since:
- 2021.3.0
- Author:
- Michael J. Simons
-
Method Summary
Modifier and TypeMethodDescriptionstatic Clause
callClause
(List<String> namespace, String name, @Nullable List<Expression> arguments, @Nullable List<Expression> resultItems, @Nullable Where optionalWhere) Creates a CALL clause.static Clause
callClause
(Statement statement) Creates a CALL {} sub-query clause.static @NotNull Clause
create
(List<PatternElement> patternElements) Builds aCREATE
clause.static @NotNull Clause
delete
(boolean detach, List<Expression> expressions) Builds aDELETE
clause.static Clause
forEach
(SymbolicName v, Expression list, List<Clause> updatingClauses) Creates a literal for each clause.static Clause
loadCSV
(boolean withHeaders, StringLiteral uri, SymbolicName alias, @Nullable String fieldTerminator) Creates anLOAD CSV clause
.static @NotNull Clause
match
(boolean optional, List<PatternElement> patternElements, @Nullable Where optionalWhere, @Nullable List<Hint> optionalHints) Builds aMATCH
clause.static @NotNull Clause
merge
(List<PatternElement> patternElements, @Nullable List<MergeAction> mergeActions) Builds aMERGE
clause.static Clause
remove
(List<Expression> expressions) Creates aremove clause
, removing labels or properties.static @NotNull Return
returning
(boolean distinct, List<Expression> expressions, @Nullable List<SortItem> optionalSortItems, @Nullable Expression optionalSkip, @Nullable Expression optionalLimit) Builds aRETURN
clause.static Clause
set
(List<Expression> expressions) Creates aremove clause
, setting labels or properties.static Clause
unwind
(Expression expression, SymbolicName name) Creates anunwind clause
.static Clause
-
Method Details
-
match
@NotNull public static @NotNull Clause match(boolean optional, List<PatternElement> patternElements, @Nullable @Nullable Where optionalWhere, @Nullable @Nullable List<Hint> optionalHints) Builds aMATCH
clause. The result can be safely cast to aMatch
if needed.- Parameters:
optional
- Should this be an optional match?patternElements
- The pattern elements to matchoptionalWhere
- An optional where sub-clauseoptionalHints
- Optional hints to be used- Returns:
- an immutable match clause
- Since:
- 2022.0.0
-
delete
Builds aDELETE
clause.- Parameters:
detach
- Should this be an detach delete?expressions
- The expressions pointing to the things to be deleted- Returns:
- an immutable delete clause
-
returning
@NotNull public static @NotNull Return returning(boolean distinct, List<Expression> expressions, @Nullable @Nullable List<SortItem> optionalSortItems, @Nullable @Nullable Expression optionalSkip, @Nullable @Nullable Expression optionalLimit) Builds aRETURN
clause.- Parameters:
distinct
- Should this be a distinct returnexpressions
- the expressions to be returnedoptionalSortItems
- an optional list of sort itemsoptionalSkip
- an optionalNumberLiteral
of how many items to skipoptionalLimit
- an optionalNumberLiteral
of how many items to be returned- Returns:
- an immutable return clause
-
create
Builds aCREATE
clause.- Parameters:
patternElements
- The pattern elements to create- Returns:
- an immutable create clause
-
merge
@NotNull public static @NotNull Clause merge(List<PatternElement> patternElements, @Nullable @Nullable List<MergeAction> mergeActions) Builds aMERGE
clause.- Parameters:
patternElements
- The pattern elements to mergemergeActions
- An optional list ofmerge actions
- Returns:
- an immutable merge clause
-
with
- Parameters:
returnClause
- The return clause that defines the fields, order and limit of what the with clause should returnoptionalWhere
- An optional WHERE expression to define a where clause.- Returns:
- an immutable with clause
- Since:
- 2022.0.0
-
remove
Creates aremove clause
, removing labels or properties.- Parameters:
expressions
- Expressions pointing to a list of properties or labels that shall be removed- Returns:
- an immutable remove clause
-
set
Creates aremove clause
, setting labels or properties.- Parameters:
expressions
- Expressions pointing to a list of properties or labels that shall be set- Returns:
- an immutable set clause
-
unwind
Creates anunwind clause
.- Parameters:
expression
- The expression to unwindname
- The name on which to unwind- Returns:
- an immutable unwind clause
-
loadCSV
public static Clause loadCSV(boolean withHeaders, StringLiteral uri, SymbolicName alias, @Nullable @Nullable String fieldTerminator) Creates anLOAD CSV clause
.- Parameters:
withHeaders
- Set to true to render the WITH HEADERS optionsuri
- the source to load fromalias
- the alias for the linesfieldTerminator
- the field terminator- Returns:
- an immutable clause
-
callClause
public static Clause callClause(List<String> namespace, String name, @Nullable @Nullable List<Expression> arguments, @Nullable @Nullable List<Expression> resultItems, @Nullable @Nullable Where optionalWhere) Creates a CALL clause.- Parameters:
namespace
- An optional namespace, maybe emptyname
- The name of the stored procedure to callarguments
- the arguments, maybe null or emptyresultItems
- the result items, maybe null or emptyoptionalWhere
- an optional where- Returns:
- An immutable clause
- Since:
- 2022.0.0
-
callClause
Creates a CALL {} sub-query clause. No checking is done whether the statement passed in returns anything meaningful so that the resulting clause will be runnable or not.- Parameters:
statement
- A statement to be used inside the sub-query.- Returns:
- An immutable sub-query clause.
-
forEach
Creates a literal for each clause.- Parameters:
v
- The name of the variable that should be available in the list of updating clauseslist
- The list on which to iterateupdatingClauses
- The updating clauses- Returns:
- An immutable foreach clause
-