So far we have developed the mapping of static constructs of the object model (constructs of the class diagram) on a relational data schema. The latter needs to be refined in order to satisfy the data navigation requirements of the transactions to be implemented in the application under development. To do this, we use an inference engine that examines the dynamic models developed during the Object Analysis and Design (OOAD) phases of OMAR to infer the characteristics of the transactions. This has the twofold goal to enhance the relational data schema and to generate the structure of the code implementing the transactions. In particular our engine exploits the functional models and the State Diagrams.
The functional models highlight the dependencies between certain data through the functions contained in the Data Flow Diagrams. In fact, we can examine these diagrams to verify whether the functions use intermediate data to relate a pair of data. Thus, we can use Data Flow Diagrams to infer some functional dependencies to be used for normalization purposes. The data flows of a Data Flow Diagram correspond to attribute values of a Class Diagram, whereas the processes correspond to actions or activities of the State Diagram for a class.
The State Diagram for a class shows the dynamic behaviour of the class. The examination of the State Diagrams can help detecting classes that are not significant enough to have a table associated in the underlying relational database schema. For instance, this happens when a class is associated to a State Diagram with states that do not have a Data Flow representation, meaning that they only perform elementary operations. Thus, if the class had previously been associated to a table, the inference engine tries to eliminate such a table. To do this it examines the complexity of the class structure in the Class Diagram and verifies whether the name of the class appears as a Data Store item in one of the Data Flow diagrams associated to a related class.
In the following we show the Prolog code for this portion of the inference engine:
Makes the class CLASSNAME persistent if it is indicated as transient but it appears as a data store in a Data Flow Diagram.
LIST OF ATTRIBUTES is a Primary Key for the table TABLENAME if there exists a function capable of selecting the class instances to be stored in the table TABLENAME by using the attributes in LIST OF ATTRIBUTES.