Getting relationships from variable length path

MATCH p=(user)-[r1:roles]->(role1:`Role`)-[:include*0..]->(role2:`Role`)

I need to get only relationships with type include from the cypher above. Thanks.

You can use relationships(p) to get the list of relationships in the path, and you can combine that with a filter to only get the ones that are of type include:

MATCH p=(user)-[r1:roles]->(role1:`Role`)-[:include*0..]->(role2:`Role`)
WITH [rel in relationships(p) WHERE type(rel) = 'include'] as includeRels
...

Thanks @andrew_bowman