2 Module : Gargantext.Database
3 Description : Tools for Database
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 All Database related stuff here.
12 Target: just import this module and nothing else to work with
13 Gargantext's database.
17 {-# LANGUAGE NoImplicitPrelude #-}
19 module Gargantext.Database.Config
23 import Data.Text (pack)
24 import Data.Tuple.Extra (swap)
25 import Data.Maybe (fromMaybe)
26 import Data.List (lookup)
28 import Gargantext.Database.Types.Node
29 import Gargantext.Prelude
31 -- | Nodes are typed in the database according to a specific ID
33 nodeTypeInv :: [(NodeTypeId, NodeType)]
34 nodeTypeInv = map swap nodeTypes
36 nodeTypes :: [(NodeType, NodeTypeId)]
37 nodeTypes = [ (NodeUser , 1)
55 -- , (Cooccurrences , 9)
57 -- , (Specclusion , 11)
58 -- , (Genclusion , 18)
61 -- , (TfidfCorpus , 13)
62 -- , (TfidfGlobal , 14)
64 -- , (TirankLocal , 16)
65 -- , (TirankGlobal , 17)
72 nodeTypeId :: NodeType -> NodeTypeId
73 nodeTypeId tn = fromMaybe (panic $ pack $ "Typename " <> show tn <> " does not exist")
77 typeId2node :: NodeTypeId -> NodeType
78 typeId2node tId = fromMaybe (panic $ pack $ "Type Id " <> show tId <> " does not exist")
79 (lookup tId nodeTypeInv)