A Framework for the Comparison of Complex Patterns