on master help sign in
fix unused module and name warnings
550b966AgentM
Relation.hs−8
@@ -3,14 +3,10 @@
3module Relation where
3module Relation where
4import qualified Data.Map as M
4import qualified Data.Map as M
5import qualified Data.Set as S
5import qualified Data.Set as S
6−import qualified Data.List as L
7import qualified Data.HashSet as HS
6import qualified Data.HashSet as HS
8−import qualified Data.Hashable as Hash
9import qualified Control.Monad.Error as Err
7import qualified Control.Monad.Error as Err
10
8
11−import Debug.Trace
12import RelationType
9import RelationType
13−import RelationAtom
14import RelationTuple
10import RelationTuple
15import RelationAttribute
11import RelationAttribute
16import RelationTupleSet
12import RelationTupleSet
@@ -153,7 +149,6 @@ group groupAttrNames newAttrName rel@(Relation attrs tupleSet) = do
153 newAttrs = M.insert newAttrName groupAttr (attributesForNames nonGroupAttrNames rel)
149 newAttrs = M.insert newAttrName groupAttr (attributesForNames nonGroupAttrNames rel)
154 groupAttr = Attribute newAttrName (RelationAtomType (attributesForNames nonGroupAttrNames rel))
150 groupAttr = Attribute newAttrName (RelationAtomType (attributesForNames nonGroupAttrNames rel))
155 nonGroupAttrNames = nonMatchingAttributeNameSet groupAttrNames (attributeNames rel)
151 nonGroupAttrNames = nonMatchingAttributeNameSet groupAttrNames (attributeNames rel)
156− newAttrNames = S.insert newAttrName nonGroupAttrNames
157 folder tupleIn acc = case acc of
152 folder tupleIn acc = case acc of
158 Left err -> Left err
153 Left err -> Left err
159 Right acc -> union acc (Relation newAttrs (HS.singleton (tupleExtend tupleIn (matchingRelTuple tupleIn))))
154 Right acc -> union acc (Relation newAttrs (HS.singleton (tupleExtend tupleIn (matchingRelTuple tupleIn))))
@@ -174,7 +169,6 @@ restrictEq (RelationTuple tupMap) rel = restrict filter rel
174ungroup :: AttributeName -> Relation -> Either RelationalError Relation
169ungroup :: AttributeName -> Relation -> Either RelationalError Relation
175ungroup relvalAttrName rel = relFold relFolder (Right $ Relation newAttrs emptyTupleSet) rel
170ungroup relvalAttrName rel = relFold relFolder (Right $ Relation newAttrs emptyTupleSet) rel
176 where
171 where
177− newAttrNames = M.keysSet newAttrs
178 newAttrs = M.union (attributesForRelval relvalAttrName rel) nonGroupAttrs
172 newAttrs = M.union (attributesForRelval relvalAttrName rel) nonGroupAttrs
179 nonGroupAttrs = M.delete relvalAttrName (attributes rel)
173 nonGroupAttrs = M.delete relvalAttrName (attributes rel)
180 relFolder :: RelationTuple -> Either RelationalError Relation -> Either RelationalError Relation
174 relFolder :: RelationTuple -> Either RelationalError Relation -> Either RelationalError Relation
@@ -191,7 +185,6 @@ tupleUngroup :: AttributeName -> Attributes -> RelationTuple -> Either Relationa
191tupleUngroup relvalAttrName newAttrs tuple@(RelationTuple tupMap) = case (tupMap M.! relvalAttrName) of
185tupleUngroup relvalAttrName newAttrs tuple@(RelationTuple tupMap) = case (tupMap M.! relvalAttrName) of
192 (RelationAtom relvalRelation) -> relFold folder (Right $ Relation newAttrs emptyTupleSet) relvalRelation
186 (RelationAtom relvalRelation) -> relFold folder (Right $ Relation newAttrs emptyTupleSet) relvalRelation
193 where
187 where
194− newAttrNameSet = M.keysSet newAttrs
195 nonGroupTupleProjection = tupleProject nonGroupAttrNames tuple
188 nonGroupTupleProjection = tupleProject nonGroupAttrNames tuple
196 nonGroupAttrNames = M.keysSet newAttrs
189 nonGroupAttrNames = M.keysSet newAttrs
197 folder tupleIn acc = case acc of
190 folder tupleIn acc = case acc of
@@ -207,7 +200,6 @@ tupleUngroup relvalAttrName newAttrs tuple@(RelationTuple tupMap) = case (tupMap
207attributesForRelval :: AttributeName -> Relation -> Attributes
200attributesForRelval :: AttributeName -> Relation -> Attributes
208attributesForRelval relvalAttrName relIn@(Relation attrs tupleSet) = attributes relvalRelation
201attributesForRelval relvalAttrName relIn@(Relation attrs tupleSet) = attributes relvalRelation
209 where
202 where
210− relvalRelationAttrs = attributes relvalRelation
211 --this is only temporarily needed until the Relation stores the types of the columns as data- hack alert
203 --this is only temporarily needed until the Relation stores the types of the columns as data- hack alert
212 --find a tuple with attributes to steal to ungroup
204 --find a tuple with attributes to steal to ungroup
213 oneTuple :: RelationTupleSet -> RelationTuple
205 oneTuple :: RelationTupleSet -> RelationTuple
RelationExpr.hs−2
@@ -3,12 +3,10 @@ module RelationExpr where
3import Relation
3import Relation
4import RelationTuple
4import RelationTuple
5import RelationType
5import RelationType
6−import RelationHTML
7import qualified Data.Set as S
6import qualified Data.Set as S
8import qualified Data.Map as M
7import qualified Data.Map as M
9import qualified Data.HashSet as HS
8import qualified Data.HashSet as HS
10import Control.Monad.State hiding (join)
9import Control.Monad.State hiding (join)
11−import Debug.Trace
12
10
13type RelVarContext = M.Map String Relation
11type RelVarContext = M.Map String Relation
14
12
RelationTupleSet.hs−2
@@ -2,9 +2,7 @@ module RelationTupleSet where
2import RelationType
2import RelationType
3import qualified Data.Map as M
3import qualified Data.Map as M
4import qualified Data.Set as S
4import qualified Data.Set as S
5−import qualified Data.List as L
6import qualified Data.HashSet as HS
5import qualified Data.HashSet as HS
7−import Debug.Trace
8
6
9emptyTupleSet = HS.empty
7emptyTupleSet = HS.empty
10emptyAttributeSet = M.empty
8emptyAttributeSet = M.empty