Structuring data with subtree lattices