Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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::dynamic_create[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a note about naming scheme -
for example, functions_aggregating_avg is a label for the avg function
i tried to make it the cypher manual section (functions), then the asciidoc file (or functions group, "aggregating") and then the function in that page

we probably do not have to be super religious with schemes, but i thought i'd bring it up :)

[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::dynamic_create[]

.Result
[role="queryresult",options="footer",cols="4*<m"]
Expand Down
4 changes: 3 additions & 1 deletion modules/ROOT/pages/clauses/load-csv.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,14 @@ Id,Label,Name
----

.Query
[source, cypher, role=test-skip]
// tag::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::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:dynamic_match_parameter[]
[source, cypher]
----
MATCH (movie:$($label))
RETURN movie.title AS movieTitle
----
// end: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:dynamic_match_variable[]
[source, cypher]
----
CALL db.relationshipTypes()
YIELD relationshipType
MATCH ()-[r:$(relationshipType)]->()
RETURN relationshipType, count(r) AS relationshipCount
----
// end: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::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::dynamic_merge[]

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