Similar Items: Partially Ordered Automata and Piecewise Testability