2 Module : Gargantext.Database.Flow
3 Description : Database Flow
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 add :: Corpus -> [Documents] -> IO Int
13 if new id -> extractNgrams + extract Authors + extract Sources
15 insert Ngrams -> NgramsId
16 Map (NgramsId, NodeId) -> insert
18 data NgramsType = Sources | Authors | Terms
20 nodes_ngrams : column type, column list
29 {-# LANGUAGE NoImplicitPrelude #-}
31 module Gargantext.Database.Flow
34 import Data.Maybe (Maybe(..))
35 import Gargantext.Prelude
36 import Gargantext.Database.Bashql (runCmd')
37 import Gargantext.Database.Node (Cmd(..), getRootUser)
38 import Gargantext.Database.User (getUser, UserLight(..))
39 import Gargantext.Database.Node.Document.Import (insertDocuments)
42 gargantua_id <- runCmd' (getUser "gargantua")
44 userNode <- case gargantua_id of
45 Nothing -> panic "no user"
46 Just userId -> runCmd' (getRootUser $ userLight_id userId)
53 --rootId <- runCmd' (getNodeWith userId nodeType)
55 rootId <- mk NodeUser gargantua_id "Node Gargantua"
57 --folderId <- mk Folder parentId (Name "Data") (Descr "All corpora DATA here")
58 folderId <- mk Folder rootId "Data"
59 corpusId <- mk Corpus folderId (Name "WOS") (Descr "WOS database description")
61 docs <- parseDocuments WOS "doc/.."
62 ids <- addDocuments corpusId docs
64 user_id <- runCmd' (get RootUser "alexandre")