Skip to content

Commit

Permalink
more tags
Browse files Browse the repository at this point in the history
  • Loading branch information
JPryce-Aklundh committed Nov 29, 2024
1 parent 57b1d4d commit e362c6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/ROOT/pages/clauses/match.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ RETURN movie.title
=== MATCH using node label expressions

.Node pattern using the `OR` (`|`) label expression
// tag::clauses_match_label_expression_or[]
[source, cypher]
----
MATCH (n:Movie|Person)
RETURN n.name AS name, n.title AS title
----
// end::clauses_match_label_expression_or[]


.Result
[role="queryresult",options="header,footer",cols="2*<m"]
Expand All @@ -111,11 +114,14 @@ RETURN n.name AS name, n.title AS title
|===

.Node pattern using negation (`!`) label expression
// tag::clauses_match_label_expression_negation[]
[source, cypher]
----
MATCH (n:!Movie)
RETURN labels(n) AS label, count(n) AS labelCount
----
// end::clauses_match_label_expression_negation[]


[NOTE]
The above query uses the xref:functions/list.adoc#functions-labels[`labels()`] and xref:functions/aggregating.adoc#functions-count[`count()`] functions.
Expand Down Expand Up @@ -260,11 +266,14 @@ RETURN actor.name AS actor
It is possible to match a pattern containing one of several relationship types using the `OR` symbol, `|`.

.Relationship pattern including either `ACTED_IN` or `DIRECTED` relationship types
// tag::clauses_match_type_expression_or[]
[source, cypher]
----
MATCH (:Movie {title: 'Wall Street'})<-[:ACTED_IN|DIRECTED]-(person:Person)
RETURN person.name AS person
----
// end::clauses_match_type_expression_or[]


.Result
[role="queryresult",options="header,footer",cols="1*<m"]
Expand Down
6 changes: 6 additions & 0 deletions modules/ROOT/pages/patterns/non-linear-patterns.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ image::patterns_equijoins_motif2.svg[width="700",role="middle"]
Putting this path pattern with an equijoin in a query, the times of the outbound and return journeys can be returned:

.Query
// tag::patterns_non_linear_patterns_equijoin[]
[source, cypher]
----
MATCH (n:Station {name: 'London Euston'})<-[:CALLS_AT]-(s1:Stop)
Expand All @@ -70,6 +71,8 @@ MATCH (n:Station {name: 'London Euston'})<-[:CALLS_AT]-(s1:Stop)
RETURN s1.departs+'-'+s2.departs AS outbound,
s3.departs+'-'+s4.departs AS `return`
----
// end::patterns_non_linear_patterns_equijoin[]


.Result
[role="queryresult",options="header,footer",cols="2*<m"]
Expand Down Expand Up @@ -181,6 +184,7 @@ The other node variables are for the `WHERE` clause or for returning data.
Putting this together, the resulting query returns the earliest arrival time achieved by switching to an express service:

.Query
// tag::patterns_non_linear_patterns_graph_pattern[]
[source, cypher]
----
MATCH (:Station {name: 'Starbeck'})<-[:CALLS_AT]-
Expand All @@ -197,6 +201,8 @@ RETURN a.departs AS departs,
y.arrives AS arrives
ORDER BY y.arrives LIMIT 1
----
// end::patterns_non_linear_patterns_graph_pattern[]


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

0 comments on commit e362c6b

Please sign in to comment.