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 ClausecallClause(List<String> namespace, String name, @Nullable List<Expression> arguments, @Nullable List<Expression> resultItems, @Nullable Where optionalWhere) Creates a CALL clause.static ClausecallClause(Statement statement) Creates a CALL {} sub-query clause.static @NotNull Clausecreate(List<PatternElement> patternElements) Builds aCREATEclause.static @NotNull Clausedelete(boolean detach, List<Expression> expressions) Builds aDELETEclause.static ClauseforEach(SymbolicName v, Expression list, List<Clause> updatingClauses) Creates a literal for each clause.static ClauseloadCSV(boolean withHeaders, StringLiteral uri, SymbolicName alias, @Nullable String fieldTerminator) Creates anLOAD CSV clause.static @NotNull Clausematch(boolean optional, List<PatternElement> patternElements, @Nullable Where optionalWhere, @Nullable List<Hint> optionalHints) Builds aMATCHclause.static @NotNull Clausemerge(List<PatternElement> patternElements, @Nullable List<MergeAction> mergeActions) Builds aMERGEclause.static Clauseremove(List<Expression> expressions) Creates aremove clause, removing labels or properties.static @NotNull Returnreturning(boolean distinct, List<Expression> expressions, @Nullable List<SortItem> optionalSortItems, @Nullable Expression optionalSkip, @Nullable Expression optionalLimit) Builds aRETURNclause.static Clauseset(List<Expression> expressions) Creates aremove clause, setting labels or properties.static Clauseunwind(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 aMATCHclause. The result can be safely cast to aMatchif 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 aDELETEclause.- 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 aRETURNclause.- Parameters:
distinct- Should this be a distinct returnexpressions- the expressions to be returnedoptionalSortItems- an optional list of sort itemsoptionalSkip- an optionalNumberLiteralof how many items to skipoptionalLimit- an optionalNumberLiteralof how many items to be returned- Returns:
- an immutable return clause
-
create
Builds aCREATEclause.- 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 aMERGEclause.- 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
-