2 Module : .Gargantext.Types.Main
3 Description : Short description
4 Copyright : (c) CNRS, 2017
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 module Gargantext.Types.Main where
25 import Data.Monoid ((<>))
26 import Protolude (fromMaybe)
27 --import Data.ByteString (ByteString())
28 import Data.Text (Text)
29 import Data.List (lookup)
30 import Gargantext.Types.Node
33 -- | Language of a Text
34 -- For simplicity, we suppose text has an homogenous language
35 data Language = EN | FR -- | DE | IT | SP
38 -- > DE == deutch (not implemented yet)
39 -- > IT == italian (not implemented yet)
40 -- > SP == spanish (not implemented yet)
41 -- > ... add your language and help us to implement it (:
44 -- All the Database is structred like a hierarchical Tree
45 data Tree a = NodeT a [Tree a]
46 deriving (Show, Read, Eq)
49 -- data Tree a = NodeT a [Tree a]
54 -- Garg Network is a network of all Garg nodes
55 --gargNetwork = undefined
57 -- | Garg Node is Database Schema Typed as specification
58 -- gargNode gathers all the Nodes of all users on one Node
59 gargNode :: [Tree NodeType]
62 -- | User Tree simplified
63 userTree :: Tree NodeType
64 userTree = NodeT NodeUser [projectTree]
67 projectTree :: Tree NodeType
68 projectTree = NodeT Project [corpusTree]
71 corpusTree :: Tree NodeType
72 corpusTree = NodeT Corpus ( [ leafT Document ]
75 <> [ leafT Classification]
78 -- TODO make instances of Nodes
80 -- * why NodeUser and not just User ?
81 -- * is this supposed to hold data ?
84 data Classification = Favorites | MyClassifcation
86 data Lists = StopList | MainList | MapList | GroupList
88 -- data Metrics = Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
89 -- | TfidfCorpus | TfidfGlobal | TirankLocal | TirankGlobal
92 -- | Community Manager Use Case
93 type Annuaire = Corpus
94 type Individu = Document
96 -- | Favorites Node enable Node categorization
97 type Favorites = Node HyperdataFavorites
99 -- | Favorites Node enable Swap Node with some synonyms for clarity
100 type NodeSwap = Node HyperdataResource
102 -- | Then a Node can be a List which has some synonyms
103 type List = Node HyperdataList
107 type GroupList = List
109 -- | Then a Node can be a Score which has some synonyms
110 type Score = Node HyperdataScore
111 type Occurrences = Score
112 type Cooccurrences = Score
113 type Specclusion = Score
114 type Genclusion = Score
117 ---- TODO All these Tfidf* will be replaced with TFICF
118 type TfidfCorpus = Tficf
119 type TfidfGlobal = Tficf
120 type TirankLocal = Tficf
121 type TirankGlobal = Tficf
123 ---- | Then a Node can be either a Graph or a Phylo or a Notebook
124 type Graph = Node HyperdataGraph
125 type Phylo = Node HyperdataPhylo
126 type Notebook = Node HyperdataNotebook
129 nodeTypes :: [(NodeType, NodeTypeId)]
130 nodeTypes = [ (NodeUser , 1)
142 -- , (Cooccurrences , 9)
144 -- , (Specclusion , 11)
145 -- , (Genclusion , 18)
148 -- , (TfidfCorpus , 13)
149 -- , (TfidfGlobal , 14)
151 -- , (TirankLocal , 16)
152 -- , (TirankGlobal , 17)
155 -- , (Favorites , 15)
159 nodeTypeId :: NodeType -> NodeTypeId
160 nodeTypeId tn = fromMaybe (error $ "Typename " <> show tn <> " does not exist")
161 (lookup tn nodeTypes)
166 -- Temporary types to be removed
167 type Ngrams = (Text, Text, Text)
168 type ErrorMessage = Text
171 type ParentId = NodeId