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
11
Merge Requests
11
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
4e134509
Commit
4e134509
authored
Aug 31, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NAMING] Repo -> NodeStory
parent
f05e7b07
Pipeline
#1750
passed with stage
in 31 minutes and 47 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
51 deletions
+48
-51
API.hs
src/Gargantext/API.hs
+2
-2
Dev.hs
src/Gargantext/API/Dev.hs
+2
-2
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+10
-10
Tools.hs
src/Gargantext/API/Ngrams/Tools.hs
+2
-2
List.hs
src/Gargantext/Core/Text/List.hs
+1
-1
List.hs
src/Gargantext/Database/Action/Flow/List.hs
+31
-34
No files found.
src/Gargantext/API.hs
View file @
4e134509
...
@@ -43,7 +43,7 @@ import GHC.Generics (Generic)
...
@@ -43,7 +43,7 @@ import GHC.Generics (Generic)
import
Gargantext.API.Admin.Auth.Types
(
AuthContext
)
import
Gargantext.API.Admin.Auth.Types
(
AuthContext
)
import
Gargantext.API.Admin.Settings
(
newEnv
)
import
Gargantext.API.Admin.Settings
(
newEnv
)
import
Gargantext.API.Admin.Types
(
FireWall
(
..
),
PortNumber
,
cookieSettings
,
jwtSettings
,
settings
)
import
Gargantext.API.Admin.Types
(
FireWall
(
..
),
PortNumber
,
cookieSettings
,
jwtSettings
,
settings
)
import
Gargantext.API.Ngrams
(
save
Repo
)
import
Gargantext.API.Ngrams
(
save
NodeStory
)
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.API.Routes
import
Gargantext.API.Routes
import
Gargantext.API.Server
(
server
)
import
Gargantext.API.Server
(
server
)
...
@@ -80,7 +80,7 @@ portRouteInfo port = do
...
@@ -80,7 +80,7 @@ portRouteInfo port = do
stopGargantext
::
HasNodeStorySaver
env
=>
env
->
IO
()
stopGargantext
::
HasNodeStorySaver
env
=>
env
->
IO
()
stopGargantext
env
=
do
stopGargantext
env
=
do
putStrLn
"----- Stopping gargantext -----"
putStrLn
"----- Stopping gargantext -----"
runReaderT
save
Repo
env
runReaderT
save
NodeStory
env
{-
{-
startGargantextMock :: PortNumber -> IO ()
startGargantextMock :: PortNumber -> IO ()
...
...
src/Gargantext/API/Dev.hs
View file @
4e134509
...
@@ -17,7 +17,7 @@ import Control.Monad (fail)
...
@@ -17,7 +17,7 @@ import Control.Monad (fail)
import
Control.Monad.Reader
(
runReaderT
)
import
Control.Monad.Reader
(
runReaderT
)
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.Settings
import
Gargantext.API.Admin.Settings
import
Gargantext.API.Ngrams
(
save
Repo
)
import
Gargantext.API.Ngrams
(
save
NodeStory
)
import
Gargantext.API.Prelude
import
Gargantext.API.Prelude
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
import
Gargantext.Database.Prelude
import
Gargantext.Database.Prelude
...
@@ -64,7 +64,7 @@ runCmdDev :: (Show err) => DevEnv -> Cmd'' DevEnv err a -> IO a
...
@@ -64,7 +64,7 @@ runCmdDev :: (Show err) => DevEnv -> Cmd'' DevEnv err a -> IO a
runCmdDev
env
f
=
runCmdDev
env
f
=
(
either
(
fail
.
show
)
pure
=<<
runCmd
env
f
)
(
either
(
fail
.
show
)
pure
=<<
runCmd
env
f
)
`
finally
`
`
finally
`
runReaderT
save
Repo
env
runReaderT
save
NodeStory
env
runCmdDevNoErr
::
DevEnv
->
Cmd'
DevEnv
()
a
->
IO
a
runCmdDevNoErr
::
DevEnv
->
Cmd'
DevEnv
()
a
->
IO
a
runCmdDevNoErr
=
runCmdDev
runCmdDevNoErr
=
runCmdDev
...
...
src/Gargantext/API/Ngrams.hs
View file @
4e134509
...
@@ -54,7 +54,7 @@ module Gargantext.API.Ngrams
...
@@ -54,7 +54,7 @@ module Gargantext.API.Ngrams
,
r_history
,
r_history
,
NgramsRepo
,
NgramsRepo
,
NgramsRepoElement
(
..
)
,
NgramsRepoElement
(
..
)
,
save
Repo
,
save
NodeStory
,
initRepo
,
initRepo
,
RepoEnv
(
..
)
,
RepoEnv
(
..
)
...
@@ -178,9 +178,9 @@ mkChildrenGroups addOrRem nt patches =
...
@@ -178,9 +178,9 @@ mkChildrenGroups addOrRem nt patches =
------------------------------------------------------------------------
------------------------------------------------------------------------
save
Repo
::
(
MonadReader
env
m
,
MonadBase
IO
m
,
HasNodeStorySaver
env
)
save
NodeStory
::
(
MonadReader
env
m
,
MonadBase
IO
m
,
HasNodeStorySaver
env
)
=>
m
()
=>
m
()
save
Repo
=
liftBase
=<<
view
hasNodeStorySaver
save
NodeStory
=
liftBase
=<<
view
hasNodeStorySaver
listTypeConflictResolution
::
ListType
->
ListType
->
ListType
listTypeConflictResolution
::
ListType
->
ListType
->
ListType
...
@@ -217,7 +217,7 @@ copyListNgrams srcListId dstListId ngramsType = do
...
@@ -217,7 +217,7 @@ copyListNgrams srcListId dstListId ngramsType = do
var <- view repoVar
var <- view repoVar
liftBase $ modifyMVar_ var $
liftBase $ modifyMVar_ var $
pure . (r_state . at ngramsType %~ (Just . f . something))
pure . (r_state . at ngramsType %~ (Just . f . something))
save
Repo
save
NodeStory
where
where
f :: Map NodeId NgramsTableMap -> Map NodeId NgramsTableMap
f :: Map NodeId NgramsTableMap -> Map NodeId NgramsTableMap
f m = m & at dstListId %~ insertNewOnly (m ^. at srcListId)
f m = m & at dstListId %~ insertNewOnly (m ^. at srcListId)
...
@@ -232,7 +232,7 @@ addListNgrams listId ngramsType nes = do
...
@@ -232,7 +232,7 @@ addListNgrams listId ngramsType nes = do
var <- view repoVar
var <- view repoVar
liftBase $ modifyMVar_ var $
liftBase $ modifyMVar_ var $
pure . (r_state . at ngramsType . _Just . at listId . _Just <>~ m)
pure . (r_state . at ngramsType . _Just . at listId . _Just <>~ m)
save
Repo
save
NodeStory
where
where
m = Map.fromList $ (\n -> (n ^. ne_ngrams, n)) <$> nes
m = Map.fromList $ (\n -> (n ^. ne_ngrams, n)) <$> nes
-}
-}
...
@@ -257,7 +257,7 @@ setListNgrams listId ngramsType ns = do
...
@@ -257,7 +257,7 @@ setListNgrams listId ngramsType ns = do
.
at
ngramsType
.
at
ngramsType
.~
Just
ns
.~
Just
ns
)
)
save
Repo
save
NodeStory
currentVersion
::
HasNodeStory
env
err
m
currentVersion
::
HasNodeStory
env
err
m
...
@@ -286,7 +286,7 @@ commitStatePatch :: HasNodeStory env err m
...
@@ -286,7 +286,7 @@ commitStatePatch :: HasNodeStory env err m
->
m
(
Versioned
NgramsStatePatch'
)
->
m
(
Versioned
NgramsStatePatch'
)
commitStatePatch
listId
(
Versioned
p_version
p
)
=
do
commitStatePatch
listId
(
Versioned
p_version
p
)
=
do
printDebug
"[commitStatePatch]"
listId
printDebug
"[commitStatePatch]"
listId
var
<-
get
Repo
Var
[
listId
]
var
<-
get
NodeStory
Var
[
listId
]
vq'
<-
liftBase
$
modifyMVar
var
$
\
ns
->
do
vq'
<-
liftBase
$
modifyMVar
var
$
\
ns
->
do
let
let
a
=
ns
^.
unNodeStory
.
at
listId
.
_Just
a
=
ns
^.
unNodeStory
.
at
listId
.
_Just
...
@@ -312,7 +312,7 @@ commitStatePatch listId (Versioned p_version p) = do
...
@@ -312,7 +312,7 @@ commitStatePatch listId (Versioned p_version p) = do
pure
(
ns
&
unNodeStory
.
at
listId
.~
(
Just
a'
)
pure
(
ns
&
unNodeStory
.
at
listId
.~
(
Just
a'
)
,
Versioned
(
a'
^.
a_version
)
q'
,
Versioned
(
a'
^.
a_version
)
q'
)
)
save
Repo
save
NodeStory
-- Save new ngrams
-- Save new ngrams
_
<-
insertNgrams
(
newNgramsFromNgramsStatePatch
p
)
_
<-
insertNgrams
(
newNgramsFromNgramsStatePatch
p
)
...
@@ -328,7 +328,7 @@ tableNgramsPull :: HasNodeStory env err m
...
@@ -328,7 +328,7 @@ tableNgramsPull :: HasNodeStory env err m
->
m
(
Versioned
NgramsTablePatch
)
->
m
(
Versioned
NgramsTablePatch
)
tableNgramsPull
listId
ngramsType
p_version
=
do
tableNgramsPull
listId
ngramsType
p_version
=
do
printDebug
"[tableNgramsPull]"
(
listId
,
ngramsType
)
printDebug
"[tableNgramsPull]"
(
listId
,
ngramsType
)
var
<-
get
Repo
Var
[
listId
]
var
<-
get
NodeStory
Var
[
listId
]
r
<-
liftBase
$
readMVar
var
r
<-
liftBase
$
readMVar
var
let
let
...
@@ -467,7 +467,7 @@ getNgramsTableMap :: HasNodeStory env err m
...
@@ -467,7 +467,7 @@ getNgramsTableMap :: HasNodeStory env err m
->
TableNgrams
.
NgramsType
->
TableNgrams
.
NgramsType
->
m
(
Versioned
NgramsTableMap
)
->
m
(
Versioned
NgramsTableMap
)
getNgramsTableMap
nodeId
ngramsType
=
do
getNgramsTableMap
nodeId
ngramsType
=
do
v
<-
get
Repo
Var
[
nodeId
]
v
<-
get
NodeStory
Var
[
nodeId
]
repo
<-
liftBase
$
readMVar
v
repo
<-
liftBase
$
readMVar
v
pure
$
Versioned
(
repo
^.
unNodeStory
.
at
nodeId
.
_Just
.
a_version
)
pure
$
Versioned
(
repo
^.
unNodeStory
.
at
nodeId
.
_Just
.
a_version
)
(
repo
^.
unNodeStory
.
at
nodeId
.
_Just
.
a_state
.
at
ngramsType
.
_Just
)
(
repo
^.
unNodeStory
.
at
nodeId
.
_Just
.
a_state
.
at
ngramsType
.
_Just
)
...
...
src/Gargantext/API/Ngrams/Tools.hs
View file @
4e134509
...
@@ -51,9 +51,9 @@ getRepo' listIds = do
...
@@ -51,9 +51,9 @@ getRepo' listIds = do
pure
$
v'
pure
$
v'
get
Repo
Var
::
HasNodeStory
env
err
m
get
NodeStory
Var
::
HasNodeStory
env
err
m
=>
[
ListId
]
->
m
(
MVar
NodeListStory
)
=>
[
ListId
]
->
m
(
MVar
NodeListStory
)
get
Repo
Var
l
=
do
get
NodeStory
Var
l
=
do
f
<-
getNodeListStory
f
<-
getNodeListStory
v
<-
liftBase
$
f
l
v
<-
liftBase
$
f
l
pure
v
pure
v
...
...
src/Gargantext/Core/Text/List.hs
View file @
4e134509
...
@@ -220,7 +220,7 @@ buildNgramsTermsList user uCid mCid groupParams (nt, _mapListSize)= do
...
@@ -220,7 +220,7 @@ buildNgramsTermsList user uCid mCid groupParams (nt, _mapListSize)= do
$
setScoresWithMap
mapTextDocIds
(
groupedMonoHead
<>
groupedMultHead
)
$
setScoresWithMap
mapTextDocIds
(
groupedMonoHead
<>
groupedMultHead
)
printDebug
"groupedTreeScores_SetNodeId"
groupedTreeScores_SetNodeId
--
printDebug "groupedTreeScores_SetNodeId" groupedTreeScores_SetNodeId
-- Coocurrences computation
-- Coocurrences computation
--, t1 >= t2 -- permute byAxis diag -- since matrix symmetric
--, t1 >= t2 -- permute byAxis diag -- since matrix symmetric
...
...
src/Gargantext/Database/Action/Flow/List.hs
View file @
4e134509
...
@@ -23,8 +23,8 @@ import Control.Monad.Reader
...
@@ -23,8 +23,8 @@ import Control.Monad.Reader
import
Data.Map
(
Map
,
toList
)
import
Data.Map
(
Map
,
toList
)
import
Data.Maybe
(
catMaybes
)
import
Data.Maybe
(
catMaybes
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Gargantext.API.Ngrams
(
save
Repo
)
import
Gargantext.API.Ngrams
(
save
NodeStory
)
import
Gargantext.API.Ngrams.Tools
(
get
Repo
Var
)
import
Gargantext.API.Ngrams.Tools
(
get
NodeStory
Var
)
import
Gargantext.API.Ngrams.Types
import
Gargantext.API.Ngrams.Types
import
Gargantext.Core.Types
(
HasInvalidError
(
..
),
assertValid
)
import
Gargantext.Core.Types
(
HasInvalidError
(
..
),
assertValid
)
import
Gargantext.Core.Types.Main
(
ListType
(
CandidateTerm
))
import
Gargantext.Core.Types.Main
(
ListType
(
CandidateTerm
))
...
@@ -138,8 +138,6 @@ listInsert lId ngs = mapM_ (\(typeList, ngElmts)
...
@@ -138,8 +138,6 @@ listInsert lId ngs = mapM_ (\(typeList, ngElmts)
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-- NOTE
-- NOTE
-- This is no longer part of the API.
-- This is no longer part of the API.
-- This function is maintained for its usage in Database.Action.Flow.List.
-- This function is maintained for its usage in Database.Action.Flow.List.
...
@@ -155,34 +153,33 @@ putListNgrams nodeId ngramsType nes = putListNgrams' nodeId ngramsType m
...
@@ -155,34 +153,33 @@ putListNgrams nodeId ngramsType nes = putListNgrams' nodeId ngramsType m
where
where
m
=
Map
.
fromList
$
map
(
\
n
->
(
n
^.
ne_ngrams
,
ngramsElementToRepo
n
))
nes
m
=
Map
.
fromList
$
map
(
\
n
->
(
n
^.
ne_ngrams
,
ngramsElementToRepo
n
))
nes
putListNgrams'
::
(
HasInvalidError
err
,
HasNodeStory
env
err
m
)
putListNgrams'
::
(
HasInvalidError
err
,
HasNodeStory
env
err
m
)
=>
NodeId
=>
NodeId
->
TableNgrams
.
NgramsType
->
TableNgrams
.
NgramsType
->
Map
NgramsTerm
NgramsRepoElement
->
Map
NgramsTerm
NgramsRepoElement
->
m
()
->
m
()
putListNgrams'
listId
ngramsType
ns
=
do
putListNgrams'
listId
ngramsType'
ns
=
do
-- printDebug "[putListNgrams'] nodeId" nodeId
-- printDebug "[putListNgrams'] nodeId" nodeId
-- printDebug "[putListNgrams'] ngramsType" ngramsType
-- printDebug "[putListNgrams'] ngramsType" ngramsType
-- printDebug "[putListNgrams'] ns" ns
-- printDebug "[putListNgrams'] ns" ns
let
p1
=
NgramsTablePatch
.
PM
.
fromMap
$
NgramsReplace
Nothing
.
Just
<$>
ns
let
p1
=
NgramsTablePatch
.
PM
.
fromMap
$
NgramsReplace
Nothing
.
Just
<$>
ns
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType
p1
(
p
,
p_validity
)
=
PM
.
singleton
ngramsType'
p1
assertValid
p_validity
assertValid
p_validity
{-
{-
-- TODO
-- TODO
v <- currentVersion
v <- currentVersion
q <- commitStatePatch (Versioned v p)
q <- commitStatePatch (Versioned v p)
assert empty q
assert empty q
-- What if another commit comes in between?
-- What if another commit comes in between?
-- Shall we have a blindCommitStatePatch? It would not ask for a version but just a patch.
-- Shall we have a blindCommitStatePatch? It would not ask for a version but just a patch.
-- The modifyMVar_ would test the patch with applicable first.
-- The modifyMVar_ would test the patch with applicable first.
-- If valid the rest would be atomic and no merge is required.
-- If valid the rest would be atomic and no merge is required.
-}
-}
var
<-
getRepoVar
[
listId
]
var
<-
getNodeStoryVar
[
listId
]
liftBase
$
modifyMVar_
var
$
\
r
->
do
liftBase
$
modifyMVar_
var
$
\
r
->
do
pure
$
r
&
unNodeStory
.
at
listId
.
_Just
.
a_version
+~
1
pure
$
r
&
unNodeStory
.
at
listId
.
_Just
.
a_version
+~
1
&
unNodeStory
.
at
listId
.
_Just
.
a_history
%~
(
p
:
)
&
unNodeStory
.
at
listId
.
_Just
.
a_history
%~
(
p
:
)
&
unNodeStory
.
at
listId
.
_Just
.
a_state
.
at
ngramsType
.~
Just
ns
&
unNodeStory
.
at
listId
.
_Just
.
a_state
.
at
ngramsType'
.~
Just
ns
saveRepo
saveNodeStory
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