project-m36-0.9.9: Relational Algebra Engine
Safe HaskellSafe-Inferred
LanguageHaskell2010

ProjectM36.IsomorphicSchema

Synopsis

Documentation

data SchemaExpr Source #

validateSchema :: Schema -> DatabaseContext -> Maybe SchemaError Source #

Return an error if the schema is not isomorphic to the base database context. A schema is fully isomorphic iff all relvars in the base context are in the "out" relvars, but only once. TODO: add relvar must appear exactly once constraint

isomorphsInRelVarNames :: SchemaIsomorphs -> Set RelVarName Source #

Relation variables names represented in the virtual schema space. Useful for determining if a relvar name is valid in the schema.

validateRelationalExprInSchema :: Schema -> RelationalExpr -> Either RelationalError () Source #

Check that all mentioned relvars are actually present in the current schema.

processDatabaseContextExprSchemaUpdate :: Schema -> DatabaseContextExpr -> Schema Source #

If the database context expression adds or removes a relvar, we need to update the isomorphs to create a passthrough Isomorph.

relExprMorph :: SchemaIsomorph -> RelationalExpr -> Either RelationalError RelationalExpr Source #

Morph a relational expression in one schema to another isomorphic schema. Returns a function which can be used to morph a GraphRefRelationalExpr. Here, we naively apply the morphs in the current context ignoring past contexts because: * the current schema may not exist in past * this function should only be used for showing DDL, not for expression evaluation. * if a schema were renamed, then the path to past isomorphisms in the transaction graph tree would be lost.

applyRelationalExprSchemaIsomorphs :: SchemaIsomorphs -> RelationalExpr -> Either RelationalError RelationalExpr Source #

Apply the isomorphism transformations to the relational expression to convert the relational expression from operating on one schema to a disparate, isomorphic schema.

relationVariablesAsRelationInSchema :: DatabaseContext -> Schema -> TransactionGraph -> Either RelationalError Relation Source #

Show metadata about the relation variables in the isomorphic schema.

createIncDepsForIsomorph :: SchemaName -> SchemaIsomorph -> InclusionDependencies Source #

Create inclusion dependencies mainly for IsoRestrict because the predicate should hold in the base schema.

class Morph a where Source #

Apply SchemaIsomorphs to database context data.

Instances

Instances details
Morph InclusionDependencies Source # 
Instance details

Defined in ProjectM36.IsomorphicSchema

Morph InclusionDependency Source #

The names of inclusion dependencies might leak context about a different schema, but that's arbitrary and cannot be altered without having the user provide a renaming function or a new set of incDep names- seems extraneous.

Instance details

Defined in ProjectM36.IsomorphicSchema

Morph RelationalExpr Source # 
Instance details

Defined in ProjectM36.IsomorphicSchema