-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Migration
* master: preprint submitted 2024/06/21 adapted Kurk.adl for migration demo transfer Migration paper to RAMiCS Consolidate Kurk.adl and Migration.thy moved paper to directory 2024_FoIKS_Migration Consolidate the submission of FoIKS 2024 submitted to FoIKS 2024 WIP Final touch one benefit added small enhancements proposal brief proposal brief made teaser gemaakt Initial research proposal with Tim # Conflicts: # Generative Software/articleMigrationRaMiCS.tex
- Loading branch information
Showing
30 changed files
with
2,907 additions
and
2,468 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
CONTEXT MigrationDemo | ||
PURPOSE CONTEXT MigrationDemo MARKDOWN | ||
{+ This script will demo part of the migration of just one relation: `r[A*B]`. | ||
The demo is done on the old Ampersand platform (RAP4). | ||
|
||
### Intro | ||
Relation: `r[A*B]` contains just one pair: `("a1", "b1")`, but there are two inconsistencies of the totality rule: Atoms `"a2"` and `"a3"` are not source atoms in any pair. | ||
This is shown in the left part of the screen, in column `Old`. | ||
Column `Migration` shows the migrated relation `r[A*B]`. | ||
You can demonstrate all insert and delete operations in the migration environment by adding or removing atoms in the column "Migration". | ||
Note the field "block". This field signals that this record can no longer violate the rule. | ||
This recipe works for any rule of the form `RULE a |- c`, not just totality. | ||
Totality has the form `a=I` and `c=r;r~`, so it has the right form. | ||
+} | ||
|
||
POPULATION A CONTAINS [ "a1", "a2" , "a3" ] | ||
POPULATION B CONTAINS [ "b1", "b2" , "b3" ] | ||
RELATION old_r[A*B] [UNI] = [ ("a1", "b1") ] | ||
-- The totality of r applies in the migration system, not in the existing situation. | ||
-- So `RULE I |- old_r;old_r~` is not satisfied, but `RULE I |- new_r;new_r~` is. | ||
|
||
REPRESENT B TYPE ALPHANUMERIC -- This is only here to smoothen the demo. | ||
|
||
-- The following copies `old_r` to `new_r`. `copy_r` is needed to ensure that `new_r` can be edited after copying. | ||
-- For every relation $r$ shared by the existing and desired systems, we generate a helper relation: ${\tt copy}_r$, and a transaction to produce its population. | ||
RELATION copy_r[A*B] | ||
RELATION new_r[A*B] [UNI] | ||
-- We create a transactions (enforcement rules) to copy the population of relations from `old_r` to `new_r`. | ||
ENFORCE copy_r >: new_r /\ old_r | ||
ENFORCE new_r >: old_r - copy_r | ||
|
||
-- For each new blocking invariant $u$, we generate a helper relation: ${\tt fixed}_u$, to register all inconsistencies that are fixed. | ||
-- The helper relation is needed to ensure that the fixing of inconsistencies terminates. | ||
RELATION fixed_TOTr[A*A] | ||
-- We also need a transaction to produce its population: | ||
ENFORCE fixed_TOTr >: I /\ new_r;new_r~ | ||
-- The following blocks an inconsistency from reoccurring, but allows fixing any remaining inconsistencies. | ||
RULE Block_TOTr : fixed_TOTr |- new_r;new_r~ | ||
MESSAGE "Relation r[A*B] must remain total." | ||
VIOLATION (TXT "Atom ", SRC I, TXT " must remain paired with an atom from B.") | ||
|
||
-- To signal users that there are inconsistencies that need to be fixed, we generate a business constraint for each new blocking invariant $u$: | ||
ROLE User MAINTAINS TOTr | ||
RULE TOTr : I |- new_r;new_r~ | ||
MESSAGE "Please, make relation r[A*B] total." | ||
VIOLATION (TXT "Pair ", SRC I, TXT " with an (any) atom from B.") | ||
|
||
-- The migration engineer can switch all traffic to the desired system | ||
-- after resolving the inconsistencies that prohibit deploying the desired system. | ||
-- That is the case when inconsistencies of new invariants on the old population have all been fixed: | ||
ROLE User MAINTAINS CleanUp_TOTr | ||
RULE CleanUp_TOTr : V[ONE*A] ; (I - fixed_TOTr) ; V[A*ONE] | ||
MESSAGE "Now you can remove the migration system because relation r[A*B] is total." | ||
|
||
RELATION blocking_r[A*B] [UNI] = [ ("a1", "aap"), ("a2", "noot"), ("a3", "mies") ] | ||
RULE blocking_r : I[A] |- blocking_r;blocking_r~ | ||
INTERFACE "Blocking Invariant demo" : "_SESSION";V[SESSION*A] cRud BOX<TABLE> | ||
[ "r" : I cRud BOX<TABLE> | ||
[ "A" : I cRud | ||
, "B" : blocking_r CRUd | ||
] | ||
] | ||
|
||
RELATION business_r[A*B] [UNI] = [ ("a1", "b1") ] | ||
RULE business_r : I[A] |- business_r;business_r~ | ||
MESSAGE "Business constraint demo: Relatie r[A*B] moet totaal blijven." | ||
VIOLATION (TXT "Pair ", SRC I, TXT " with an (any) atom from B.") | ||
ROLE User MAINTAINS business_r | ||
INTERFACE "Business constraint demo" : "_SESSION";V[SESSION*A] cRud BOX<TABLE> | ||
[ "" : I cRud BOX<TABLE> | ||
[ "A" : I cRud | ||
, "B" : business_r CRUd | ||
] | ||
] | ||
|
||
INTERFACE "Migration system" : "_SESSION";V[SESSION*A] cRud BOX<TABLE> | ||
[ "old_r" : I cRud BOX<TABLE> | ||
[ "A" : I cRud | ||
, "B" : old_r cRud | ||
] | ||
, "new_r" : I cRud BOX<TABLE> | ||
[ "A" : I cRud | ||
, "B": new_r CRUd | ||
] | ||
-- , copy_r : copy_r cRud | ||
-- , fixed_u : fixed_TOTr cRud | ||
] | ||
|
||
ENDCONTEXT | ||
|
||
{+ calculate the inconsistencies of the old rule. +} | ||
- (Antecedent |- Consequent) | ||
<=> { definition of |- } | ||
-(-Antecedent \/ Consequent) | ||
<=> { DeMorgan } | ||
Antecedent /\ -(Consequent) | ||
<=> { definition of binary - } | ||
Antecedent - Consequent | ||
+} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.