4ZP6Capstone2015 / ampersand

Development of the Ampersand generator software
http://wiki.tarski.nl/
GNU General Public License v3.0
0 stars 0 forks source link

Implement proper calling convention for eca2sql #2

Open yuriy0 opened 8 years ago

yuriy0 commented 8 years ago

When generating SQL code, the resulting code will be a function which takes some parameters, and performs the restoration of the invariant.

The question is which parameters it should take. There seems to be two forms of tables that we may need to insert/delete into: tables for relations of type I[A] for some A, and subsets of V[A,B] for some A, B. Operationally, identity relations are represented as tables with a unique ID, and multiple fields. The issue is complicated slightly because of subtyping in Ampersand - some relations are represented by the same table, being subsets of some relation which is the upper bound of several other relations. Rows in the table representing entries in a subtype relation contain nulls - hopefully MySql can deal with this automatically. The representation for relations of the form [A,B] is much simpler - it is a table with two columns, one called src and the other tgt, and the values are the unique IDs of the rows in the identity relations corresponding to A and B.