2 -- Licence: https://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE
3 -- Author: Alexandre Delanoë (alexandre.delanoe@iscpif.fr)
5 module Data.Gargantext.Types.Main where
7 import Protolude (fromMaybe)
8 import Data.Text (Text)
9 import Data.Time (UTCTime)
10 import Data.Gargantext.Types.Node ( NodePoly
11 , HyperdataFolder , HyperdataCorpus , HyperdataDocument
12 , HyperdataFavorites, HyperdataResource
13 , HyperdataList , HyperdataScore
21 data Language = EN | FR -- | DE | IT | SP
24 -- > DE == deutch (not implemented yet)
25 -- > IT == italian (not implemented yet)
26 -- > SP == spanish (not implemented yet)
27 -- > ... add your language and help us to implement it (:
30 type Ngrams = (Text, Text, Text)
32 -- | TODO add Symbolic Node / Document
33 -- TODO make instances of Nodes
35 -- All the Database is structred like a hierachical Tree
36 -- Where a is a NodeType:
37 -- TODO force the logic of the architecture
38 data Tree a = Empty | Node' a (Tree a) (Tree a) deriving (Show)
40 data NodeType = NodeUser
41 | Folder | Project | Corpus | Document
44 | List | StopList | MainList | MapList | GroupList
45 | Score | Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
46 | Tficf | TfidfCorpus | TfidfGlobal | TirankLocal | TirankGlobal
52 -- | NodePoly indicates that Node has a Polymorphism Type
53 type Node json = NodePoly NodeId NodeTypeId NodeUserId NodeParentId NodeName UTCTime json
54 -- type Node json = NodePoly NodeId NodeTypeId UserId ParentId NodeName UTCTime json
57 type NodeParentId = Int
61 --type NodeUser = Node HyperdataUser
63 -- | Then a Node can be either a Folder or a Corpus or a Document
64 type Folder = Node HyperdataFolder
66 type Corpus = Node HyperdataCorpus
67 type Document = Node HyperdataDocument
69 -- | Community Manager Use Case
70 type Annuaire = Corpus
71 type Individu = Document
73 -- | Favorites Node enable Node categorization
74 type Favorites = Node HyperdataFavorites
76 -- | Favorites Node enable Swap Node with some synonyms for clarity
77 type NodeSwap = Node HyperdataResource
79 -- | Then a Node can be a List which as some synonyms
80 type List = Node HyperdataList
86 -- | Then a Node can be a Score which as some synonyms
87 type Score = Node HyperdataScore
88 type Occurrences = Score
89 type Cooccurrences = Score
90 type Specclusion = Score
91 type Genclusion = Score
94 -- TODO All these Tfidf* will be replaced with TFICF
95 type TfidfCorpus = Tficf
96 type TfidfGlobal = Tficf
97 type TirankLocal = Tficf
98 type TirankGlobal = Tficf
100 -- | Then a Node can be either a Graph or a Phylo or a Notebook
101 type Graph = Node HyperdataGraph
102 type Phylo = Node HyperdataPhylo
103 type Notebook = Node HyperdataNotebook
106 nodeTypes :: [(NodeType, NodeTypeId)]
121 , (Cooccurrences , 9)
131 , (TirankGlobal , 17)
138 nodeTypeId :: NodeType -> NodeTypeId
139 nodeTypeId tn = fromMaybe (error ("Typename " ++ show tn ++ " does not exist")) (lookup tn nodeTypes)