3 Description : Gargantext Import Corpus
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Import a corpus binary.
14 {-# LANGUAGE NoImplicitPrelude #-}
15 {-# LANGUAGE OverloadedStrings #-}
16 {-# LANGUAGE FlexibleContexts #-}
17 {-# LANGUAGE RankNTypes #-}
18 {-# LANGUAGE Strict #-}
22 import System.Environment (getArgs)
23 import Gargantext.Prelude
24 import Gargantext.Database.Flow (FlowCmdM, flowCorpusFile, getOrMkRoot)
25 import Gargantext.Text.Corpus.Parsers (FileFormat(..))
26 import Gargantext.Database.Utils (Cmd, )
27 import Gargantext.Database.Types.Node (CorpusId, toHyperdataDocument, RootId)
28 import Gargantext.Database.Schema.User (insertUsersDemo, UserId)
29 import Gargantext.Text.Terms (TermType(..))
30 import Gargantext.Core (Lang(..))
31 import Gargantext.API.Types (GargError)
32 import Gargantext.API.Node () -- instances
33 import Gargantext.API.Settings (withDevEnv, runCmdDev, DevEnv)
34 --import Gargantext.Text.Corpus.Parsers.GrandDebat (readFile, GrandDebatReference(..))
35 import Data.Text (Text)
36 import qualified Data.Text as Text
37 import Control.Monad.IO.Class (liftIO)
43 let createUsers :: Cmd GargError Int64
44 createUsers = insertUsersDemo
47 mkRoots :: Cmd GargError (UserId, RootId)
48 mkRoots = getOrMkRoot "user1"
51 withDevEnv iniPath $ \env -> do
52 _ <- runCmdDev env createUsers
53 _ <- runCmdDev env mkRoots