1. A computer-implemented method for optimizing a database query to return ontological data from a database, the method comprising: receiving the database query; analyzing the database query to determine whether the query satisfies a first condition, the first condition being satisfied if the database query comprises a SELECT statement and an ontological clause in the form of a Change Query Attribute (CHGQRYA) clause, wherein the Change Query Attribute clause is composed of a Substitute Forward clause, Substitute Backward clause, or a Group By At Level clause; analyzing the database to determine whether the database satisfies a second condition, the second condition being satisfied if the database defines an ontological data structure for the Change Query Attribute clause; and when the first condition and the second condition are both affirmatively satisfied, performing the steps of: accessing the database; parsing the ontological data structure to extract an ontological relationship for the Change Query Attribute clause; using the extracted ontological relationship to modify an attribute of the database query; and executing the database query to return data from the database, wherein the data is associated with the ontological relationship.