Directory lib://DataFiles/ ; // ======================== Nodes =============================================== // Generate Expanded Nodes view of the Wine district nodes; // i.e. keep original table, but add one field per level in the hierarchy // ============================================================================== [Nodes]: Hierarchy (NodeID, ParentID, Name, ParentName, Name, Path, '/', Depth) LOAD NodeID as NodeID, If(Len(ParentID),ParentID) as ParentID, Name as Name FROM [Winedistricts.txt] (txt, utf8, embedded labels, delimiter is ',', msq); // ======================== Trees =============================================== // Generate Ancestor table, i.e. create a new table with one record per Ancestor- // Descendent relation. Each ancestor will represent a District will ALL sub-nodes. // ============================================================================== [Trees]: HierarchyBelongsTo (NodeID, ParentID, NodeNameCopy, TreeID, Tree) Load NodeID as NodeID, ParentID as ParentID, Name as NodeNameCopy Resident [Nodes] ;