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
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
1c531d83
Commit
1c531d83
authored
Jan 21, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DB] flow WIP
parent
e72fb3c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
Flow.hs
src/Gargantext/Database/Flow.hs
+7
-7
Init.hs
src/Gargantext/Database/Init.hs
+3
-3
NodeNgrams.hs
src/Gargantext/Database/Schema/NodeNgrams.hs
+2
-2
No files found.
src/Gargantext/Database/Flow.hs
View file @
1c531d83
...
@@ -65,7 +65,7 @@ import Gargantext.Database.Root (getRoot)
...
@@ -65,7 +65,7 @@ import Gargantext.Database.Root (getRoot)
import
Gargantext.Database.Schema.Ngrams
-- (insertNgrams, Ngrams(..), NgramsIndexed(..), indexNgrams, NgramsType(..), text2ngrams, ngramsTypeId)
import
Gargantext.Database.Schema.Ngrams
-- (insertNgrams, Ngrams(..), NgramsIndexed(..), indexNgrams, NgramsType(..), text2ngrams, ngramsTypeId)
import
Gargantext.Database.Schema.Node
-- (mkRoot, mkCorpus, getOrMkList, mkGraph, {-mkPhylo,-} mkDashboard, mkAnnuaire, getCorporaWithParentId, HasNodeError, NodeError(..), nodeError)
import
Gargantext.Database.Schema.Node
-- (mkRoot, mkCorpus, getOrMkList, mkGraph, {-mkPhylo,-} mkDashboard, mkAnnuaire, getCorporaWithParentId, HasNodeError, NodeError(..), nodeError)
import
Gargantext.Database.Schema.NodeNgrams
(
listInsertDb
,
getCgramsId
)
import
Gargantext.Database.Schema.NodeNgrams
(
listInsertDb
,
getCgramsId
)
import
Gargantext.Database.Schema.NodeNodeNgrams2
-- (NodeNodeNgrams2, insertNodeNodeNgrams2)
import
Gargantext.Database.Schema.NodeNodeNgrams2
-- (NodeNodeNgrams2, insertNodeNodeNgrams2)
import
Gargantext.Database.Schema.User
(
getUser
,
UserLight
(
..
))
import
Gargantext.Database.Schema.User
(
getUser
,
UserLight
(
..
))
import
Gargantext.Database.TextSearch
(
searchInDatabase
)
import
Gargantext.Database.TextSearch
(
searchInDatabase
)
...
@@ -75,7 +75,7 @@ import Gargantext.Ext.IMT (toSchoolName)
...
@@ -75,7 +75,7 @@ import Gargantext.Ext.IMT (toSchoolName)
import
Gargantext.Ext.IMTUser
(
deserialiseImtUsersFromFile
)
import
Gargantext.Ext.IMTUser
(
deserialiseImtUsersFromFile
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Text.Terms.Eleve
(
buildTries
,
toToken
)
import
Gargantext.Text.Terms.Eleve
(
buildTries
,
toToken
)
--
import Gargantext.Text.List (buildNgramsLists,StopSize(..))
import
Gargantext.Text.List
(
buildNgramsLists
,
StopSize
(
..
))
import
Gargantext.Text.Corpus.Parsers
(
parseFile
,
FileFormat
)
import
Gargantext.Text.Corpus.Parsers
(
parseFile
,
FileFormat
)
import
qualified
Gargantext.Text.Corpus.API.Isidore
as
Isidore
import
qualified
Gargantext.Text.Corpus.API.Isidore
as
Isidore
import
Gargantext.Text.Terms
(
TermType
(
..
),
tt_lang
,
extractTerms
,
uniText
)
import
Gargantext.Text.Terms
(
TermType
(
..
),
tt_lang
,
extractTerms
,
uniText
)
...
@@ -214,7 +214,7 @@ flowCorpusUser :: (FlowCmdM env err m, MkCorpus c)
...
@@ -214,7 +214,7 @@ flowCorpusUser :: (FlowCmdM env err m, MkCorpus c)
->
Maybe
c
->
Maybe
c
->
[
NodeId
]
->
[
NodeId
]
->
m
CorpusId
->
m
CorpusId
flowCorpusUser
_
l
userName
corpusName
ctype
ids
=
do
flowCorpusUser
l
userName
corpusName
ctype
ids
=
do
-- User Flow
-- User Flow
(
userId
,
_rootId
,
userCorpusId
)
<-
getOrMk_RootWithCorpus
userName
corpusName
ctype
(
userId
,
_rootId
,
userCorpusId
)
<-
getOrMk_RootWithCorpus
userName
corpusName
ctype
listId
<-
getOrMkList
userCorpusId
userId
listId
<-
getOrMkList
userCorpusId
userId
...
@@ -226,10 +226,10 @@ flowCorpusUser _l userName corpusName ctype ids = do
...
@@ -226,10 +226,10 @@ flowCorpusUser _l userName corpusName ctype ids = do
-- printDebug "Node Text Id" tId
-- printDebug "Node Text Id" tId
-- User List Flow
-- User List Flow
(
_masterUserId
,
_masterRootId
,
_
masterCorpusId
)
<-
getOrMk_RootWithCorpus
userMaster
(
Left
""
)
ctype
(
masterUserId
,
_masterRootId
,
masterCorpusId
)
<-
getOrMk_RootWithCorpus
userMaster
(
Left
""
)
ctype
--
ngs <- buildNgramsLists l 2 3 (StopSize 3) userCorpusId masterCorpusId
ngs
<-
buildNgramsLists
l
2
3
(
StopSize
3
)
userCorpusId
masterCorpusId
--
_userListId <- flowList_DbRepo listId ngs
_userListId
<-
flowList_DbRepo
listId
ngs
--
mastListId <- getOrMkList masterCorpusId masterUserId
_
mastListId
<-
getOrMkList
masterCorpusId
masterUserId
-- _ <- insertOccsUpdates userCorpusId mastListId
-- _ <- insertOccsUpdates userCorpusId mastListId
-- printDebug "userListId" userListId
-- printDebug "userListId" userListId
-- User Graph Flow
-- User Graph Flow
...
...
src/Gargantext/Database/Init.hs
View file @
1c531d83
...
@@ -23,7 +23,7 @@ module Gargantext.Database.Init
...
@@ -23,7 +23,7 @@ module Gargantext.Database.Init
import
Gargantext.Database.Utils
(
Cmd
)
import
Gargantext.Database.Utils
(
Cmd
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Database.Triggers.Nodes
(
triggerSearchUpdate
)
import
Gargantext.Database.Triggers.Nodes
(
triggerSearchUpdate
)
import
Gargantext.Database.Triggers.NodesNodes
(
triggerDeleteCount
,
triggerInsertCount
,
triggerUpdateAdd
,
triggerUpdateDel
,
MasterListId
,
triggerCoocInsert
)
import
Gargantext.Database.Triggers.NodesNodes
(
triggerDeleteCount
,
triggerInsertCount
,
triggerUpdateAdd
,
triggerUpdateDel
,
MasterListId
)
--
, triggerCoocInsert)
import
Gargantext.Database.Triggers.NodeNodeNgrams
(
triggerCountInsert
,
triggerCountInsert2
)
import
Gargantext.Database.Triggers.NodeNodeNgrams
(
triggerCountInsert
,
triggerCountInsert2
)
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -32,7 +32,7 @@ initTriggers lId = do
...
@@ -32,7 +32,7 @@ initTriggers lId = do
t0
<-
triggerSearchUpdate
t0
<-
triggerSearchUpdate
t1
<-
triggerCountInsert
t1
<-
triggerCountInsert
t1'
<-
triggerCountInsert2
t1'
<-
triggerCountInsert2
t1''
<-
triggerCoocInsert
lId
--
t1'' <- triggerCoocInsert lId
t2
<-
triggerDeleteCount
lId
t2
<-
triggerDeleteCount
lId
t3
<-
triggerInsertCount
lId
t3
<-
triggerInsertCount
lId
t4
<-
triggerUpdateAdd
lId
t4
<-
triggerUpdateAdd
lId
...
@@ -40,7 +40,7 @@ initTriggers lId = do
...
@@ -40,7 +40,7 @@ initTriggers lId = do
pure
[
t0
pure
[
t0
,
t1
,
t1
,
t1'
,
t1'
,
t1''
--
,t1''
,
t2
,
t2
,
t3
,
t3
,
t4
,
t4
...
...
src/Gargantext/Database/Schema/NodeNgrams.hs
View file @
1c531d83
...
@@ -167,8 +167,8 @@ insertNodeNgrams nns = runPGSQuery query (PGS.Only $ Values fields nns')
...
@@ -167,8 +167,8 @@ insertNodeNgrams nns = runPGSQuery query (PGS.Only $ Values fields nns')
INSERT INTO node_ngrams (node_id, node_subtype, ngrams_id, ngrams_type, ngrams_field, ngrams_tag, ngrams_class, weight)
INSERT INTO node_ngrams (node_id, node_subtype, ngrams_id, ngrams_type, ngrams_field, ngrams_tag, ngrams_class, weight)
SELECT i.node_id, i.node_subtype, ng.id, i.ngrams_type, i.ngrams_field, i.ngrams_tag, i.ngrams_class, i.weight FROM input as i
SELECT i.node_id, i.node_subtype, ng.id, i.ngrams_type, i.ngrams_field, i.ngrams_tag, i.ngrams_class, i.weight FROM input as i
INNER JOIN ngrams as ng ON ng.terms = i.ngrams_terms
INNER JOIN ngrams as ng ON ng.terms = i.ngrams_terms
ON CONFLICT(node_id, node_subtype, ngrams_id)
ON CONFLICT(node_id, node_subtype, ngrams_id)
DO NOTHING
DO UPDATE SET node_subtype = excluded.node_subtype, ngrams_type = excluded.ngrams_type, ngrams_field = excluded.ngrams_field, ngrams_tag = excluded.ngrams_tag, ngrams_class = excluded.ngrams_class, weight = excluded.weight
--
DO UPDATE SET node_subtype = excluded.node_subtype, ngrams_type = excluded.ngrams_type, ngrams_field = excluded.ngrams_field, ngrams_tag = excluded.ngrams_tag, ngrams_class = excluded.ngrams_class, weight = excluded.weight
RETURNING id, ngrams_type, ngrams_id
RETURNING id, ngrams_type, ngrams_id
)
)
SELECT return.ngrams_type, ng.terms, return.id FROM return
SELECT return.ngrams_type, ng.terms, return.id FROM return
...
...
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