Patent ID: 7185024

Claim:
A method for transferring data from a database into a hierarchical structure, the method comprising: accepting a tagging tree, the tagging tree comprising at least one tagging node that each specifies a field in a hierarchical structure, a plurality of execution nodes that each specifies a database query command for at least one data object, and at least one data node that each specifies a binding between each of the at least one data object and at least one field specified in the at least one tagging node; creating at least one query tree, each query tree within the at least one query tree comprising the plurality of execution nodes configured with parent child relationships similar to the hierarchical structure; combining at least two of the plurality of execution nodes into at least one composite database query, wherein each of the at least one composite database query specifies a same data source; estimating, for each non-leaf node of at least one query tree within the at least one query tree, an estimated query result size for each non-leaf node of the at least one query tree; assigning a product of estimated sizes to each leaf node of the at least one query tree, the product of estimated sizes for a particular leaf node of the at least one query tree equaling a product of all estimated query result sizes that were estimated for each ancestor non-leaf node of the particular leaf node of the at least one query tree; selecting a highest value leaf node, the highest value leaf node having a largest product of estimated sizes; forming the composite database query by merging the database queries specified by ancestor non-leaf nodes of the highest value leaf node; executing the single database query to retrieve a set of data objects; and creating an output having a composite hierarchical structure with a plurality of fields, the output being created by placing at least one data object within the set of data objects into at least one field of the plurality of fields based upon the at least one data node.