A method for processing data in one or more data storage systems, the method including: receiving mapping information that specifies one or more attributes (zl, z2) of one or more destination entities (EntityZ) in a destination schema in terms of one or more attributes (al...an, bl...bn, cl...cn etc.) of one or more source entities (EntityA, EntityB, EntityC etc.) in a source schema, at least some of the one or more source entities corresponding to respective sets of records in the one or more data storage systems and processing the mapping information to generate a procedural specification for computing values corresponding to at least some of the one or more attributes (zl, z2) of the one or more destination entities, the procedural specification, when executed, converting between database formats defined by different schemas, wherein processing the mapping information includes generating a plurality of query plans each being a collection of expression nodes (602, 604, 606, 608) related by directed links that can be used to produce a value specified by a query, each query plan including a first node representing a first relational expression associated with an attribute specified by the mapping information, wherein each query plan forms a directed acyclic graph that includes links to one or more other nodes (604, 606, 608) that represent respective relational expressions associated with at least one attribute of at least one source entity referenced by a relational expression of a node in the directed acyclic graph and, merging at least two of the query plans with each other to form a new query plan with a new node structure based on comparing relational expressions of nodes being merged. receiving mapping information that specifies one or more attributes (zl, z2) of one or more destination entities (EntityZ) in a destination schema in terms of one or more attributes (al...an, bl...bn, cl...cn etc.) of one or more source entities (EntityA, EntityB, EntityC etc.) in a source schema, at least some of the one or more source entities corresponding to respective sets of records in the one or more data storage systems and processing the mapping information to generate a procedural specification for computing values corresponding to at least some of the one or more attributes (zl, z2) of the one or more destination entities, the procedural specification, when executed, converting between database formats defined by different schemas, wherein processing the mapping information includes generating a plurality of query plans each being a collection of expression nodes (602, 604, 606, 608) related by directed links that can be used to produce a value specified by a query, each query plan including a first node representing a first relational expression associated with an attribute specified by the mapping information, wherein each query plan forms a directed acyclic graph that includes links to one or more other nodes (604, 606, 608) that represent respective relational expressions associated with at least one attribute of at least one source entity referenced by a relational expression of a node in the directed acyclic graph and, merging at least two of the query plans with each other to form a new query plan with a new node structure based on comparing relational expressions of nodes being merged.