1module ProjectM36.Key where
3import ProjectM36.Relation
4import qualified Data.Set as S
7keys can be implemented using inclusion dependencies as well: the count of the projection of the keys' attributes must be equal to the count of the tuples- p. 120 Database in Depth
10:showexpr ((relation{tuple{}}:{a:=S}):{b:=count(@a)}){b}
16((relation{tuple{}}:{a:=S{S#}}):{b:=count(@a)}){b}
23inclusionDependencyForKey :: AttributeNames -> RelationalExpr -> InclusionDependency
24inclusionDependencyForKey attrNames relExpr = --InclusionDependency name (exprCount relExpr) (exprCount (projectedOnKeys relExpr))
25 InclusionDependency equalityExpr (ExistingRelation relationFalse)
27 projectedOnKeys expr = Project attrNames expr
28 exprAsSubRelation expr = Extend (AttributeExtendTupleExpr "a" (RelationAtomExpr expr)) (ExistingRelation relationTrue)
29 exprCount expr = projectionForCount (Extend (AttributeExtendTupleExpr "b" (FunctionAtomExpr "count" [AttributeAtomExpr "a"] () )) (exprAsSubRelation expr))
30 projectionForCount expr = Project (AttributeNames $ S.fromList ["b"]) expr
31 equalityExpr = NotEquals (exprCount relExpr) (exprCount (projectedOnKeys relExpr))
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