@@ -15,7 +15,7 @@ import qualified Data.Set as S
1515import qualified Data.List as L
1616import qualified Data.Text as T
1717import Data.Monoid
18−-- import Debug.Trace
18+--import Debug.Trace
1919-- isomorphic schemas offer bi-directional functors between two schemas
2020
2121--TODO: note that renaming a relvar should alter any stored isomorphisms as well
@@ -206,7 +206,7 @@ databaseContextExprMorph iso@(IsoRestrict rvIn filt (rvTrue, rvFalse)) relExprFu
206206 pure (MultipleExpr [trueExpr rvTrue, falseExpr rvFalse])
207207 MultipleExpr exprs -> MultipleExpr <$> mapM (databaseContextExprMorph iso relExprFunc) exprs
208208 orig -> pure orig
209−databaseContextExprMorph (IsoUnion (rvTrue, rvFalse) filt rvOut) relExprFunc expr = case expr of
209+databaseContextExprMorph iso@(IsoUnion (rvTrue, rvFalse) filt rvOut) relExprFunc expr = case expr of
210210 --assign: replace all instances in the portion of the target relvar with the new tuples from the relExpr
211211 --problem: between the delete->insert, constraints could be violated which would not otherwise be violated in the "in" schema. This implies that there should be a combo operator which can insert/update/delete in a single pass based on relexpr queries, or perhaps MultipleExpr should be the infamous "comma" operator from TutorialD?
212212 Assign rv relExpr | rv == rvTrue -> relExprFunc relExpr >>= \ex -> pure $ MultipleExpr [Delete rvOut filt,
@@ -218,12 +218,14 @@ databaseContextExprMorph (IsoUnion (rvTrue, rvFalse) filt rvOut) relExprFunc exp
218218 Delete rv delPred | rv == rvFalse -> pure $ Delete rvOut (AndPredicate delPred (NotPredicate filt))
219219 Update rv attrMap predi | rv == rvTrue -> pure $ Update rvOut attrMap (AndPredicate predi filt)
220220 Update rv attrMap predi | rv == rvFalse -> pure $ Update rvOut attrMap (AndPredicate (NotPredicate filt) predi)
221+ MultipleExpr exprs -> MultipleExpr <$> mapM (databaseContextExprMorph iso relExprFunc) exprs
221222 orig -> pure orig
222−databaseContextExprMorph (IsoRename relIn relOut) relExprFunc expr = case expr of
223+databaseContextExprMorph iso@(IsoRename relIn relOut) relExprFunc expr = case expr of
223224 Assign rv relExpr | rv == relIn -> relExprFunc relExpr >>= \ex -> pure (Assign relOut ex)
224225 Insert rv relExpr | rv == relIn -> relExprFunc relExpr >>= \ex -> pure $ Insert relOut ex
225226 Delete rv delPred | rv == relIn -> pure $ Delete relOut delPred
226227 Update rv attrMap predi | rv == relIn -> pure $ Update relOut attrMap predi
228+ MultipleExpr exprs -> MultipleExpr <$> mapM (databaseContextExprMorph iso relExprFunc) exprs
227229 orig -> pure orig
228230
229231-- | Apply the isomorphism transformations to the relational expression to convert the relational expression from operating on one schema to a disparate, isomorphic schema.