@@ -16,7 +16,6 @@ import qualified Data.Set as S
16import qualified Data.List as L
16import qualified Data.List as L
17import qualified Data.Text as T
17import qualified Data.Text as T
18import Data.Monoid
18import Data.Monoid
20-- isomorphic schemas offer bi-directional functors between two schemas
19-- isomorphic schemas offer bi-directional functors between two schemas
22--TODO: note that renaming a relvar should alter any stored isomorphisms as well
21--TODO: note that renaming a relvar should alter any stored isomorphisms as well
@@ -304,11 +303,11 @@ validate morph underlyingRvNames = if S.size invalidRvNames > 0 then
305-- | Create inclusion dependencies mainly for IsoRestrict because the predicate should hold in the base schema.
304-- | Create inclusion dependencies mainly for IsoRestrict because the predicate should hold in the base schema.
306createIncDepsForIsomorph :: SchemaName -> SchemaIsomorph -> InclusionDependencies
305createIncDepsForIsomorph :: SchemaName -> SchemaIsomorph -> InclusionDependencies
307−createIncDepsForIsomorph sname (IsoRestrict _ predi (rvTrue, rvFalse)) = let
306+createIncDepsForIsomorph sname (IsoRestrict origRv predi (rvTrue, rvFalse)) = let
308 newIncDep predicate rv = InclusionDependency (Project AN.empty (Restrict predicate (RelationVariable rv ()))) (ExistingRelation relationTrue)
307 newIncDep predicate rv = InclusionDependency (Project AN.empty (Restrict predicate (RelationVariable rv ()))) (ExistingRelation relationTrue)
309− incDepName b = "schema" <> "_" <> sname <> "_" <> T.pack (show b) in
308+ incDepName b = "schema" <> "_" <> sname <> "_" <> b in
310− M.fromList [(incDepName True, newIncDep predi rvTrue),
309+ M.fromList [(incDepName (origRv <> "_true"), newIncDep predi rvTrue),
311− (incDepName False, newIncDep (NotPredicate predi) rvFalse)]
310+ (incDepName (origRv <> "_false"), newIncDep (NotPredicate predi) rvFalse)]
312createIncDepsForIsomorph _ _ = M.empty
311createIncDepsForIsomorph _ _ = M.empty
314-- in the case of IsoRestrict, the database context should be updated with the restriction so that if the restriction does not hold, then the schema cannot be created
313-- in the case of IsoRestrict, the database context should be updated with the restriction so that if the restriction does not hold, then the schema cannot be created