Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/ROOT/pages/clauses/create.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ This is because a relationship can only have exactly one type.
----

.Create nodes and relationships using dynamic node labels and relationship types
// tag::clauses_create_dynamic_create[]
[source, cypher]
----
CREATE (greta:$($nodeLabels) {name: 'Greta Gerwig'})
Expand All @@ -243,6 +244,7 @@ UNWIND $movies AS movieTitle
CREATE (greta)-[rel:$($relType)]->(m:Movie {title: movieTitle})
RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collect(m.title) AS movies
----
// end::clauses_create_dynamic_create[]

.Result
[role="queryresult",options="footer",cols="4*<m"]
Expand Down
6 changes: 4 additions & 2 deletions modules/ROOT/pages/clauses/load-csv.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ It also mitigates the risk of Cypher injection.
(For more information about Cypher injection, see link:https://neo4j.com/developer/kb/protecting-against-cypher-injection/[Neo4j Knowledge Base -> Protecting against Cypher injection]).

.bands-with-headers.csv
[source, csv, filename="artists-with-headers.csv"]
[source, csv, filename="bands-with-headers.csv"]
----
Id,Label,Name
1,Band,The Beatles
Expand All @@ -319,12 +319,14 @@ Id,Label,Name
----

.Query
[source, cypher, role=test-skip]
// tag::clauses_load_csv_dynamic_columns[]
[source, cypher]
----
LOAD CSV WITH HEADERS FROM 'file:///bands-with-headers.csv' AS line
MERGE (n:$(line.Label) {name: line.Name})
RETURN n AS bandNodes
----
// end::clauses_load_csv_dynamic_columns[]

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
Expand Down
8 changes: 7 additions & 1 deletion modules/ROOT/pages/clauses/match.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ RETURN directors
1+d|Rows: 2
|===

.Match nodes dynamically using the `any()` function
.Match nodes dynamically using `any()`
[source, cypher]
----
MATCH (n:$any(["Movie", "Actor"]))
Expand Down Expand Up @@ -577,11 +577,14 @@ RETURN n AS nodes
----

.Match nodes dynamically using a parameter
// tag::clauses_match_dynamic_match_parameter[]
[source, cypher]
----
MATCH (movie:$($label))
RETURN movie.title AS movieTitle
----
// end::clauses_match_dynamic_match_parameter[]


.Result
[role="queryresult",options="header,footer",cols="1*<m"]
Expand All @@ -596,13 +599,16 @@ RETURN movie.title AS movieTitle


.Match relationships dynamically using a variable
// tag::clauses_match_dynamic_match_variable[]
[source, cypher]
----
CALL db.relationshipTypes()
YIELD relationshipType
MATCH ()-[r:$(relationshipType)]->()
RETURN relationshipType, count(r) AS relationshipCount
----
// end::clauses_match_dynamic_match_variable[]


.Result
[role="queryresult",options="header,footer",cols="2*<m"]
Expand Down
2 changes: 2 additions & 0 deletions modules/ROOT/pages/clauses/merge.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ This is because the xref:planning-and-tuning/execution-plans.adoc[Cypher planner
----

.Merge nodes and relationships using dynamic node labels and relationship types
// tag::clauses_merge_dynamic_merge[]
[source, cypher]
----
MERGE (greta:$($nodeLabels) {name: 'Greta Gerwig'})
Expand All @@ -726,6 +727,7 @@ UNWIND $movies AS movieTitle
MERGE (greta)-[rel:$($relType)]->(m:Movie {title: movieTitle})
RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collect(m.title) AS movies
----
// end::clauses_merge_dynamic_merge[]

.Result
[role="queryresult",options="footer",cols="3*<m"]
Expand Down