     ] if ;
 
 : get-root-nodes ( node-id -- root-nodes )
-    (get-root-nodes) flatten natural-sort uniq ;
+    (get-root-nodes) flatten prune ;

! Copyright (C) 2008 Alex Chapman
! See http://factorcode.org/license.txt for BSD license.
USING: accessors db.tuples kernel new-slots semantic-db
semantic-db.relations sorting sequences sequences.deep ;
IN: semantic-db.hierarchy

TUPLE: tree id children ;

: get-node-hierarchy ( node-id -- tree )
    dup children [ get-node-hierarchy ] map <tree> ;

: (get-root-nodes) ( node-id -- root-nodes/node-id )
    dup parents dup empty? [
        drop
