Commit 8fb8da94 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[SPEC] Tree improved, more generic and closer from the actual Gargantext (Python) objects.

parent 85311942
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
module Data.Gargantext.Types.Main where module Data.Gargantext.Types.Main where
import Data.Monoid ((<>))
import Protolude (fromMaybe) import Protolude (fromMaybe)
--import Data.ByteString (ByteString()) --import Data.ByteString (ByteString())
...@@ -50,28 +51,26 @@ userTree = NodeT NodeUser [projectTree] ...@@ -50,28 +51,26 @@ userTree = NodeT NodeUser [projectTree]
projectTree :: Tree NodeType NodeType projectTree :: Tree NodeType NodeType
projectTree = NodeT Project [corpusTree] projectTree = NodeT Project [corpusTree]
-- | Corpus Tree simplified -- | Corpus Tree
corpusTree :: Tree NodeType NodeType corpusTree :: Tree NodeType NodeType
corpusTree = NodeT Corpus [ LeafT Document corpusTree = NodeT Corpus ( [ LeafT Document ]
, LeafT Favorites <> [ LeafT Lists ]
, LeafT List <> [ LeafT Metrics ]
, LeafT Score <> [ LeafT Favorites]
] )
-- | TODO add Symbolic Node / Document -- | TODO add Symbolic Node / Document
-- TODO make instances of Nodes -- TODO make instances of Nodes
data NodeType = NodeUser data NodeType = NodeUser | Project | Corpus | Document | DocumentCopy
| Folder | Project | Corpus | Document
| Favorites | Favorites
| NodeSwap | Lists
| List | StopList | MainList | MapList | GroupList | Metrics
| Score | Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
| Tficf | TfidfCorpus | TfidfGlobal | TirankLocal | TirankGlobal
deriving (Show, Eq) deriving (Show, Eq)
data Lists = StopList | MainList | MapList | GroupList
data Metrics = Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
| TfidfCorpus | TfidfGlobal | TirankLocal | TirankGlobal
...@@ -114,56 +113,56 @@ type MapList = List ...@@ -114,56 +113,56 @@ type MapList = List
type GroupList = List type GroupList = List
-- | Then a Node can be a Score which as some synonyms -- | Then a Node can be a Score which as some synonyms
type Score = Node HyperdataScore --type Score = Node HyperdataScore
type Occurrences = Score --type Occurrences = Score
type Cooccurrences = Score --type Cooccurrences = Score
type Specclusion = Score --type Specclusion = Score
type Genclusion = Score --type Genclusion = Score
type Cvalue = Score --type Cvalue = Score
type Tficf = Score --type Tficf = Score
-- TODO All these Tfidf* will be replaced with TFICF ---- TODO All these Tfidf* will be replaced with TFICF
type TfidfCorpus = Tficf --type TfidfCorpus = Tficf
type TfidfGlobal = Tficf --type TfidfGlobal = Tficf
type TirankLocal = Tficf --type TirankLocal = Tficf
type TirankGlobal = Tficf --type TirankGlobal = Tficf
--
-- | Then a Node can be either a Graph or a Phylo or a Notebook ---- | Then a Node can be either a Graph or a Phylo or a Notebook
type Graph = Node HyperdataGraph --type Graph = Node HyperdataGraph
type Phylo = Node HyperdataPhylo --type Phylo = Node HyperdataPhylo
type Notebook = Node HyperdataNotebook --type Notebook = Node HyperdataNotebook
nodeTypes :: [(NodeType, NodeTypeId)] --nodeTypes :: [(NodeType, NodeTypeId)]
nodeTypes = [ --nodeTypes = [
--(NodeUser , 1) -- --(NodeUser , 1)
----
-- (Project , 2)
-- , (NodeSwap , 19)
-- , (Corpus , 3)
-- , (Document , 4)
-------- Lists
-- , (StopList , 5)
-- , (GroupList , 6)
-- , (MainList , 7)
-- , (MapList ,  8)
---- Scores
-- , (Occurrences , 10)
-- , (Cooccurrences , 9)
--
-- , (Specclusion , 11)
-- , (Genclusion , 18)
-- , (Cvalue , 12)
--
-- , (TfidfCorpus , 13)
-- , (TfidfGlobal , 14)
--
-- , (TirankLocal , 16)
-- , (TirankGlobal , 17)
-- --
(Project , 2) ---- Node management
, (NodeSwap , 19) -- , (Favorites , 15)
, (Corpus , 3)
, (Document , 4)
------ Lists
, (StopList , 5)
, (GroupList , 6)
, (MainList , 7)
, (MapList ,  8)
-- Scores
, (Occurrences , 10)
, (Cooccurrences , 9)
, (Specclusion , 11)
, (Genclusion , 18)
, (Cvalue , 12)
, (TfidfCorpus , 13)
, (TfidfGlobal , 14)
, (TirankLocal , 16)
, (TirankGlobal , 17)
-- Node management
, (Favorites , 15)
]
-- --
nodeTypeId :: NodeType -> NodeTypeId -- ]
nodeTypeId tn = fromMaybe (error ("Typename " ++ show tn ++ " does not exist")) (lookup tn nodeTypes) ----
--nodeTypeId :: NodeType -> NodeTypeId
--nodeTypeId tn = fromMaybe (error ("Typename " ++ show tn ++ " does not exist")) (lookup tn nodeTypes)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment