How to match to alternative node labels in relationship

I'm a newbie and was playing with the example graph in apoc.nodes.cycles. I wanted to generate the same graph as shown using the apoc.nodes.cycles call (which is currently failing).

I know... I can do something like:
match (s:Start|Module)-[r]-(d:Start|Module) (since all the relationships start or end on a Start or Module node). No Joy! :face_with_raised_eyebrow:

So I tried the Cheat sheet:
MATCH (n:A|B)
RETURN n.name AS name
(with appropriate label changes). Still no Joy! :grimacing:

Eventually, I got what I wanted:
match (s1:Start)-[r1]-(s2:Start)
with s1,r1,s2
match (s3:Start)-[r2]-(m1:Module)
with s1,s2,s3,m1,r1,r2
match (m2:Module)-[r3]-(m3:Module)
return s1,s2,s3,m1,m2,m3,r1,r2,r3

Why is the cheat sheet version of alternatives not working? Is there any simpler syntax to achieve the desired result?
TIA,
Paolo
[Edit: I DID try replacing the Bar character with OR, to no avail]

Hello @pcantoni ,

First question is what version is your database?

Second question, what error is returned for your query :

match (s:Start|Module)-[r]-(d:Start|Module) (since all the relationships start or end on a Start or Module node)

Version is4.4.17 Community Edition

Message returned is:
Neo.ClientError.Statement.SyntaxError
Invalid input '|': expected an identifier character, whitespace, NodeLabel, a property map, a WHERE subclause, ')' or a relationship pattern (line 1, column 15 (offset: 14))
"match (s:Start|Module)-[r]-(d:Start|Module)"

Paolo

The syntax you are attempting is supported in V5 of Neo4j, not V4.

Elaine

Thanks, Elaine @elaine_rosenber,
I'll see about getting the Database updated.

Paolo