Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
c0afac67
Commit
c0afac67
authored
Nov 20, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DB][FLOW] clean.
parent
8b95cfb2
Pipeline
#9
failed with stage
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
Flow.hs
src/Gargantext/Database/Flow.hs
+8
-11
No files found.
src/Gargantext/Database/Flow.hs
View file @
c0afac67
...
...
@@ -34,7 +34,7 @@ import Data.Tuple.Extra (both, second)
import
qualified
Data.Map
as
DM
import
Gargantext.Core.Types
(
NodePoly
(
..
),
ListType
(
..
),
listId
)
import
Gargantext.Database.Bashql
(
runCmd'
)
--
, del)
import
Gargantext.Database.Bashql
(
runCmd'
,
del
)
import
Gargantext.Database.Ngrams
(
insertNgrams
,
Ngrams
(
..
),
NgramsT
(
..
),
NgramsIndexed
(
..
),
indexNgramsT
,
ngramsTypeId
,
NgramsType
(
..
),
text2ngrams
)
import
Gargantext.Database.Node
(
getRoot
,
mkRoot
,
mkCorpus
,
Cmd
(
..
),
mkList
)
import
Gargantext.Database.Node.Document.Add
(
add
)
...
...
@@ -51,7 +51,7 @@ type UserId = Int
type
RootId
=
Int
type
CorpusId
=
Int
flowDatabase
::
FileFormat
->
FilePath
->
CorpusName
->
IO
[
Int
]
flowDatabase
::
FileFormat
->
FilePath
->
CorpusName
->
IO
Int
flowDatabase
ff
fp
cName
=
do
-- Corus Flow
...
...
@@ -69,10 +69,10 @@ flowDatabase ff fp cName = do
-- Ngrams Flow
-- todo: flow for new documents only
let
tids
=
toInserted
ids
--
let tids = toInserted ids
--printDebug "toInserted ids" (length tids, tids)
let
tihs
=
toInsert
hyperdataDocuments
--
let tihs = toInsert hyperdataDocuments
--printDebug "toInsert hyperdataDocuments" (length tihs, tihs)
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
toInsert
hyperdataDocuments
)
...
...
@@ -94,16 +94,12 @@ flowDatabase ff fp cName = do
printDebug
"Docs IDs : "
(
length
idsRepeat
)
{-
-}
(
_
,
_
,
corpusId2
)
<-
subFlow
"user1"
cName
{-
inserted
<-
runCmd'
$
add
corpusId2
(
map
reId
ids
)
printDebug
"Inserted : "
(
length
inserted
)
-}
pure
[
corpusId2
,
corpusId
]
-- pure [corpusId2, corpusId]
--
runCmd' $ del [corpusId2, corpusId]
runCmd'
$
del
[
corpusId2
,
corpusId
]
type
CorpusName
=
Text
...
...
@@ -155,7 +151,8 @@ data DocumentWithId =
mergeData
::
Map
HashId
ReturnId
->
Map
HashId
HyperdataDocument
->
[
DocumentWithId
]
mergeData
rs
hs
=
map
(
\
(
hash
,
hpd
)
->
DocumentWithId
(
lookup'
hash
rs
)
hpd
)
$
DM
.
toList
hs
where
lookup'
h
xs
=
maybe
(
panic
$
"Database.Flow.mergeData: Error with "
<>
h
)
reId
(
DM
.
lookup
h
rs
)
lookup'
h
xs
=
maybe
(
panic
$
message
<>
h
)
reId
(
DM
.
lookup
h
xs
)
message
=
"Database.Flow.mergeData: Error with "
------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment