🤖 AI Summary
In model-driven development, verifying semantic consistency between manually written SQL implementations and UML/OCL constraints remains challenging due to the lack of automated, formal verification techniques.
Method: This paper proposes a formal verification approach based on semantic mapping and SMT-based automated reasoning. It constructs a semantics-preserving mapping from a carefully defined SQL subset to multi-sorted first-order logic, uniformly integrating existing OCL logical semantics to enable fully automated fidelity checking—i.e., whether SQL correctly implements OCL constraints—using off-the-shelf SMT solvers such as Z3.
Contribution/Results: The method overcomes the traditional reliance on manual inspection for database query validation, establishing an end-to-end, formally grounded verification pipeline from UML/OCL models to executable, verifiable SQL. It successfully validates multiple non-trivial industrial-scale OCL constraints and has been implemented in a prototype toolchain, significantly enhancing correctness assurance for the database layer in data-intensive applications.
📝 Abstract
In the context of the model-driven development of data-centric applications, OCL constraints play a major role in adding precision to the source models (e.g., data models and security models). Several code-generators have been proposed to bridge the gap between source models with OCL constraints and their corresponding database implementations. However, the database queries produced by these code-generators are significantly less efficient -- from the point of view of execution-time performance -- than the implementations manually written by database experts. In this paper, we propose a different approach to bridge the gap between models with OCL constraints and their corresponding database implementations. In particular, we introduce a model-based methodology for proving the correctness of manually written SQL implementations of OCL constraints. This methodology is based on a novel mapping from a significant subset of the SQL language into many-sorted first-order logic. Moreover, by leveraging on an already existing mapping from the OCL language into many-sorted first-order logic, we can use SMT solvers to automatically prove the correctness of SQL implementations of OCL constraints. To illustrate and show the applicability of our approach, we include in the paper a number of non-trivial examples. Finally, we report on the status of a suite of tools supporting our approach.