Failing to write a cypher query that _should_ be simple

Hi all,

In my graph I have two node types: Page and Taxon. All Page nodes belong to Taxons and a Taxon may have ancestor Taxons.

Specifically:
- any Page belongs to one or more Taxons (relationship: BELONGS_TO)
- any Taxon may have one parent Taxon (relationship: HAS_PARENT)
- Taxons have a unique "name" property

My problem is: given a taxon name, match all the Pages that belong to the Taxon with this name, or that "descend" from a Taxon with this name.

Thanks both. I did indeed make the mistake of thinking * is *0..

This can be done by using a variable-length pattern, with one gotcha

MATCH (p:Page)-[:IS_TAGGED_TO]->(t:Taxon)-[:HAS_PARENT*]->(:Taxon {key: 'value'})
RETURN t.key, COUNT(p)
;

It doesn't work, because * means "one or more", not the conventional "zero or more" of other wildcard syntaxes such as regex. In other words, * expands to *1.. not *0.. The solution is to spell it out as *0..

MATCH (p:Page)-[:IS_TAGGED_TO]->(t:Taxon)-[:HAS_PARENT*0..]->(:Taxon {key: 'value'})
RETURN t.key, COUNT(p)
;

Try this:

match(t:Taxon{name:’insert name to find’})

match(t)<-[:HAS_PARENT*0..]-(:Taxon)<-[:BELONGS_TO]-(p:Page)

return p