Return subpattern | pattern cutoff

Hello, I'd like to know how to write a query that returns pattern cut at certain hop - in this example at ( lex ) --> ( sem ) from a side opposite to starting point ( x ). Or in other words I need a subtree derived of ( x ) without hoping over a ( sem ) to another ( lex ).

My current query is:

MATCH p = ( l :lex ) - [ * ] - ()
WHERE ID( l ) = 119
RETURN p

A cypher query will return all the individual paths as rows. You may want to look at the apoc library’s path procedures. They may be better suited for your needs to derive a subpath from a node.

This works. Thank alot!

MATCH ( l :lex )

WHERE ID( l ) = 119

CALL apoc.path.subgraphAll(

l,

{ relationshipFilter: "EX|SIG>" }

)

YIELD nodes, relationships

RETURN nodes, relationships;

1 Like