Ordering of categorical data (by attribute and by metadata)