# tests/cypher/corpus/library.jsonl, method get_document_ancestors
query: "MATCH (d:Document {path: $path, version: $version}) MATCH p = (root:Document)-[:IS_COMPOSED_OF*1..1]->(d) WHERE NOT ( ()-[:IS_COMPOSED_OF]->(root) ) WITH p ORDER BY length(p) DESC LIMIT 1 RETURN [x IN nodes(p)[0..-1] | x] AS spine"
---
Match optional=False
  Path var=None selector=None
    Node var=d labels=(Document) props={path: (Param path), version: (Param version)} where=None
  where=None
Match optional=False
  Path var=p selector=None
    Node var=root labels=(Document) props={} where=None
    Quantified min=1 max=1
      Node var=__a0 labels=* props={} where=None
      Rel var=__r0 types=(IS_COMPOSED_OF) dir=out props={} where=None
      Node var=__a1 labels=* props={} where=None
    Node var=d labels=* props={} where=None
  where=(NOT (Exists #0))
    #0 Exists
      Match optional=False
        Path var=None selector=None
          Node var=__a2 labels=* props={} where=None
          Rel var=__r1 types=(IS_COMPOSED_OF) dir=out props={} where=None
          Node var=root labels=* props={} where=None
        where=None
With distinct=False order=((Func length (Var p)) DESC) skip=None limit=(Lit 1)
  p = (Var p)
  where=None
Return distinct=False order=() skip=None limit=None
  spine = (ListComp x (Slice (Func nodes (Var p)) (Lit 0) (Lit -1)) where=None project=(Var x))
