<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">Extracting UML/OCL Integrity Constraints and Derived Types from Relational Databases</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Valerio</forename><surname>Cosentino</surname></persName>
							<email>valerio.cosentino@mines-nantes.fr</email>
							<affiliation key="aff0">
								<orgName type="department">AtlanMod team</orgName>
								<orgName type="institution" key="instit1">Mines Nantes</orgName>
								<orgName type="institution" key="instit2">INRIA &amp; LINA</orgName>
								<address>
									<settlement>Nantes</settlement>
									<country key="FR">France</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Salvador</forename><surname>Martínez</surname></persName>
							<email>salvador.martinez@mines-nantes.fr</email>
							<affiliation key="aff0">
								<orgName type="department">AtlanMod team</orgName>
								<orgName type="institution" key="instit1">Mines Nantes</orgName>
								<orgName type="institution" key="instit2">INRIA &amp; LINA</orgName>
								<address>
									<settlement>Nantes</settlement>
									<country key="FR">France</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">Extracting UML/OCL Integrity Constraints and Derived Types from Relational Databases</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">8E06FC357BDF9D56E3092BCE2A2A65AA</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-24T19:54+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Relational databases usually enforce relevant organizational business rules. This aspect is ignored by current database reverse engineering approaches which only focus on the extraction of the structural part of the conceptual schema. Other database elements like triggers, views, column constraints, etc. are not considered by those methods. As a result, the generated conceptual schema is incomplete since integrity constraints and derivation rules enforced by the database are not represented. In this sense, this paper extends existing approaches by enriching the generated (UML) conceptual schema with a set of OCL integrity constraints and derivation rules inferred from the database schema. Our method has been implemented in a prototype tool for the Oracle database management system.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>Relational databases play a key role in most organizations storing the data they need for their business operations. To make sure the data is consistent, a set of integrity constraints is defined as part of the database schema. These constraints must be obviously aligned with the organizational policies and rules.</p><p>Therefore, it is very important these constraints evolve together with the own organization as it adapts to the changing needs of the market. Unfortunately, discovering and understanding the set of business rules enforced by a given database system is a timeconsuming and error-prone activity since it implies querying/browsing the database dictionary to extract and analyze the retrieved data. Note that, even if SQL is a standard language, each vendor presents slight variations on the SQL language they support and use a completely different structure for their data dictionary which makes the process different for each database management system (DBMS).</p><p>To facilitate the comprehension of the enforced rules and their evolution, we believe the rules must be described using an homogeneous representation and at a higherabstraction level. In this sense, this paper presents a new model-based reverse engineering approach able to extract a conceptual schema (CS) out of a running database where the CS is expressed as an UML class diagram extended with a set of Object Constraint Language (OCL) expressions to represent the integrity constraints and derivation rules contained in the database schema. Each OCL expression is the direct translation at the conceptual level of either one of the database constraints (e.g., CHECK constraints, keys or even constraints enforced by means of triggers) or view definitions. To the best of our knowledge, ours is the first reverse engineering method to cover these two aspects.</p><p>Without loss of generality, we particularized our method for the Oracle DBMS. Moreover, our solution is based on the principles of Model Driven Engineering (MDE) which facilitates reusing the plethora of available model-based tools for manipulating and processing the obtained models.</p><p>This paper is structured as follows: Section 2 presents the state of the art; Section 3-5 describes the proposed approach; Section 6 concludes this paper.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">State of the Art</head><p>The integration of conceptual models and database applications is a research domain that has been explored extensively. On the one hand, approaches to translate UML class diagrams to database schemas and the embedded OCL constraints into integrity constraints have been proposed ([1], <ref type="bibr" target="#b1">[2]</ref>). On the other hand, the extraction of class diagrams out of database schemas has been largely studied as well ( <ref type="bibr" target="#b2">[3]</ref>, <ref type="bibr" target="#b3">[4]</ref>, <ref type="bibr" target="#b4">[5]</ref>, <ref type="bibr" target="#b5">[6]</ref>). Nevertheless, these works do not cover the views or constraints (beyond primary and foreign keys) also included in the schema. The possibility of representing database views within UML models has been analysed in <ref type="bibr" target="#b6">[7]</ref>. There, the author shows how the notion of relational database views can be correctly expressed as derived classes in UML using OCL constructs and relying on the expressiveness of OCL as query language <ref type="bibr" target="#b7">[8]</ref>, but no method is proposed to automatically infer those OCL expressions from the actual database view definition.</p><p>Reverse engineering of database constraints is partially covered in <ref type="bibr" target="#b8">[9]</ref>, where an approach for rephrasing constraints using the Semantics of Business Vocabulary and Business Rules (SBVR) notation is presented. Nevertheless, only a small subset of column constraints (CHECK and NOT NULL) is supported. Our work supports a much richer set of database constraints (including constraints enforced by means of triggers) and also view definitions.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Approach Overview</head><p>Our reverse engineering method (shown in Fig. <ref type="figure" target="#fig_0">1</ref>) is composed by two steps: Model Extraction and Constraint Extraction.  It is composed by two operations respectively dedicated to create the UML classes and associations corresponding to the database tables and their relations, and to extend the obtained model by adding a set of derived classes to represent the database views.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>DATABASE UML/OCL</head><p>Constraint Extraction focuses on inferring the OCL expressions required to complement the UML model. Substeps of this method cover the declarative constraints (CHECK, UNIQUE,...) and the analysis of triggers<ref type="foot" target="#foot_0">1</ref> since, beyond other applications, triggers can also be used to enforce complex integrity constraints. Key elements in this step are the SQL-to-OCL and PL/SQL-to-OCL transformations, which are used to map SQL and PL/SQL constructs to OCL. Since triggers often merge SQL and procedural code, SQL-to-OCL is included in PL/SQL-to-OCL.</p><p>In the following, these steps are described in detail.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">Model Extraction</head><p>The Model Extraction phase translates tables and views into an equivalent set of classes and associations in an UML class diagram. As typically done in existing approaches, each table generates a class (or an association class) in the CS and table columns (except for foreign keys) are mapped into attributes of the corresponding class. Foreign keys are used to create associations between the classes, while the corresponding cardinalities can be calculated by performing SQL queries on the data stored in the database <ref type="bibr" target="#b9">[10]</ref>.</p><p>The type of the attributes depends on the type of the columns. Character data types (CHAR(n), VARCHAR2(n), etc.) are transformed to String types. Number and datetime data types (Integer, Float, Date, etc.) are transformed into their equivalent UML types: Integer, Real and Date. The Number(precision, scale) is transformed into an Integer data type when precision is zero and into a Real type otherwise. Other Oracle data types can be represented by defining new data types in the UML model. classes. An Employee in the UML model is defined by the attributes employee ID, first name, last name and salary. These attributes are derived from columns where no foreign key constraints are defined. The foreign keys are translated into UML associations; therefore an Employee has one Job (i.e., emp job fk) and belongs to one Department (i.e., emp dept fk). Accordingly to the previous mappings, a Department is described by an unique department id, its name and the manager leading it (i.e., dept mgr fk). Finally, a Job is depicted by an unique job id, by its title and the corresponding maximum and minumum salaries for that job.</p><formula xml:id="formula_0">CREATE)TABLE)Department)F ))))))department_id))))))))INTEGER)PRIMARY)KEY; ))))))department_name))VARCHARF2sl)NOT)NULL; ))))))manager_id)))))))INTEGER)UNIQUE)NOT)NULL; ))))))CONSTRAINT)dept_mgr_fk ))))))FOREIGN)KEY)Fmanager_idl ))))))REFERENCES)EmployeeFemployee_idl l* CREATE)TABLE)Job)F ))))))job_id)))))))))))INTEGER)PRIMARY)KEY; ))))))job_title))))))))VARCHARF2&gt;l)NOT)NULL; ))))))min_salary)))NUMBERFJl; ))))))max_salary))NUMBERFJl l* CREATE)TABLE)Employee)F ))))))employee_id)))))))INTEGER)PRIMARY)KEY; ))))))first_name)))))))))))VARCHARxFxsl; ))))))last_name)))))))))))VARCHARxFx&gt;l)NOT)NULL; ))))))salary))))))))))))))))))NUMBERF:;xl)CHECK)Fsalary)&gt;)sl;) ))))))department_id)))))INTEGER)NOT)NULL; ))))))job_id))))))))))))))))))INTEGER)NOT)NULL;) ))))))CONSTRAINT)emp_job_fk ))))))FOREIGN)KEY)Fjob_idl)))))) ))))))REFERENCES)JobFjob_idl; ))))))CONSTRAINT)emp_dept_fk ))))))FOREIGN)KEY)Fdepartment_idl)))))) ))))))REFERENCES)DepartmentFdepartment_idl))) l)*</formula></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Department department_id).)Integer department_name).)String job_id).)Integer job_title).)String min_salary).)Integer) max_salary).)Integer</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Job Employee employee_id).)Integer first_name).)String last_name).)String salary).)Real</head><p>Besides this basic process, the model extraction phase also creates an additional class for each database view. In this case, the UML class is derived and has as attributes the names and corresponding types of the columns that are selected in the view definition. The derivation rule for the class is created by translating the view select expression as described in the next section.  In Fig. <ref type="figure" target="#fig_2">3</ref>, the mapping of a view is depicted. The view represents the projection of Employees (first and last names) per Department, that is identified by its name. The columns in the SELECT clause (i.e., first name, last name and department name) are the attributes of the UML derived class; while their types (i.e., String in this case) are derived by mapping the built-in data type VARCHAR2 used to define those columns.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Constraint Extraction</head><p>Once we have generated the UML model we can enrich it with the set of OCL expressions to represent the constraints and derivation rules in the database schema.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1">Declarative Integrity Constraints to OCL constraints.</head><p>This step covers the declarative integrity constraints specified within the table creation statement. The context for all these constraints is the class representing the table in the UML diagram.</p><p>Figure <ref type="figure" target="#fig_3">4</ref> shows the patterns used to generate the OCL constraints corresponding to the PRIMARY KEY, UNIQUE, NOT NULL and CHECK constraints <ref type="foot" target="#foot_1">2</ref>   The name of the table (i.e., table name) and columns (i.e., col A) are mapped respectively to the corresponding UML class (i.e., class table name ) and attributes (i.e., attr col A ). In addition, the name of the table in lowercase is used as name of the iterator within the corresponding OCL operations.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2">SQL-to-OCL transformation</head><p>This section describes the mapping between SQL SELECT statements and the equivalent OCL expressions. In particular we describe the mappings for SQL projections, selections, joins, functions, group by and having clauses. These mappings are needed to create the derivation rules for views as described above and to be able to extract constraints implemented as part of trigger definitions as explained in the next subsection.</p><p>In the following, we present the list of mappings.</p><p>Projection and Selection. Projections and selections in SQL rely on SELECT, FROM and WHERE clause. The mapping of a generic projection/selection is shown in Fig. <ref type="figure">5</ref>. Fig. <ref type="figure">5</ref>. Mapping of projections/selections 1. The mapping starts by translating the FROM clause. This is done by selecting all instances (i.e., method allInstances()) of the class in the CS that corresponds to table in the FROM. 2. The WHERE clause, if defined, is translated into an OCL select iterator. The condition in the select iterator is created by translating the conditions in the WHERE clause. The mapping is basically a direct mapping since the references to the column names in the WHERE are replaced by the corresponding attribute and association names. SQL functions are translated into their OCL counterparts (if existing, otherwise new OCL operations must be previously defined, e.g., see <ref type="bibr" target="#b10">[11]</ref>). 3. The SELECT clause is translated into an OCL collect iterator that creates a collection of objects according to the structure defined in the Tuple definition. Each field in the Tuple corresponds to a column in the SELECT clause. Fields are initialized with the value of the corresponding attributes. 4. Finally, the DISTINCT clause might be used in conjunction with a SELECT statement to return only the different (i.e., distinct) values in a given table. This clause is mapped adding the operation asSet() after the mapping of the SELECT clause.</p><formula xml:id="formula_1">SELECT</formula><p>Join. In SQL, the JOIN operation combines the values of two or more tables. Our transformation covers both inner and outer joins, but for the sake of conciseness we focus the explanation on the mapping for inner joins. The inner join is by far the most common case of joining tables. Giving two tables a and b and according to the join conditions, it returns the intersection of the two tables. The mapping of a generic inner join is shown in Fig. <ref type="figure">6</ref>. -&gt;select(iterator product f|fiterator product .first.colA Join f=fiterator product .second) -&gt;select(iterator product f|fiterator product .cond_where)ff -&gt;collect(iterator product f|fTuple{colA_name select f=fiterator product .first.colA select , colB_name select f=fiterator product .second.colB select }) Fig. <ref type="figure">6</ref>. Mapping of inner joins 1. Firstly, we perform the Cartesian product of the population of all tables by retrieving all the instances of the corresponding classes in the CS and applying on them the Cartesian product (named product in OCL). 2. The join conditions are mapped to the body of a select operation, that iterates over the tuples of the Cartesian product (i.e., iterator product ), selecting those that satisfy the conditions. First and second are used to identify the classes in the Cartesian product (i.e., class tableA name and class tableB name ). Note that colA is compared with second (and not second.colB) since in the pattern we assume that colA is the name of the role of the association linking the two classes (i.e., the type of colA in the CS is class tableB name ). 3. In case the WHERE clause is defined (i.e., implicit joins or other conditions), a new select operation is created according to the patterns previously described. 4. If not all columns are selected, the collect operation is used as described in the previous pattern.</p><p>Group By, Having and Aggregate Functions. The GROUP BY clause is used to group the result-set of a given SELECT statement. Groups can be filtered by means of the HAVING clause. In Fig. <ref type="figure">7</ref>, the mapping of GROUP BY and HAVING clauses is shown. Fig. <ref type="figure">7</ref>. Mapping of group by and having clauses 1. We first translate the SQL FROM, JOIN and WHERE clauses according to the previous mapping patterns. The result is used to initialize the variable sel. 2. The tuples in sel are then processed to create the grouped result set group that maps the GROUP BY clause. In short, group is created by iterating on the sel tuples and collecting together those tuples with an identical value on the attributes corresponding to the columns in the GROUP BY clause.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">If an aggregate function is applied on one of the columns in the SELECT clause,</head><p>an equivalent OCL operation (see <ref type="bibr" target="#b10">[11]</ref> for more on aggregate functions in OCL) is added at the end of the GROUP BY clause mapping. 4. Finally, if the HAVING clause has been defined, it is translated into a select operation, where the body of the select is created by mapping the HAVING conditions.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.3">Triggers to OCL constraints.</head><p>A second source of integrity constraints are triggers that, among other application scenarios, can be in charge of enforcing complex constraints that go beyond the expressiveness of CHECK table constraints. In particular, we focus our analysis on row-level triggers, that are generally used to check the validity of the data and for this reason they are often used to embed business rules at database level.</p><p>A trigger is a procedural code that is automatically executed in response to certain events applied to a table. It is composed by the triggering event, an optional trigger condition (i.e., WHEN clause in Figure <ref type="figure">8</ref>) and the triggered action. The triggering event is a SQL statement, database or user event. The restriction condition is a boolean expression related to the event clause. A triggered action is a PL/SQL block that contains SQL and procedural code to be run when the triggering event occur and the restriction condition is true. Finally, triggers can be executed instead of, before or after performing the triggering event.</p><p>To distinguish triggers enforcing a business rule from other kinds of triggers (e.g., devoted to log actions) we use the following heuristic: all triggers embedding in their action section a PL/SQL statement raising an exception defined by the user are classified as constraint-enforcing-triggers. For each of such triggers, an OCL invariant is generated. The context of the invariant is the UML class corresponding to the table where the trigger is defined; while its body is composed by the trigger restriction condition, if defined, and the output of the PL/SQL-to-OCL transformation described below.</p><p>PL/SQL-to-OCL Transformation The PL/SQL-to-OCL transformation is used to extract OCL constraints out of PL/SQL blocks (in our case part of trigger definitions). A stored procedure consists of three sections (see Fig. <ref type="figure">8</ref>): an optional declaration section, identified by the keyword DECLARE and used to define variables; an execution section, wrapped between the keywords BEGIN and END and containing PL/SQL and SQL statements; and finally an optional exception handling section, used to handle the run-time error and identified by the keyword EXCEPTION. The OCL constraints are extracted starting from an analysis of the conditional statements that raise user exceptions in the execution section. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>DECLARE variablehandhconstanthdeclarations</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>EXCEPTION exceptionhhandlers</head><p>Fig. <ref type="figure">8</ref>. Mapping of constraints enforced by triggers PL/SQL allows defining user exceptions in two ways. One is to override an alreadydefined exception. In this case, the exception must be declared in the declaration section and raised explicitly in the execution section using the statement RAISE. The other way concerns the command RAISE APPLICATION ERROR, that raises an user-defined exception that is used to communicate an application-specific error back to the user. Both kinds of exceptions are generally business relevant, since they represent a violation of the company's business and not a technology issue. Since these exceptions are raised explicitly, they are generally nested in conditional statements, that check if the business constraints are violated or not.</p><p>For each exception, the conditions triggering the exception are mapped to an equivalent OCL expression. Note that these conditions may include variables calculated from previous SQL queries in the trigger execution section. If that case, those expressions are also processed according to the SQL-to-OCL mappings described before.</p><p>In Fig. <ref type="figure" target="#fig_6">9</ref>, we show the mapping of the Salary check constraint. This trigger raises an exception when the salary of a new employee for a given job is outside the salary range expected for that job. The minimum and maximum salaries are stored in the  table Job (Fig. <ref type="figure" target="#fig_1">2</ref>). They are retrieved using two variables (i.e., Minsal and Maxsal) by means of a SELECT INTO clause. The mapping of this clause extends the mapping for SQL projections seen before. Each variable is mapped to an OCL let expression, where the OCL variable takes the name and the type of the SQL variable defined in the DECLARE section of the trigger. Variable values are initialized with the result of the SQL-to-OCL mapping for the SQL query expression. Since in PL/SQL, SELECT INTO statements can only return one single row, the first elements of both projections are returned using the OCL operation first(). Finally, the values of the two variables are compared according to a boolean expression that maps the negation of the PL/SQL if-statement condition.</p><p>Refining OCL Constraints Constraints enforced by a trigger should be linked to the event that may fire the trigger. For instance, the Salary constraint extracted in Fig. <ref type="figure" target="#fig_6">9</ref> should only be checked when creating new employees not when updating them (there could be another trigger in charge of checking that updates also respect the constraint but this is not something we can deduce from this single trigger). This corresponds to the concept of creation-time constraints <ref type="bibr" target="#b11">[12]</ref>. Therefore, when extracting the constraints we use the stereotype mechanism from the UML language to annotate each constraint with information of the events that apply to it.</p><p>Only when we find the set of equivalent constraints that altogether are annotated with all the relevant events for the kind of condition enforced by the constraint set, we can merge them and define the resulting constraint as a standard OCL invariant.</p><p>A complete procedure to identify semantically-equivalent constraints and to analyze which events can violate the constraint is out of the scope of this paper. They are needed respectively to create a single constraint annotated with the union of events for each individual constraint, and to guess if the set of database triggers are sufficient to ensure that the generated constraint should always hold (and not only at the creation, update or deletion time). The aforementioned procedure would rely on <ref type="bibr" target="#b12">[13]</ref> for the detection of redundant constraints and <ref type="bibr" target="#b13">[14]</ref> for the derivation of relevant events for each constraint.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6">Conclusion and Future Work</head><p>In this paper, we have presented a model-based reverse engineering approach for extracting an UML/OCL model out of a database implementation in order to facilitate the comprehension of the integrity constraints and derivation rules embedded in the database. As a proof of concept, the approach has been implemented as a model-based prototype<ref type="foot" target="#foot_2">3</ref> integrated in the Eclipse platform.</p><p>As further work, we would like to extend the kind of constraints we can infer by first extending the OCL language with additional libraries needed to properly represent time and calendar-based constraints. In addition, we would like to focus our analysis on other kind of triggers and their relations to discover more complete business rules. Finally, in order to have a global view of the current organization policies enforced in an Information System, we to compare (e.g., for consistency) and merge the obtained constraints with those ones enforced in other components of the system (to be extracted with other reverse engineering approaches, e.g., <ref type="bibr" target="#b14">[15]</ref>).</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>Fig. 1 .</head><label>1</label><figDesc>Fig. 1. Discovery process overview</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head>Fig. 2 .</head><label>2</label><figDesc>Fig. 2. Database schema to conceptual schema</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_2"><head>Fig. 3 .</head><label>3</label><figDesc>Fig. 3. Mapping of a database view</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_3"><head>Fig. 4 .</head><label>4</label><figDesc>Fig. 4. Mapping of Declarative integrity constraints</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_4"><head>ONfaliasA. colA</head><label>colA</label><figDesc>Join f=faliasB.colB Join SELECTfcolA select ,fcolB select FROMftableAfaliasA JOINftableBfaliasB WHEREfcond_wheref class tableA_name .allInstances()-&gt;product(class tableB_name .allInstances())</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_6"><head>Fig. 9 .</head><label>9</label><figDesc>Fig. 9. Example of a constraint enforced by a trigger</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_2"><head></head><label></label><figDesc>. ,it table_name L|Lit table_name L&lt;&gt;Lselfaimplies LLLLit table_name .attr col_B L&lt;&gt;Lself.attr col_BL orait table_name .attr col_C L&lt;&gt;Lself.attr col_C x</figDesc><table><row><cell cols="2">CREATEaTABLELtable_nameL,</cell><cell>contextLclass table_name</cell></row><row><cell>x</cell><cell>col_ALLLLLLLLLLLpDataTypepLPRIMARYaKEY, col_BLLLLLLLLLLLpDataTypep,L col_CLLLLLLLLLLLpDataTypepLNOTaNULL, col_DLLLLLLLLLLLpDataTypepLCHECKL,col_DLoperatorLexprx, CONSTRAINTL&lt;constr_name&gt;LUNIQUEa,col_B,Lcol_Cx</cell><cell>inv:Lnotaself.attr col_A .oclIsUndefined,xLand class table_name .allInstances,x L-&gt;forAll,it table_name L|Lit table_name L&lt;&gt;Lselfaimplies LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLit table_name .attr col_A L&lt;&gt;Lself.attr col_A x inv:Lnotaself.attr col_C .oclIsUndefined,x inv:Lself.attr col_D L&lt;SQL-to-OCLLmapping&gt;</cell></row><row><cell></cell><cell></cell><cell>class table_name .allInstances,x L-&gt;forAllinv:</cell></row></table></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0">The SQL standard also includes a CREATE ASSERTION statement to specify complex constraints but none of the major database vendors support it</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_1">Note that due to the high expressiveness of the OCL language, different OCL expressions can represent the same semantic constraint so other equivalent alternatives are also possible</note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_2">http://docatlanmod.emn.fr/IntegrityConstraints2OCL/intro.html</note>
		</body>
		<back>
			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">Using UML/OCL Constraints for Relational Database Design</title>
		<author>
			<persName><forename type="first">B</forename><surname>Demuth</surname></persName>
		</author>
		<author>
			<persName><forename type="first">H</forename><surname>Hußmann</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">UML</title>
		<imprint>
			<biblScope unit="page" from="598" to="613" />
			<date type="published" when="1999">1999</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">OCL as a Specification Language for Business Rules in Database Applications</title>
		<author>
			<persName><forename type="first">B</forename><surname>Demuth</surname></persName>
		</author>
		<author>
			<persName><forename type="first">H</forename><surname>Hußmann</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Loecher</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">UML</title>
		<imprint>
			<biblScope unit="page" from="104" to="117" />
			<date type="published" when="2001">2001</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">An approach for reverse engineering of relational databases</title>
		<author>
			<persName><forename type="first">W</forename><forename type="middle">J</forename><surname>Premerlani</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><forename type="middle">R</forename><surname>Blaha</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">WCRE</title>
		<imprint>
			<biblScope unit="page" from="151" to="160" />
			<date type="published" when="1993">1993</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">Reverse Engineering of Relational Databases: Extraction of an EER Model from a Relational Database</title>
		<author>
			<persName><forename type="first">R</forename><forename type="middle">H L</forename><surname>Chiang</surname></persName>
		</author>
		<author>
			<persName><forename type="first">T</forename><forename type="middle">M</forename><surname>Barron</surname></persName>
		</author>
		<author>
			<persName><forename type="first">V</forename><forename type="middle">C</forename><surname>Storey</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Data &amp; Knowledge Engineering</title>
		<imprint>
			<biblScope unit="volume">12</biblScope>
			<biblScope unit="issue">2</biblScope>
			<biblScope unit="page" from="107" to="142" />
			<date type="published" when="1994">1994</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<analytic>
		<title level="a" type="main">Extracting an entity relationship schema from a relational database through reverse engineering</title>
		<author>
			<persName><forename type="first">M</forename><surname>Andersson</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">ER</title>
		<imprint>
			<biblScope unit="page" from="403" to="419" />
			<date type="published" when="1994">1994</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Extraction of object-oriented structures from existing relational databases</title>
		<author>
			<persName><forename type="first">S</forename><surname>Ramanathan</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Hodges</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">ACM Sigmod Record</title>
		<imprint>
			<biblScope unit="volume">26</biblScope>
			<biblScope unit="issue">1</biblScope>
			<biblScope unit="page" from="59" to="64" />
			<date type="published" when="1997">1997</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">Modelling database views with derived classes in the UML/OCL-framework</title>
		<author>
			<persName><forename type="first">H</forename><surname>Balsters</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">UML</title>
		<imprint>
			<biblScope unit="page" from="295" to="309" />
			<date type="published" when="2003">2003</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b7">
	<analytic>
		<title level="a" type="main">On querying uml data models with ocl</title>
		<author>
			<persName><forename type="first">D</forename><forename type="middle">H</forename><surname>Akehurst</surname></persName>
		</author>
		<author>
			<persName><forename type="first">B</forename><surname>Bordbar</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">UML</title>
		<imprint>
			<biblScope unit="page" from="91" to="103" />
			<date type="published" when="2001">2001</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b8">
	<analytic>
		<title level="a" type="main">Towards the Automatic Extraction of Structural Business Rules from Legacy Databases</title>
		<author>
			<persName><forename type="first">O</forename><surname>Chaparro</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Aponte</surname></persName>
		</author>
		<author>
			<persName><forename type="first">F</forename><surname>Ortega</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Marcus</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">WCRE</title>
		<imprint>
			<biblScope unit="page" from="479" to="488" />
			<date type="published" when="2012">2012</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b9">
	<analytic>
		<title level="a" type="main">Extracting entity-relationship diagram from a table-based legacy database</title>
		<author>
			<persName><forename type="first">D</forename><surname>Yeh</surname></persName>
		</author>
		<author>
			<persName><forename type="first">Y</forename><surname>Li</surname></persName>
		</author>
		<author>
			<persName><forename type="first">W</forename><forename type="middle">C</forename><surname>Chu</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Journal of Systems and Software</title>
		<imprint>
			<biblScope unit="volume">81</biblScope>
			<biblScope unit="issue">5</biblScope>
			<biblScope unit="page" from="764" to="771" />
			<date type="published" when="2008">2008</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b10">
	<analytic>
		<title level="a" type="main">Specifying aggregation functions in multidimensional models with OCL</title>
		<author>
			<persName><forename type="first">J</forename><surname>Cabot</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><forename type="middle">N</forename><surname>Mazón</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Pardillo</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Trujillo</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">ER</title>
		<imprint>
			<biblScope unit="page" from="419" to="432" />
			<date type="published" when="2010">2010</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b11">
	<analytic>
		<title level="a" type="main">Integrity Constraints Definition in Object-Oriented Conceptual Modeling Languages</title>
		<author>
			<persName><forename type="first">A</forename><surname>Olivé</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">ER</title>
		<imprint>
			<biblScope unit="page" from="349" to="362" />
			<date type="published" when="2003">2003</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b12">
	<analytic>
		<title level="a" type="main">Emftocsp: A tool for the lightweight verification of emf models</title>
		<author>
			<persName><forename type="first">C</forename><forename type="middle">A</forename><surname>González</surname></persName>
		</author>
		<author>
			<persName><forename type="first">F</forename><surname>Buttner</surname></persName>
		</author>
		<author>
			<persName><forename type="first">R</forename><surname>Clarisó</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Cabot</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">FormSERA</title>
		<imprint>
			<biblScope unit="page" from="44" to="50" />
			<date type="published" when="2012">2012</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b13">
	<analytic>
		<title level="a" type="main">Determining the structural events that may violate an integrity constraint</title>
		<author>
			<persName><forename type="first">J</forename><surname>Cabot</surname></persName>
		</author>
		<author>
			<persName><forename type="first">E</forename><surname>Teniente</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">UML</title>
		<imprint>
			<biblScope unit="page" from="320" to="334" />
			<date type="published" when="2004">2004</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b14">
	<analytic>
		<title level="a" type="main">A Model Driven Reverse Engineering Framework for Extracting Business Rules Out of a Java Application</title>
		<author>
			<persName><forename type="first">V</forename><surname>Cosentino</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Cabot</surname></persName>
		</author>
		<author>
			<persName><forename type="first">P</forename><surname>Albert</surname></persName>
		</author>
		<author>
			<persName><forename type="first">P</forename><surname>Bauquel</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><surname>Perronnet</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">RuleML</title>
		<imprint>
			<biblScope unit="page" from="17" to="31" />
			<date type="published" when="2012">2012</date>
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
