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 (:
29 type Ngrams = (Text, Text, Text)
31 -- | TODO add Symbolic Node / Document
32 -- TODO make instances of Nodes
34 -- All the Database is structred like a hierachical Tree
35 -- Where a is a NodeType:
36 -- TODO force the logic of the architecture
37 data Tree a = Empty | Node' a (Tree a) (Tree a) deriving (Show)
39 data NodeType = NodeUser
40 | Folder | Project | Corpus | Document
43 | List | StopList | MainList | MapList | GroupList
44 | Score | Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
45 | Tficf | TfidfCorpus | TfidfGlobal | TirankLocal | TirankGlobal
51 -- | NodePoly indicates that Node has a Polymorphism Type
52 type Node json = NodePoly NodeId NodeTypeId NodeUserId NodeParentId NodeName UTCTime json
53 -- type Node json = NodePoly NodeId NodeTypeId UserId ParentId NodeName UTCTime json
56 type NodeParentId = Int
60 --type NodeUser = Node HyperdataUser
62 -- | Then a Node can be either a Folder or a Corpus or a Document
63 type Folder = Node HyperdataFolder
65 type Corpus = Node HyperdataCorpus
66 type Document = Node HyperdataDocument
68 -- | Community Manager Use Case
69 type Annuaire = Corpus
70 type Individu = Document
72 -- | Favorites Node enable Node categorization
73 type Favorites = Node HyperdataFavorites
75 -- | Favorites Node enable Swap Node with some synonyms for clarity
76 type NodeSwap = Node HyperdataResource
78 -- | Then a Node can be a List which as some synonyms
79 type List = Node HyperdataList
85 -- | Then a Node can be a Score which as some synonyms
86 type Score = Node HyperdataScore
87 type Occurrences = Score
88 type Cooccurrences = Score
89 type Specclusion = Score
90 type Genclusion = Score
93 -- TODO All these Tfidf* will be replaced with TFICF
94 type TfidfCorpus = Tficf
95 type TfidfGlobal = Tficf
96 type TirankLocal = Tficf
97 type TirankGlobal = Tficf
99 -- | Then a Node can be either a Graph or a Phylo or a Notebook
100 type Graph = Node HyperdataGraph
101 type Phylo = Node HyperdataPhylo
102 type Notebook = Node HyperdataNotebook
105 nodeTypes :: [(NodeType, NodeTypeId)]
120 , (Cooccurrences , 9)
130 , (TirankGlobal , 17)
137 nodeTypeId :: NodeType -> NodeTypeId
138 nodeTypeId tn = fromMaybe (error ("Typename " ++ show tn ++ " does not exist")) (lookup tn nodeTypes)