Second-order signature: a tool for specifying data models, query processing, and optimization