Skip to content

Commit 8e445a5

Browse files
renetapopovaGustav Hedengran
andauthored
Add example for new notification "Binding a variable-length relations… (#64)
Cherry-picked from #40 - Removing deprecation examples for "repeated variable length relationship references" since they are being "undeprecated". - Adding example `Binding a variable-length relationship variable more than once` to demonstrate a new notification. Build on top of #35. Co-authored-by: Gustav Hedengran <[email protected]>
1 parent 735ad4a commit 8e445a5

File tree

1 file changed

+14
-66
lines changed

1 file changed

+14
-66
lines changed

modules/ROOT/pages/notifications/all-notifications.adoc

Lines changed: 14 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -686,68 +686,6 @@ m|WARNING
686686
m|DEPRECATION
687687
|===
688688

689-
.Repeated variable length relationship variable inside the same pattern, with same relationship type (when run on a 5.x release)
690-
====
691-
Query::
692-
+
693-
[source,cypher]
694-
----
695-
MATCH ()-[r:PARENT*]-()
696-
MATCH ()-[r:PARENT*]-()
697-
RETURN *
698-
----
699-
700-
Description of the returned code::
701-
Using an already bound variable for a variable length relationship is deprecated and will be removed in a future version. (the repeated variable is: `r`)
702-
703-
Suggestions for improvement::
704-
Inside a single pattern, we have relationship uniqueness, which means that this query never will return any rows and should therefore be rewritten to the wanted behavior.
705-
706-
====
707-
708-
.Repeated variable length relationship across patterns, with the same relationship type
709-
====
710-
Query::
711-
+
712-
[source,cypher]
713-
----
714-
MATCH ({name:"Molly"})-[r:KNOWS*]->({name:"Kalle"})
715-
MATCH ({age:25})-[r:KNOWS*]->({age:21})
716-
RETURN r
717-
----
718-
719-
Description of the returned code::
720-
Using an already bound variable for a variable length relationship is deprecated and will be removed in a future version. (the repeated variable is: `r`)
721-
722-
Suggestions for improvement::
723-
Since the relationships in the first and second match must be the same, we know that the start node and the end node are the same.
724-
In the query above, we could therefore concatenate the predicates from the two matches and create a single match:
725-
+
726-
[source,cypher]
727-
----
728-
MATCH ({name:"Molly", age:25})-[r:KNOWS*]->({name:"Kalle", age:21})
729-
RETURN r
730-
----
731-
====
732-
733-
.Repeated variable length relationship across patterns with different relationship types
734-
====
735-
Query::
736-
+
737-
[source,cypher]
738-
----
739-
MATCH ()-[r:PARENT*]-()
740-
MATCH ()-[r:CHILD*]-()
741-
RETURN *
742-
----
743-
744-
Description of the returned code::
745-
Using an already bound variable for a variable length relationship is deprecated and will be removed in a future version. (the repeated variable is: `r`)
746-
747-
Suggestions for improvement::
748-
Since the relationships in the first and second match must be the same, and a single relationship can't have multiple relationship types, this query will never return any rows.
749-
====
750-
751689
.Colon after the | in a relationship pattern
752690
====
753691
Query::
@@ -1144,9 +1082,7 @@ Relationship type expression cannot possibly be satisfied. (`R1&R2` can never be
11441082
====
11451083

11461084
[#_neo_clientnotification_statement_repeatedrelationshipreference]
1147-
=== RepeatedRelationshipReference
1148-
1149-
label:introduced-in-Neo4j-5.5[Introduced in Neo4j 5.5]
1085+
=== Neo.ClientNotification.Statement.RepeatedRelationshipReference
11501086

11511087
.Notification category details
11521088
[cols="<1s,<4"]
@@ -1161,7 +1097,7 @@ m|WARNING
11611097
m|GENERIC
11621098
|===
11631099

1164-
.Binding a relationship variable more than once
1100+
.Binding a relationship variable more than once (when run on version 5.5 or newer)
11651101
====
11661102
Query::
11671103
+
@@ -1180,3 +1116,15 @@ Use one pattern to match all relationships that start with a node with the label
11801116
MATCH (:A)-[r]->(:B) RETURN r
11811117
----
11821118
====
1119+
1120+
.Binding a variable-length relationship variable more than once (when run on version 5.6 or newer)
1121+
====
1122+
Query::
1123+
+
1124+
[source,cypher]
1125+
----
1126+
MATCH ()-[r*]->()<-[r*]-() RETURN count(*) AS count
1127+
----
1128+
Description of the returned code::
1129+
A variable-length relationship variable is bound more than once, which leads to no results because relationships must not occur more than once in each result. (Relationship r was repeated)
1130+
====

0 commit comments

Comments
 (0)