1. A computer readable storage medium, comprising executable instructions to: derive from a database schema an irreducible ambiguous group comprising a sub-schema with a set of vertices wherein any two vertices are part of a loop; designate joins in the sub-schema as mandatory joins, excluded joins and neutral joins; and define a context as a list of selected joins in the sub-schema.