# tests/cypher/corpus/library.jsonl, method get_structure_nodes_for_model_instance
query: "MATCH (mi:ModelInstance {uid: $uid}) MATCH p = (sn:StructureNode)-[:HAS_EXTRACTION]->(:ExtractionResult)-[rels*1..12]->(mi) WHERE all(r IN rels WHERE type(r) STARTS WITH 'HAS_') RETURN DISTINCT sn { .*, _labels: labels(sn) } AS n, min(length(p)) AS hops ORDER BY hops"
---
Match optional=False
  Path var=None selector=None
    Node var=mi labels=(ModelInstance) props={uid: (Param uid)} where=None
  where=None
Match optional=False
  Path var=p selector=None
    Node var=sn labels=(StructureNode) props={} where=None
    Rel var=__r0 types=(HAS_EXTRACTION) dir=out props={} where=None
    Node var=__a0 labels=(ExtractionResult) props={} where=None
    Quantified min=1 max=12
      Node var=__a1 labels=* props={} where=None
      Rel var=rels types=* dir=out props={} where=None
      Node var=__a2 labels=* props={} where=None
    Node var=mi labels=* props={} where=None
  where=(all r (Var rels) where=(STARTS WITH (Func type (Var r)) (Lit "HAS_")))
Return distinct=True order=((Var hops) ASC) skip=None limit=None
  n = (MapProjection (Var sn) .* (_labels (Func labels (Var sn))))
  hops = (Func min (Func length (Var p)))
