1module ProjectM36.FunctionalDependency where
3import qualified Data.Set as S
5data FunctionalDependency = FunctionalDependency AttributeNames AttributeNames RelationalExpr
7--(s{city} group ({city} as x) : {z:=count(@x)}) {z}
8-- as defined in Relational Algebra and All That Jazz page 21
9inclusionDependenciesForFunctionalDependency :: FunctionalDependency -> (InclusionDependency, InclusionDependency)
10inclusionDependenciesForFunctionalDependency (FunctionalDependency attrNamesSource attrNamesDependent relExpr) = (
11 InclusionDependency countSource countDep,
12 InclusionDependency countDep countSource)
14 countDep = relExprCount relExpr (UnionAttributeNames attrNamesSource attrNamesDependent)
15 countSource = relExprCount relExpr attrNamesSource
16 projectZName = Project (AttributeNames (S.singleton "z"))
17 zCount = FunctionAtomExpr "count" [AttributeAtomExpr "x"] ()
18 extendZName = Extend (AttributeExtendTupleExpr "z" zCount)
19 relExprCount expr projectionAttrNames = projectZName (extendZName
20 (Group projectionAttrNames "x" (Project projectionAttrNames expr)))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list