eggbird
software development and
knowledge engineering

Mail

ROIS

System.getSubsumptionPath

// returns all nodes in subsumption path
// from lower to upper node
// result excludes %lower, includes %upper
CLIENT TASK getSubsumptionPath @model %upper %lower :`path;

DEFINE %ancestor;

BEGIN
  #unreferenced @model;
  FOREACH ANCESTOR BREADTHFIRST %ancestor OF %lower DO
    IF %ancestor HAS ANCESTOR %upper THEN
      `path:=%ancestor+`path;
    ELSIF %ancestor EQUALS %upper THEN
      `path:=%ancestor+`path;
      EXIT;
    ENDIF;
  ENDFOR;
END getSubsumptionPath;