2 Module : Gargantext.Types.Main
3 Description : Short description
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Here is a longer description of this module, containing some
11 commentary with @some markup@.
14 {-# OPTIONS_GHC -fno-warn-name-shadowing #-}
16 {-# LANGUAGE DeriveGeneric #-}
17 {-# LANGUAGE FlexibleInstances #-}
18 {-# LANGUAGE OverloadedStrings #-}
20 ------------------------------------------------------------------------
21 module Gargantext.Types.Main where
22 ------------------------------------------------------------------------
25 import Protolude (fromMaybe)
28 import Data.Monoid ((<>))
29 import Data.Text (Text)
30 import Data.List (lookup)
32 import Gargantext.Types.Node
34 ------------------------------------------------------------------------
35 ------------------------------------------------------------------------
37 -- | Language of a Text
38 -- For simplicity, we suppose text has an homogenous language
39 data Language = EN | FR -- | DE | IT | SP
42 -- > DE == deutch (not implemented yet)
43 -- > IT == italian (not implemented yet)
44 -- > SP == spanish (not implemented yet)
45 -- > ... add your language and help us to implement it (:
48 -- All the Database is structred like a hierarchical Tree
49 data Tree a = NodeT a [Tree a]
50 deriving (Show, Read, Eq)
53 -- data Tree a = NodeT a [Tree a]
58 -- Garg Network is a network of all Garg nodes
59 --gargNetwork = undefined
61 -- | Garg Node is Database Schema Typed as specification
62 -- gargNode gathers all the Nodes of all users on one Node
63 gargNode :: [Tree NodeType]
66 -- | User Tree simplified
67 userTree :: Tree NodeType
68 userTree = NodeT NodeUser [projectTree]
71 projectTree :: Tree NodeType
72 projectTree = NodeT Project [corpusTree]
75 corpusTree :: Tree NodeType
76 corpusTree = NodeT Corpus ( [ leafT Document ]
79 <> [ leafT Classification]
82 -- TODO make instances of Nodes
84 -- * why NodeUser and not just User ?
85 -- * is this supposed to hold data ?
88 data Classification = Favorites | MyClassifcation
90 data Lists = StopList | MainList | MapList | GroupList
92 -- data Metrics = Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
93 -- | TfidfCorpus | TfidfGlobal | TirankLocal | TirankGlobal
96 -- | Community Manager Use Case
97 type Annuaire = Corpus
98 type Individu = Document
100 -- | Favorites Node enable Node categorization
101 type Favorites = Node HyperdataFavorites
103 -- | Favorites Node enable Swap Node with some synonyms for clarity
104 type NodeSwap = Node HyperdataResource
106 -- | Then a Node can be a List which has some synonyms
107 type List = Node HyperdataList
111 type GroupList = List
113 -- | Then a Node can be a Score which has some synonyms
114 type Score = Node HyperdataScore
115 type Occurrences = Score
116 type Cooccurrences = Score
117 type Specclusion = Score
118 type Genclusion = Score
121 ---- TODO All these Tfidf* will be replaced with TFICF
122 type TfidfCorpus = Tficf
123 type TfidfGlobal = Tficf
124 type TirankLocal = Tficf
125 type TirankGlobal = Tficf
127 ---- | Then a Node can be either a Graph or a Phylo or a Notebook
128 type Graph = Node HyperdataGraph
129 type Phylo = Node HyperdataPhylo
130 type Notebook = Node HyperdataNotebook
133 nodeTypes :: [(NodeType, NodeTypeId)]
134 nodeTypes = [ (NodeUser , 1)
146 -- , (Cooccurrences , 9)
148 -- , (Specclusion , 11)
149 -- , (Genclusion , 18)
152 -- , (TfidfCorpus , 13)
153 -- , (TfidfGlobal , 14)
155 -- , (TirankLocal , 16)
156 -- , (TirankGlobal , 17)
159 -- , (Favorites , 15)
163 nodeTypeId :: NodeType -> NodeTypeId
164 nodeTypeId tn = fromMaybe (error $ "Typename " <> show tn <> " does not exist")
165 (lookup tn nodeTypes)
170 -- Temporary types to be removed
171 type Ngrams = (Text, Text, Text)
172 type ErrorMessage = Text
175 type ParentId = NodeId