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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Julien Moutinho
haskell-gargantext
Commits
9156825b
Commit
9156825b
authored
Feb 09, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/175-dev-doc-table-count' into dev-merge
parents
0ae2b028
a19f6924
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
573 additions
and
668 deletions
+573
-668
cabal.project
cabal.project
+0
-189
gargantext.cabal
gargantext.cabal
+46
-45
package.yaml
package.yaml
+42
-41
Pairing.hs
src/Gargantext/Database/Action/Flow/Pairing.hs
+8
-11
Search.hs
src/Gargantext/Database/Action/Search.hs
+53
-33
Share.hs
src/Gargantext/Database/Action/Share.hs
+37
-21
Prelude.hs
src/Gargantext/Database/Prelude.hs
+14
-6
Facet.hs
src/Gargantext/Database/Query/Facet.hs
+70
-42
Types.hs
src/Gargantext/Database/Query/Facet/Types.hs
+25
-25
Join.hs
src/Gargantext/Database/Query/Join.hs
+11
-11
Select.hs
src/Gargantext/Database/Query/Table/Node/Select.hs
+17
-13
NodeContext.hs
src/Gargantext/Database/Query/Table/NodeContext.hs
+34
-27
NodeNode.hs
src/Gargantext/Database/Query/Table/NodeNode.hs
+37
-37
User.hs
src/Gargantext/Database/Query/Table/User.hs
+1
-1
Context.hs
src/Gargantext/Database/Schema/Context.hs
+50
-50
ContextNodeNgrams.hs
src/Gargantext/Database/Schema/ContextNodeNgrams.hs
+21
-18
Ngrams.hs
src/Gargantext/Database/Schema/Ngrams.hs
+12
-12
Node.hs
src/Gargantext/Database/Schema/Node.hs
+50
-50
NodeContext.hs
src/Gargantext/Database/Schema/NodeContext.hs
+15
-15
NodeNode.hs
src/Gargantext/Database/Schema/NodeNode.hs
+13
-14
User.hs
src/Gargantext/Database/Schema/User.hs
+5
-5
Tuple.hs
src/Gargantext/Utils/Tuple.hs
+10
-0
stack.yaml
stack.yaml
+2
-2
No files found.
cabal.project
deleted
100644 → 0
View file @
0ae2b028
packages
:
.
allow
-
newer
:
base
,
accelerate
,
servant
,
time
,
classy
-
prelude
allow
-
newer
:
binary
,
primitive
,
vector
--
Patches
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
servant
-
job
.
git
tag
:
ceb251b91e8ec1804198422a3cdbdab08d843b79
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
ekg
-
json
.
git
tag
:
fd7e5d7325939103cd87d0dc592faf644160341c
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
haskell
-
servant
/
servant
.
git
tag
:
c2af6e775d1d36f2011d43aff230bb502f8fba63
subdir
:
servant
/
servant
-
server
/
servant
-
client
-
core
/
servant
-
client
/
servant
-
auth
/
servant
-
auth
/
servant
-
auth
/
servant
-
auth
-
client
/
servant
-
auth
/
servant
-
auth
-
server
/
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
delanoe
/
patches
-
map
.
git
tag
:
76
cae88f367976ff091e661ee69a5c3126b94694
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
patches
-
class
.
git
tag
:
271
ba32d6c940029dc653354dd7974a819f48e77
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
cgenie
/
haskell
-
gargantext
-
prelude
.
git
tag
:
6
bfdb29e9a576472c7fd7ebe648ad101e5b3927f
--
External
Data
API
connectors
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
crawlers
/
pubmed
.
git
tag
:
9
cdba6423decad5acfacb0f274212fd8723ce734
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
crawlers
/
isidore
.
git
tag
:
3
db385e767d2100d8abe900833c6e7de3ac55e1b
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
crawlers
/
istex
.
git
tag
:
daeae80365250c4bd539f0a65e271f9aa37f731f
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
crawlers
/
hal
.
git
tag
:
020f5f9
b308f5c23c925aedf5fb11f8b4728fb19
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
crawlers
/
arxiv
-
api
.
git
tag
:
f3e517cc40d92e282c5245b23d253d2ca3f802e5
--
Graphs
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
haskell
-
igraph
.
git
tag
:
9f55
eb36639c8e0965c8bc539a57738869f33e9a
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
haskell
-
infomap
.
git
tag
:
6
d1d60b952b9b2b272b58fc5539700fd8890ac88
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
gargantext
-
graph
.
git
tag
:
f41ee8b53c3264e5aa5adc06b2e5b293d2a8c474
--
Data
mining
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
delanoe
/
data
-
time
-
segment
.
git
tag
:
10
a416b9f6c443866b36479c3441ebb3bcdeb7ef
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
gargantext
/
hlcm
.
git
tag
:
6f0595
d2421005837d59151a8b26eee83ebb67b5
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
delanoe
/
hstatistics
.
git
tag
:
90
eef7604bb230644c2246eccd094d7bfefcb135
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
paulrzcz
/
HSvm
.
git
tag
:
3f
e28b683aba5ddf05e3b5f8eced0bd05c5a29f9
--
servant
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
delanoe
/
servant
-
static
-
th
.
git
tag
:
8
cb8aaf2962ad44d319fcea48442e4397b3c49e8
--
source
-
repository
-
package
--
type
:
git
--
location
:
https
://
github
.
com
/
alpmestan
/
servant
-
job
.
git
--
tag
:
e9a4c57ca3ddee450627ed251df942effb27e4be
--
Database
libraries
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
delanoe
/
haskell
-
opaleye
.
git
tag
:
756
cb90f4ce725463d957bc899d764e0ed73738c
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
delanoe
/
hsparql
.
git
tag
:
308
c74b71a1abb0a91546fa57d353131248e3a7f
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
rdf4h
.
git
tag
:
fc24987d3af348a677748f226e48d64779a694e9
--
numerical
computing
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
accelerate
.
git
tag
:
640
b5af87cea94b61c7737d878e6f7f2fca5c015
source
-
repository
-
package
type
:
git
location
:
https
://
gitlab
.
iscpif
.
fr
/
amestanogullari
/
accelerate
-
utility
.
git
tag
:
a3875fe652d3bb5acb522674c22c6c814c1b4ad0
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
accelerate
-
arithmetic
.
git
tag
:
a110807651036ca2228a76507ee35bbf7aedf87a
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
accelerate
-
llvm
.
git
tag
:
944f5
a4aea35ee6aedb81ea754bf46b131fce9e3
subdir
:
accelerate
-
llvm
/
accelerate
-
llvm
-
native
/
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
hmatrix
.
git
tag
:
b9fca8beee0f23c17a6b2001ec834d071709e6e7
subdir
:
packages
/
base
/
--
Wikidata
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
rspeer
/
wikiparsec
.
git
tag
:
9637
a82344bb70f7fa8f02e75db3c081ccd434ce
--
numerical
computing
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
alpmestan
/
sparse
-
linear
.
git
tag
:
bc6ca8058077b0b5702ea4b88bd4189cfcad267a
subdir
:
sparse
-
linear
/
constraints
:
unordered
-
containers
==
0.2.14
.*,
servant
-
ekg
==
0.3.1
,
time
==
1.9.3
,
stm
==
2.5.0.1
,
vector
==
0.12.3.0
,
eigen
==
3.3.7.0
,
cborg
==
0.2.6.0
,
primitive
==
0.7.3.0
package
accelerate
flags
:
+
debug
\ No newline at end of file
gargantext.cabal
View file @
9156825b
...
@@ -30,61 +30,34 @@ library
...
@@ -30,61 +30,34 @@ library
exposed-modules:
exposed-modules:
Gargantext
Gargantext
Gargantext.API
Gargantext.API
Gargantext.API.Admin.Auth.Types
Gargantext.API.Admin.EnvTypes
Gargantext.API.Admin.Settings
Gargantext.API.Admin.Types
Gargantext.API.Dev
Gargantext.API.Dev
Gargantext.API.HashedResponse
Gargantext.API.HashedResponse
Gargantext.API.Node
Gargantext.API.Node.Share
Gargantext.API.Node.File
Gargantext.API.Ngrams
Gargantext.API.Ngrams
Gargantext.API.Ngrams.Prelude
Gargantext.API.Ngrams.Tools
Gargantext.API.Ngrams.Tools
Gargantext.API.Ngrams.Types
Gargantext.API.Ngrams.Types
Gargantext.API.Ngrams.Prelude
Gargantext.API.Node
Gargantext.API.Admin.Settings
Gargantext.API.Node.File
Gargantext.API.Admin.EnvTypes
Gargantext.API.Node.Share
Gargantext.API.Admin.Auth.Types
Gargantext.API.Admin.Types
Gargantext.API.Prelude
Gargantext.API.Prelude
Gargantext.Core
Gargantext.Core
Gargantext.Core.NodeStory
Gargantext.Core.Methods.Similarities
Gargantext.Core.Methods.Similarities
Gargantext.Core.Types
Gargantext.Core.NodeStory
Gargantext.Core.Types.Individu
Gargantext.Core.Types.Main
Gargantext.Core.Utils
Gargantext.Core.Utils.Prefix
Gargantext.Utils.Jobs
Gargantext.Utils.Jobs.API
Gargantext.Utils.Jobs.Map
Gargantext.Utils.Jobs.Monad
Gargantext.Utils.Jobs.Queue
Gargantext.Utils.Jobs.Settings
Gargantext.Utils.Jobs.State
Gargantext.Utils.SpacyNLP
Gargantext.Database.Action.Flow
Gargantext.Database.Action.Flow.Types
Gargantext.Database.Action.User.New
Gargantext.Database.Query.Table.User
Gargantext.Database.Query.Table.Node
Gargantext.Database.Query.Table.Node.UpdateOpaleye
Gargantext.Database.Query.Table.NgramsPostag
Gargantext.Database.Schema.Ngrams
Gargantext.Database.Prelude
Gargantext.Database.Admin.Trigger.Init
Gargantext.Database.Admin.Config
Gargantext.Database.Admin.Types.Hyperdata
Gargantext.Database.Admin.Types.Node
Gargantext.Defaults
Gargantext.Core.Text
Gargantext.Core.Text
Gargantext.Core.Text.Context
Gargantext.Core.Text.Context
Gargantext.Core.Text.Corpus.Parsers
Gargantext.Core.Text.Corpus.Parsers.Date.Parsec
Gargantext.Core.Text.Corpus.API
Gargantext.Core.Text.Corpus.API
Gargantext.Core.Text.Corpus.Parsers
Gargantext.Core.Text.Corpus.Parsers.CSV
Gargantext.Core.Text.Corpus.Parsers.CSV
Gargantext.Core.Text.Corpus.Parsers.Date.Parsec
Gargantext.Core.Text.List.Formats.CSV
Gargantext.Core.Text.List.Formats.CSV
Gargantext.Core.Text.Metrics
Gargantext.Core.Text.Metrics
Gargantext.Core.Text.Metrics.TFICF
Gargantext.Core.Text.Metrics.CharByChar
Gargantext.Core.Text.Metrics.CharByChar
Gargantext.Core.Text.Metrics.Count
Gargantext.Core.Text.Metrics.Count
Gargantext.Core.Text.Metrics.TFICF
Gargantext.Core.Text.Prepare
Gargantext.Core.Text.Prepare
Gargantext.Core.Text.Search
Gargantext.Core.Text.Search
Gargantext.Core.Text.Terms
Gargantext.Core.Text.Terms
...
@@ -94,18 +67,46 @@ library
...
@@ -94,18 +67,46 @@ library
Gargantext.Core.Text.Terms.Multi.Lang.Fr
Gargantext.Core.Text.Terms.Multi.Lang.Fr
Gargantext.Core.Text.Terms.Multi.RAKE
Gargantext.Core.Text.Terms.Multi.RAKE
Gargantext.Core.Text.Terms.WithList
Gargantext.Core.Text.Terms.WithList
Gargantext.Core.Types
Gargantext.Core.Types.Individu
Gargantext.Core.Types.Main
Gargantext.Core.Utils
Gargantext.Core.Utils.Prefix
Gargantext.Core.Viz.Graph
Gargantext.Core.Viz.Graph
Gargantext.Core.Viz.Graph.Index
Gargantext.Core.Viz.Graph.Tools
Gargantext.Core.Viz.Graph.Tools
Gargantext.Core.Viz.Graph.Tools.IGraph
Gargantext.Core.Viz.Graph.Tools.IGraph
Gargantext.Core.Viz.Graph.Index
Gargantext.Core.Viz.Phylo
Gargantext.Core.Viz.Phylo
Gargantext.Core.Viz.Phylo.API
Gargantext.Core.Viz.Phylo.API
Gargantext.Core.Viz.Phylo.API.Tools
Gargantext.Core.Viz.Phylo.API.Tools
Gargantext.Core.Viz.Phylo.PhyloExport
Gargantext.Core.Viz.Phylo.PhyloMaker
Gargantext.Core.Viz.Phylo.PhyloMaker
Gargantext.Core.Viz.Phylo.PhyloTools
Gargantext.Core.Viz.Phylo.PhyloTools
Gargantext.Core.Viz.Phylo.PhyloExport
Gargantext.Core.Viz.Phylo.SynchronicClustering
Gargantext.Core.Viz.Phylo.SynchronicClustering
Gargantext.Core.Viz.Types
Gargantext.Core.Viz.Types
Gargantext.Database.Action.Flow
Gargantext.Database.Action.Flow.Types
Gargantext.Database.Action.User.New
Gargantext.Database.Admin.Config
Gargantext.Database.Admin.Trigger.Init
Gargantext.Database.Admin.Types.Hyperdata
Gargantext.Database.Admin.Types.Node
Gargantext.Database.Prelude
Gargantext.Database.Query.Table.NgramsPostag
Gargantext.Database.Query.Table.Node
Gargantext.Database.Query.Table.Node.UpdateOpaleye
Gargantext.Database.Query.Table.User
Gargantext.Database.Schema.Ngrams
Gargantext.Defaults
Gargantext.Utils.Jobs
Gargantext.Utils.Jobs.API
Gargantext.Utils.Jobs.Map
Gargantext.Utils.Jobs.Monad
Gargantext.Utils.Jobs.Queue
Gargantext.Utils.Jobs.Settings
Gargantext.Utils.Jobs.State
Gargantext.Utils.SpacyNLP
Gargantext.Utils.Tuple
other-modules:
other-modules:
Gargantext.API.Admin.Auth
Gargantext.API.Admin.Auth
Gargantext.API.Admin.FrontEnd
Gargantext.API.Admin.FrontEnd
...
@@ -144,8 +145,8 @@ library
...
@@ -144,8 +145,8 @@ library
Gargantext.API.Node.Corpus.Types
Gargantext.API.Node.Corpus.Types
Gargantext.API.Node.Document.Export
Gargantext.API.Node.Document.Export
Gargantext.API.Node.Document.Export.Types
Gargantext.API.Node.Document.Export.Types
Gargantext.API.Node.DocumentsFromWriteNodes
Gargantext.API.Node.DocumentUpload
Gargantext.API.Node.DocumentUpload
Gargantext.API.Node.DocumentsFromWriteNodes
Gargantext.API.Node.FrameCalcUpload
Gargantext.API.Node.FrameCalcUpload
Gargantext.API.Node.Get
Gargantext.API.Node.Get
Gargantext.API.Node.New
Gargantext.API.Node.New
...
@@ -189,10 +190,10 @@ library
...
@@ -189,10 +190,10 @@ library
Gargantext.Core.Text.Corpus.Parsers.Json2Csv
Gargantext.Core.Text.Corpus.Parsers.Json2Csv
Gargantext.Core.Text.Corpus.Parsers.RIS
Gargantext.Core.Text.Corpus.Parsers.RIS
Gargantext.Core.Text.Corpus.Parsers.RIS.Presse
Gargantext.Core.Text.Corpus.Parsers.RIS.Presse
Gargantext.Core.Text.Corpus.Parsers.WOS
Gargantext.Core.Text.Corpus.Parsers.Wikidata
Gargantext.Core.Text.Corpus.Parsers.Wikidata
Gargantext.Core.Text.Corpus.Parsers.Wikidata.Crawler
Gargantext.Core.Text.Corpus.Parsers.Wikidata.Crawler
Gargantext.Core.Text.Corpus.Parsers.Wikimedia
Gargantext.Core.Text.Corpus.Parsers.Wikimedia
Gargantext.Core.Text.Corpus.Parsers.WOS
Gargantext.Core.Text.Learn
Gargantext.Core.Text.Learn
Gargantext.Core.Text.List
Gargantext.Core.Text.List
Gargantext.Core.Text.List.Group
Gargantext.Core.Text.List.Group
...
@@ -299,12 +300,12 @@ library
...
@@ -299,12 +300,12 @@ library
Gargantext.Database.Query.Table.Node.Select
Gargantext.Database.Query.Table.Node.Select
Gargantext.Database.Query.Table.Node.Update
Gargantext.Database.Query.Table.Node.Update
Gargantext.Database.Query.Table.Node.User
Gargantext.Database.Query.Table.Node.User
Gargantext.Database.Query.Table.Node_NodeNgramsNodeNgrams
Gargantext.Database.Query.Table.NodeContext
Gargantext.Database.Query.Table.NodeContext
Gargantext.Database.Query.Table.NodeContext_NodeContext
Gargantext.Database.Query.Table.NodeContext_NodeContext
Gargantext.Database.Query.Table.NodeNgrams
Gargantext.Database.Query.Table.NodeNgrams
Gargantext.Database.Query.Table.NodeNode
Gargantext.Database.Query.Table.NodeNode
Gargantext.Database.Query.Table.NodeNodeNgrams
Gargantext.Database.Query.Table.NodeNodeNgrams
Gargantext.Database.Query.Table.Node_NodeNgramsNodeNgrams
Gargantext.Database.Query.Table.NodesNgramsRepo
Gargantext.Database.Query.Table.NodesNgramsRepo
Gargantext.Database.Query.Tree
Gargantext.Database.Query.Tree
Gargantext.Database.Query.Tree.Error
Gargantext.Database.Query.Tree.Error
...
@@ -314,13 +315,13 @@ library
...
@@ -314,13 +315,13 @@ library
Gargantext.Database.Schema.ContextNodeNgrams2
Gargantext.Database.Schema.ContextNodeNgrams2
Gargantext.Database.Schema.NgramsPostag
Gargantext.Database.Schema.NgramsPostag
Gargantext.Database.Schema.Node
Gargantext.Database.Schema.Node
Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
Gargantext.Database.Schema.NodeContext
Gargantext.Database.Schema.NodeContext
Gargantext.Database.Schema.NodeContext_NodeContext
Gargantext.Database.Schema.NodeContext_NodeContext
Gargantext.Database.Schema.NodeNgrams
Gargantext.Database.Schema.NodeNgrams
Gargantext.Database.Schema.NodeNode
Gargantext.Database.Schema.NodeNode
Gargantext.Database.Schema.NodeNodeNgrams
Gargantext.Database.Schema.NodeNodeNgrams
Gargantext.Database.Schema.NodeNodeNgrams2
Gargantext.Database.Schema.NodeNodeNgrams2
Gargantext.Database.Schema.Node_NodeNgramsNodeNgrams
Gargantext.Database.Schema.NodesNgramsRepo
Gargantext.Database.Schema.NodesNgramsRepo
Gargantext.Database.Schema.Prelude
Gargantext.Database.Schema.Prelude
Gargantext.Database.Schema.User
Gargantext.Database.Schema.User
...
...
package.yaml
View file @
9156825b
...
@@ -55,61 +55,34 @@ library:
...
@@ -55,61 +55,34 @@ library:
exposed-modules
:
exposed-modules
:
-
Gargantext
-
Gargantext
-
Gargantext.API
-
Gargantext.API
-
Gargantext.API.Admin.Auth.Types
-
Gargantext.API.Admin.EnvTypes
-
Gargantext.API.Admin.Settings
-
Gargantext.API.Admin.Types
-
Gargantext.API.Dev
-
Gargantext.API.Dev
-
Gargantext.API.HashedResponse
-
Gargantext.API.HashedResponse
-
Gargantext.API.Node
-
Gargantext.API.Node.Share
-
Gargantext.API.Node.File
-
Gargantext.API.Ngrams
-
Gargantext.API.Ngrams
-
Gargantext.API.Ngrams.Prelude
-
Gargantext.API.Ngrams.Tools
-
Gargantext.API.Ngrams.Tools
-
Gargantext.API.Ngrams.Types
-
Gargantext.API.Ngrams.Types
-
Gargantext.API.Ngrams.Prelude
-
Gargantext.API.Node
-
Gargantext.API.Admin.Settings
-
Gargantext.API.Node.File
-
Gargantext.API.Admin.EnvTypes
-
Gargantext.API.Node.Share
-
Gargantext.API.Admin.Auth.Types
-
Gargantext.API.Admin.Types
-
Gargantext.API.Prelude
-
Gargantext.API.Prelude
-
Gargantext.Core
-
Gargantext.Core
-
Gargantext.Core.NodeStory
-
Gargantext.Core.Methods.Similarities
-
Gargantext.Core.Methods.Similarities
-
Gargantext.Core.Types
-
Gargantext.Core.NodeStory
-
Gargantext.Core.Types.Individu
-
Gargantext.Core.Types.Main
-
Gargantext.Core.Utils
-
Gargantext.Core.Utils.Prefix
-
Gargantext.Utils.Jobs
-
Gargantext.Utils.Jobs.API
-
Gargantext.Utils.Jobs.Map
-
Gargantext.Utils.Jobs.Monad
-
Gargantext.Utils.Jobs.Queue
-
Gargantext.Utils.Jobs.Settings
-
Gargantext.Utils.Jobs.State
-
Gargantext.Utils.SpacyNLP
-
Gargantext.Database.Action.Flow
-
Gargantext.Database.Action.Flow.Types
-
Gargantext.Database.Action.User.New
-
Gargantext.Database.Query.Table.User
-
Gargantext.Database.Query.Table.Node
-
Gargantext.Database.Query.Table.Node.UpdateOpaleye
-
Gargantext.Database.Query.Table.NgramsPostag
-
Gargantext.Database.Schema.Ngrams
-
Gargantext.Database.Prelude
-
Gargantext.Database.Admin.Trigger.Init
-
Gargantext.Database.Admin.Config
-
Gargantext.Database.Admin.Types.Hyperdata
-
Gargantext.Database.Admin.Types.Node
-
Gargantext.Defaults
-
Gargantext.Core.Text
-
Gargantext.Core.Text
-
Gargantext.Core.Text.Context
-
Gargantext.Core.Text.Context
-
Gargantext.Core.Text.Corpus.Parsers
-
Gargantext.Core.Text.Corpus.Parsers.Date.Parsec
-
Gargantext.Core.Text.Corpus.API
-
Gargantext.Core.Text.Corpus.API
-
Gargantext.Core.Text.Corpus.Parsers
-
Gargantext.Core.Text.Corpus.Parsers.CSV
-
Gargantext.Core.Text.Corpus.Parsers.CSV
-
Gargantext.Core.Text.Corpus.Parsers.Date.Parsec
-
Gargantext.Core.Text.List.Formats.CSV
-
Gargantext.Core.Text.List.Formats.CSV
-
Gargantext.Core.Text.Metrics
-
Gargantext.Core.Text.Metrics
-
Gargantext.Core.Text.Metrics.TFICF
-
Gargantext.Core.Text.Metrics.CharByChar
-
Gargantext.Core.Text.Metrics.CharByChar
-
Gargantext.Core.Text.Metrics.Count
-
Gargantext.Core.Text.Metrics.Count
-
Gargantext.Core.Text.Metrics.TFICF
-
Gargantext.Core.Text.Prepare
-
Gargantext.Core.Text.Prepare
-
Gargantext.Core.Text.Search
-
Gargantext.Core.Text.Search
-
Gargantext.Core.Text.Terms
-
Gargantext.Core.Text.Terms
...
@@ -119,18 +92,46 @@ library:
...
@@ -119,18 +92,46 @@ library:
-
Gargantext.Core.Text.Terms.Multi.Lang.Fr
-
Gargantext.Core.Text.Terms.Multi.Lang.Fr
-
Gargantext.Core.Text.Terms.Multi.RAKE
-
Gargantext.Core.Text.Terms.Multi.RAKE
-
Gargantext.Core.Text.Terms.WithList
-
Gargantext.Core.Text.Terms.WithList
-
Gargantext.Core.Types
-
Gargantext.Core.Types.Individu
-
Gargantext.Core.Types.Main
-
Gargantext.Core.Utils
-
Gargantext.Core.Utils.Prefix
-
Gargantext.Core.Viz.Graph
-
Gargantext.Core.Viz.Graph
-
Gargantext.Core.Viz.Graph.Index
-
Gargantext.Core.Viz.Graph.Tools
-
Gargantext.Core.Viz.Graph.Tools
-
Gargantext.Core.Viz.Graph.Tools.IGraph
-
Gargantext.Core.Viz.Graph.Tools.IGraph
-
Gargantext.Core.Viz.Graph.Index
-
Gargantext.Core.Viz.Phylo
-
Gargantext.Core.Viz.Phylo
-
Gargantext.Core.Viz.Phylo.API
-
Gargantext.Core.Viz.Phylo.API
-
Gargantext.Core.Viz.Phylo.API.Tools
-
Gargantext.Core.Viz.Phylo.API.Tools
-
Gargantext.Core.Viz.Phylo.PhyloExport
-
Gargantext.Core.Viz.Phylo.PhyloMaker
-
Gargantext.Core.Viz.Phylo.PhyloMaker
-
Gargantext.Core.Viz.Phylo.PhyloTools
-
Gargantext.Core.Viz.Phylo.PhyloTools
-
Gargantext.Core.Viz.Phylo.PhyloExport
-
Gargantext.Core.Viz.Phylo.SynchronicClustering
-
Gargantext.Core.Viz.Phylo.SynchronicClustering
-
Gargantext.Core.Viz.Types
-
Gargantext.Core.Viz.Types
-
Gargantext.Database.Action.Flow
-
Gargantext.Database.Action.Flow.Types
-
Gargantext.Database.Action.User.New
-
Gargantext.Database.Admin.Config
-
Gargantext.Database.Admin.Trigger.Init
-
Gargantext.Database.Admin.Types.Hyperdata
-
Gargantext.Database.Admin.Types.Node
-
Gargantext.Database.Prelude
-
Gargantext.Database.Query.Table.NgramsPostag
-
Gargantext.Database.Query.Table.Node
-
Gargantext.Database.Query.Table.Node.UpdateOpaleye
-
Gargantext.Database.Query.Table.User
-
Gargantext.Database.Schema.Ngrams
-
Gargantext.Defaults
-
Gargantext.Utils.Jobs
-
Gargantext.Utils.Jobs.API
-
Gargantext.Utils.Jobs.Map
-
Gargantext.Utils.Jobs.Monad
-
Gargantext.Utils.Jobs.Queue
-
Gargantext.Utils.Jobs.Settings
-
Gargantext.Utils.Jobs.State
-
Gargantext.Utils.SpacyNLP
-
Gargantext.Utils.Tuple
dependencies
:
dependencies
:
-
HSvm
-
HSvm
-
KMP
-
KMP
...
...
src/Gargantext/Database/Action/Flow/Pairing.hs
View file @
9156825b
...
@@ -17,7 +17,7 @@ module Gargantext.Database.Action.Flow.Pairing
...
@@ -17,7 +17,7 @@ module Gargantext.Database.Action.Flow.Pairing
where
where
import
Debug.Trace
(
trace
)
import
Debug.Trace
(
trace
)
import
Control.Lens
(
_Just
,
(
^.
))
import
Control.Lens
(
_Just
,
(
^.
)
,
view
)
import
Data.Hashable
(
Hashable
)
import
Data.Hashable
(
Hashable
)
import
Data.HashMap.Strict
(
HashMap
)
import
Data.HashMap.Strict
(
HashMap
)
import
Data.Maybe
(
fromMaybe
,
catMaybes
)
import
Data.Maybe
(
fromMaybe
,
catMaybes
)
...
@@ -35,7 +35,7 @@ import Gargantext.Database.Action.Metrics.NgramsByContext (getContextsByNgramsOn
...
@@ -35,7 +35,7 @@ import Gargantext.Database.Action.Metrics.NgramsByContext (getContextsByNgramsOn
import
Gargantext.Database.Admin.Config
import
Gargantext.Database.Admin.Config
import
Gargantext.Database.Admin.Types.Hyperdata
-- (HyperdataContact(..))
import
Gargantext.Database.Admin.Types.Hyperdata
-- (HyperdataContact(..))
import
Gargantext.Database.Admin.Types.Node
-- (AnnuaireId, CorpusId, ListId, DocId, ContactId, NodeId)
import
Gargantext.Database.Admin.Types.Node
-- (AnnuaireId, CorpusId, ListId, DocId, ContactId, NodeId)
import
Gargantext.Database.Query.Prelude
(
leftJoin2
,
returnA
,
queryNodeNodeTable
)
import
Gargantext.Database.Query.Prelude
(
returnA
,
queryNodeNodeTable
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
import
Gargantext.Database.Query.Table.Node.Children
(
getAllContacts
)
import
Gargantext.Database.Query.Table.Node.Children
(
getAllContacts
)
import
Gargantext.Database.Query.Table.Node.Select
(
selectNodesWithUsername
)
import
Gargantext.Database.Query.Table.Node.Select
(
selectNodesWithUsername
)
...
@@ -60,16 +60,13 @@ isPairedWith nId nt = runOpaQuery (selectQuery nt nId)
...
@@ -60,16 +60,13 @@ isPairedWith nId nt = runOpaQuery (selectQuery nt nId)
where
where
selectQuery
::
NodeType
->
NodeId
->
Select
(
Column
SqlInt4
)
selectQuery
::
NodeType
->
NodeId
->
Select
(
Column
SqlInt4
)
selectQuery
nt'
nId'
=
proc
()
->
do
selectQuery
nt'
nId'
=
proc
()
->
do
(
node
,
node_node
)
<-
queryJoin
-<
()
node
<-
queryNodeTable
-<
()
restrict
-<
(
node
^.
node_typename
)
.==
(
sqlInt4
$
toDBid
nt'
)
node_node
<-
optionalRestrict
queryNodeNodeTable
-<
restrict
-<
(
node_node
^.
nn_node1_id
)
.==
(
toNullable
$
pgNodeId
nId'
)
\
node_node'
->
(
node
^.
node_id
)
.==
(
node_node'
^.
nn_node2_id
)
restrict
-<
(
node
^.
node_typename
)
.==
sqlInt4
(
toDBid
nt'
)
restrict
-<
(
view
nn_node1_id
<$>
node_node
)
.===
justFields
(
pgNodeId
nId'
)
returnA
-<
node
^.
node_id
returnA
-<
node
^.
node_id
queryJoin
::
Select
(
NodeRead
,
NodeNodeReadNull
)
queryJoin
=
leftJoin2
queryNodeTable
queryNodeNodeTable
cond
where
cond
(
node
,
node_node
)
=
node
^.
node_id
.==
node_node
^.
nn_node2_id
-----------------------------------------------------------------------
-----------------------------------------------------------------------
pairing
::
AnnuaireId
->
CorpusId
->
Maybe
ListId
->
GargNoServer
[
Int
]
pairing
::
AnnuaireId
->
CorpusId
->
Maybe
ListId
->
GargNoServer
[
Int
]
pairing
a
c
l'
=
do
pairing
a
c
l'
=
do
...
@@ -85,7 +82,7 @@ dataPairing :: AnnuaireId
...
@@ -85,7 +82,7 @@ dataPairing :: AnnuaireId
->
(
CorpusId
,
ListId
,
NgramsType
)
->
(
CorpusId
,
ListId
,
NgramsType
)
->
GargNoServer
(
HashMap
ContactId
(
Set
DocId
))
->
GargNoServer
(
HashMap
ContactId
(
Set
DocId
))
dataPairing
aId
(
cId
,
lId
,
ngt
)
=
do
dataPairing
aId
(
cId
,
lId
,
ngt
)
=
do
-- mc :: HM.HashMap ContactName (Set ContactId)
-- mc :: HM.HashMap ContactName (Set ContactId)
mc
<-
getNgramsContactId
aId
mc
<-
getNgramsContactId
aId
-- md :: HM.HashMap DocAuthor (Set DocId)
-- md :: HM.HashMap DocAuthor (Set DocId)
md
<-
getNgramsDocId
cId
lId
ngt
md
<-
getNgramsDocId
cId
lId
ngt
...
...
src/Gargantext/Database/Action/Search.hs
View file @
9156825b
...
@@ -9,11 +9,12 @@ Portability : POSIX
...
@@ -9,11 +9,12 @@ Portability : POSIX
-}
-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE LambdaCase #-}
module
Gargantext.Database.Action.Search
where
module
Gargantext.Database.Action.Search
where
import
Control.Arrow
(
returnA
)
import
Control.Arrow
(
returnA
)
import
Control.Lens
((
^.
))
import
Control.Lens
((
^.
)
,
view
)
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.Map.Strict
as
Map
import
Data.Maybe
import
Data.Maybe
...
@@ -157,28 +158,26 @@ queryInCorpus :: HasDBid NodeType
...
@@ -157,28 +158,26 @@ queryInCorpus :: HasDBid NodeType
->
Text
->
Text
->
O
.
Select
FacetDocRead
->
O
.
Select
FacetDocRead
queryInCorpus
cId
t
q
=
proc
()
->
do
queryInCorpus
cId
t
q
=
proc
()
->
do
(
c
,
nc
)
<-
joinInCorpus
-<
()
c
<-
queryContextSearchTable
-<
()
restrict
-<
(
nc
^.
nc_node_id
)
.==
(
toNullable
$
pgNodeId
cId
)
nc
<-
optionalRestrict
queryNodeContextTable
-<
\
nc'
->
(
nc'
^.
nc_context_id
)
.==
_cs_id
c
restrict
-<
(
view
nc_node_id
<$>
nc
)
.===
justFields
(
pgNodeId
cId
)
restrict
-<
if
t
restrict
-<
if
t
then
(
nc
^.
nc_category
)
.==
(
toNullable
$
sqlInt4
0
)
then
(
view
nc_category
<$>
nc
)
.===
justFields
(
sqlInt4
0
)
else
(
nc
^.
nc_category
)
.>=
(
toNullable
$
sqlInt4
1
)
else
matchMaybe
(
view
nc_category
<$>
nc
)
$
\
case
restrict
-<
(
c
^.
cs_search
)
@@
(
sqlTSQuery
(
unpack
q
))
Nothing
->
toFields
False
restrict
-<
(
c
^.
cs_typename
)
.==
(
sqlInt4
$
toDBid
NodeDocument
)
Just
c'
->
c'
.>=
sqlInt4
1
restrict
-<
(
c
^.
cs_search
)
@@
sqlTSQuery
(
unpack
q
)
restrict
-<
(
c
^.
cs_typename
)
.==
sqlInt4
(
toDBid
NodeDocument
)
returnA
-<
FacetDoc
{
facetDoc_id
=
c
^.
cs_id
returnA
-<
FacetDoc
{
facetDoc_id
=
c
^.
cs_id
,
facetDoc_created
=
c
^.
cs_date
,
facetDoc_created
=
c
^.
cs_date
,
facetDoc_title
=
c
^.
cs_name
,
facetDoc_title
=
c
^.
cs_name
,
facetDoc_hyperdata
=
c
^.
cs_hyperdata
,
facetDoc_hyperdata
=
c
^.
cs_hyperdata
,
facetDoc_category
=
nc
^.
nc_category
,
facetDoc_category
=
maybeFieldsToNullable
(
view
nc_category
<$>
nc
)
,
facetDoc_ngramCount
=
nc
^.
nc_score
,
facetDoc_ngramCount
=
maybeFieldsToNullable
(
view
nc_score
<$>
nc
)
,
facetDoc_score
=
nc
^.
nc_score
,
facetDoc_score
=
maybeFieldsToNullable
(
view
nc_score
<$>
nc
)
}
}
joinInCorpus
::
O
.
Select
(
ContextSearchRead
,
NodeContextReadNull
)
joinInCorpus
=
leftJoin
queryContextSearchTable
queryNodeContextTable
cond
where
cond
::
(
ContextSearchRead
,
NodeContextRead
)
->
Column
SqlBool
cond
(
c
,
nc
)
=
nc
^.
nc_context_id
.==
_cs_id
c
------------------------------------------------------------------------
------------------------------------------------------------------------
searchInCorpusWithContacts
searchInCorpusWithContacts
::
HasDBid
NodeType
::
HasDBid
NodeType
...
@@ -201,7 +200,7 @@ selectGroup :: HasDBid NodeType
...
@@ -201,7 +200,7 @@ selectGroup :: HasDBid NodeType
=>
CorpusId
=>
CorpusId
->
AnnuaireId
->
AnnuaireId
->
Text
->
Text
->
Select
FacetPairedRead
Null
->
Select
FacetPairedRead
selectGroup
cId
aId
q
=
proc
()
->
do
selectGroup
cId
aId
q
=
proc
()
->
do
(
a
,
b
,
c
,
d
)
<-
aggregate
(
p4
(
groupBy
,
groupBy
,
groupBy
,
O
.
sum
))
(
a
,
b
,
c
,
d
)
<-
aggregate
(
p4
(
groupBy
,
groupBy
,
groupBy
,
O
.
sum
))
(
selectContactViaDoc
cId
aId
q
)
-<
()
(
selectContactViaDoc
cId
aId
q
)
-<
()
...
@@ -214,25 +213,46 @@ selectContactViaDoc
...
@@ -214,25 +213,46 @@ selectContactViaDoc
->
AnnuaireId
->
AnnuaireId
->
Text
->
Text
->
SelectArr
()
->
SelectArr
()
(
Column
(
Nullable
SqlInt4
)
(
Field
SqlInt4
,
Column
(
Nullable
SqlTimestamptz
)
,
Field
SqlTimestamptz
,
Column
(
Nullable
SqlJsonb
)
,
Field
SqlJsonb
,
Column
(
Nullable
SqlInt4
)
,
Field
SqlInt4
)
)
selectContactViaDoc
cId
aId
query
=
proc
()
->
do
selectContactViaDoc
cId
aId
query
=
proc
()
->
do
(
doc
,
(
corpus
,
(
_nodeContext_nodeContext
,
(
annuaire
,
contact
))))
<-
queryContactViaDoc
-<
()
--(doc, (corpus, (_nodeContext_nodeContext, (annuaire, contact)))) <- queryContactViaDoc -< ()
restrict
-<
(
doc
^.
cs_search
)
@@
(
sqlTSQuery
$
unpack
query
)
(
contact
,
annuaire
,
_
,
corpus
,
doc
)
<-
queryContactViaDoc
-<
()
restrict
-<
(
doc
^.
cs_typename
)
.==
(
sqlInt4
$
toDBid
NodeDocument
)
restrict
-<
matchMaybe
(
view
cs_search
<$>
doc
)
$
\
case
restrict
-<
(
corpus
^.
nc_node_id
)
.==
(
toNullable
$
pgNodeId
cId
)
Nothing
->
toFields
False
restrict
-<
(
annuaire
^.
nc_node_id
)
.==
(
toNullable
$
pgNodeId
aId
)
Just
s
->
s
@@
sqlTSQuery
(
unpack
query
)
restrict
-<
(
contact
^.
context_typename
)
.==
(
toNullable
$
sqlInt4
$
toDBid
NodeContact
)
restrict
-<
(
view
cs_typename
<$>
doc
)
.===
justFields
(
sqlInt4
(
toDBid
NodeDocument
))
returnA
-<
(
contact
^.
context_id
restrict
-<
(
view
nc_node_id
<$>
corpus
)
.===
justFields
(
pgNodeId
cId
)
,
contact
^.
context_date
restrict
-<
(
view
nc_node_id
<$>
annuaire
)
.===
justFields
(
pgNodeId
aId
)
,
contact
^.
context_hyperdata
restrict
-<
(
contact
^.
context_typename
)
.==
sqlInt4
(
toDBid
NodeContact
)
,
toNullable
$
sqlInt4
1
returnA
-<
(
contact
^.
context_id
,
contact
^.
context_date
,
contact
^.
context_hyperdata
,
sqlInt4
1
)
)
queryContactViaDoc
::
O
.
Select
(
ContextSearchRead
queryContactViaDoc
::
O
.
Select
(
ContextRead
,
MaybeFields
NodeContextRead
,
MaybeFields
NodeContext_NodeContextRead
,
MaybeFields
NodeContextRead
,
MaybeFields
ContextSearchRead
)
queryContactViaDoc
=
proc
()
->
do
contact
<-
queryContextTable
-<
()
annuaire
<-
optionalRestrict
queryNodeContextTable
-<
\
annuaire'
->
(
annuaire'
^.
nc_context_id
)
.==
(
contact
^.
context_id
)
nodeContext_nodeContext
<-
optionalRestrict
queryNodeContext_NodeContextTable
-<
\
ncnc'
->
justFields
(
ncnc'
^.
ncnc_nodecontext2
)
.===
(
view
nc_id
<$>
annuaire
)
corpus
<-
optionalRestrict
queryNodeContextTable
-<
\
corpus'
->
justFields
(
corpus'
^.
nc_id
)
.===
(
view
ncnc_nodecontext1
<$>
nodeContext_nodeContext
)
doc
<-
optionalRestrict
queryContextSearchTable
-<
\
doc'
->
justFields
(
doc'
^.
cs_id
)
.===
(
view
nc_context_id
<$>
corpus
)
returnA
-<
(
contact
,
annuaire
,
nodeContext_nodeContext
,
corpus
,
doc
)
queryContactViaDoc'
::
O
.
Select
(
ContextSearchRead
,
(
NodeContextReadNull
,
(
NodeContextReadNull
,
(
NodeContext_NodeContextReadNull
,
(
NodeContext_NodeContextReadNull
,
(
NodeContextReadNull
,
(
NodeContextReadNull
...
@@ -241,7 +261,7 @@ queryContactViaDoc :: O.Select ( ContextSearchRead
...
@@ -241,7 +261,7 @@ queryContactViaDoc :: O.Select ( ContextSearchRead
)
)
)
)
)
)
queryContactViaDoc
=
queryContactViaDoc
'
=
leftJoin5
leftJoin5
queryContextTable
queryContextTable
queryNodeContextTable
queryNodeContextTable
...
...
src/Gargantext/Database/Action/Share.hs
View file @
9156825b
{-|
{-|
Module : Gargantext.Database.Action.Share
Module : Gargantext.Database.Action.Share
Description :
Description :
Copyright : (c) CNRS, 2017-Present
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Maintainer : team@gargantext.org
...
@@ -17,6 +17,7 @@ module Gargantext.Database.Action.Share
...
@@ -17,6 +17,7 @@ module Gargantext.Database.Action.Share
import
Control.Arrow
(
returnA
)
import
Control.Arrow
(
returnA
)
import
Control.Lens
(
view
,
(
^.
))
import
Control.Lens
(
view
,
(
^.
))
import
Data.Maybe
(
catMaybes
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database
import
Gargantext.Database
...
@@ -24,7 +25,7 @@ import Gargantext.Database.Action.User (getUserId)
...
@@ -24,7 +25,7 @@ import Gargantext.Database.Action.User (getUserId)
import
Gargantext.Database.Admin.Config
(
hasNodeType
,
isInNodeTypes
)
import
Gargantext.Database.Admin.Config
(
hasNodeType
,
isInNodeTypes
)
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataAny
(
..
))
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataAny
(
..
))
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Join
(
leftJoin3'
)
--
import Gargantext.Database.Query.Join (leftJoin3')
import
Gargantext.Database.Query.Table.Node
(
getNode
,
getNodesWith
)
import
Gargantext.Database.Query.Table.Node
(
getNode
,
getNodesWith
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
,
errorWith
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
,
errorWith
)
import
Gargantext.Database.Query.Table.NodeNode
(
deleteNodeNode
,
queryNodeNodeTable
)
import
Gargantext.Database.Query.Table.NodeNode
(
deleteNodeNode
,
queryNodeNodeTable
)
...
@@ -32,6 +33,7 @@ import Gargantext.Database.Query.Table.User
...
@@ -32,6 +33,7 @@ import Gargantext.Database.Query.Table.User
import
Gargantext.Database.Query.Tree.Root
(
getRootId
)
import
Gargantext.Database.Query.Tree.Root
(
getRootId
)
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Node
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Utils.Tuple
(
uncurryMaybe
)
import
Opaleye
hiding
(
not
)
import
Opaleye
hiding
(
not
)
import
qualified
Opaleye
as
O
import
qualified
Opaleye
as
O
...
@@ -60,28 +62,43 @@ type TeamNodeId = NodeId
...
@@ -60,28 +62,43 @@ type TeamNodeId = NodeId
-- used for the membership
-- used for the membership
membersOf
::
HasNodeError
err
membersOf
::
HasNodeError
err
=>
TeamNodeId
->
Cmd
err
[(
Text
,
SharedFolderId
)]
=>
TeamNodeId
->
Cmd
err
[(
Text
,
SharedFolderId
)]
membersOf
nId
=
runOpaQuery
(
membersOfQuery
nId
)
membersOf
nId
=
do
res
<-
runOpaQuery
$
membersOfQuery
nId
pure
$
catMaybes
(
uncurryMaybe
<$>
res
)
membersOfQuery
::
TeamNodeId
membersOfQuery
::
TeamNodeId
->
SelectArr
()
(
Column
(
Nullable
SqlText
),
Column
(
Nullable
SqlInt4
))
->
SelectArr
()
(
MaybeFields
(
Field
SqlText
),
MaybeFields
(
Field
SqlInt4
))
membersOfQuery
(
NodeId
teamId
)
=
proc
()
->
do
membersOfQuery
(
NodeId
teamId
)
=
proc
()
->
do
(
nn
,
(
n
,
u
))
<-
nodeNode_node_User
-<
()
(
nn
,
n
,
u
)
<-
nodeNode_node_User
-<
()
restrict
-<
nn
^.
nn_node2_id
.==
sqlInt4
teamId
restrict
-<
(
nn
^.
nn_node2_id
)
.==
sqlInt4
teamId
returnA
-<
(
user_username
u
,
n
^.
node_id
)
returnA
-<
(
user_username
<$>
u
,
view
node_id
<$>
n
)
nodeNode_node_User
::
O
.
Select
(
NodeNodeRead
,
(
NodeReadNull
,
UserReadNull
))
nodeNode_node_User
=
leftJoin3'
queryNodeNodeTable
nodeNode_node_User
::
O
.
Select
(
NodeNodeRead
queryNodeTable
,
MaybeFields
NodeRead
queryUserTable
,
MaybeFields
UserRead
)
cond12
nodeNode_node_User
=
proc
()
->
do
cond23
nn
<-
queryNodeNodeTable
-<
()
where
n
<-
optionalRestrict
queryNodeTable
-<
cond12
::
(
NodeNodeRead
,
(
NodeRead
,
UserReadNull
))
->
Column
SqlBool
\
n'
->
(
n'
^.
node_id
)
.==
(
nn
^.
nn_node1_id
)
cond12
(
nn
,
(
n
,
_u
))
=
(
nn
^.
nn_node1_id
.==
n
^.
node_id
)
u
<-
optionalRestrict
queryUserTable
-<
cond23
::
(
NodeRead
,
UserRead
)
->
Column
SqlBool
\
u'
->
(
view
node_user_id
<$>
n
)
.===
justFields
(
user_id
u'
)
cond23
(
n
,
u
)
=
(
n
^.
node_user_id
.==
user_id
u
)
returnA
-<
(
nn
,
n
,
u
)
-- nodeNode_node_User' :: O.Select (NodeNodeRead, (NodeReadNull, UserReadNull))
-- nodeNode_node_User' = leftJoin3' queryNodeNodeTable
-- queryNodeTable
-- queryUserTable
-- cond12
-- cond23
-- where
-- cond12 :: (NodeNodeRead, (NodeRead, UserReadNull)) -> Column SqlBool
-- cond12 (nn, (n, _u)) = (nn^.nn_node1_id .== n^.node_id)
-- cond23 :: (NodeRead, UserRead) -> Column SqlBool
-- cond23 (n, u) = (n^.node_user_id .== user_id u)
...
@@ -144,4 +161,3 @@ unPublish :: HasNodeError err
...
@@ -144,4 +161,3 @@ unPublish :: HasNodeError err
=>
ParentId
->
NodeId
=>
ParentId
->
NodeId
->
Cmd
err
Int
->
Cmd
err
Int
unPublish
p
n
=
deleteNodeNode
p
n
unPublish
p
n
=
deleteNodeNode
p
n
src/Gargantext/Database/Prelude.hs
View file @
9156825b
...
@@ -9,7 +9,9 @@ Portability : POSIX
...
@@ -9,7 +9,9 @@ Portability : POSIX
-}
-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE ConstraintKinds, ScopedTypeVariables #-}
{-# LANGUAGE ConstraintKinds, ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
module
Gargantext.Database.Prelude
where
module
Gargantext.Database.Prelude
where
...
@@ -33,18 +35,17 @@ import Database.PostgreSQL.Simple.Internal (Field)
...
@@ -33,18 +35,17 @@ import Database.PostgreSQL.Simple.Internal (Field)
import
Database.PostgreSQL.Simple.Types
(
Query
(
..
))
import
Database.PostgreSQL.Simple.Types
(
Query
(
..
))
import
Gargantext.Core.Mail.Types
(
HasMail
)
import
Gargantext.Core.Mail.Types
(
HasMail
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Prelude.Config
(
readIniFile'
,
val
)
import
Gargantext.Prelude.Config
(
GargConfig
(),
readIniFile'
,
val
)
import
Opaleye
(
Unpackspec
,
showSql
,
FromFields
,
Select
,
runSelect
,
SqlJsonb
,
DefaultFromField
)
import
Opaleye
(
Unpackspec
,
showSql
,
FromFields
,
Select
,
runSelect
,
SqlJsonb
,
DefaultFromField
,
toFields
,
matchMaybe
,
MaybeFields
)
import
Opaleye.Aggregate
(
countRows
)
import
Opaleye.Aggregate
(
countRows
)
import
System.IO
(
FilePath
)
import
qualified
Opaleye.Internal.Constant
import
System.IO
(
stderr
)
import
qualified
Opaleye.Internal.Operators
import
System.IO
(
FilePath
,
stderr
)
import
Text.Read
(
readMaybe
)
import
Text.Read
(
readMaybe
)
import
qualified
Data.ByteString
as
DB
import
qualified
Data.ByteString
as
DB
import
qualified
Data.List
as
DL
import
qualified
Data.List
as
DL
import
qualified
Database.PostgreSQL.Simple
as
PGS
import
qualified
Database.PostgreSQL.Simple
as
PGS
import
Gargantext.Prelude.Config
(
GargConfig
())
-------------------------------------------------------
-------------------------------------------------------
class
HasConnectionPool
env
where
class
HasConnectionPool
env
where
connPool
::
Getter
env
(
Pool
Connection
)
connPool
::
Getter
env
(
Pool
Connection
)
...
@@ -215,3 +216,10 @@ dbCheck = do
...
@@ -215,3 +216,10 @@ dbCheck = do
case
r
of
case
r
of
[]
->
return
False
[]
->
return
False
_
->
return
True
_
->
return
True
restrictMaybe
::
(
Default
Opaleye
.
Internal
.
Operators
.
IfPP
b
b
,
(
Default
Opaleye
.
Internal
.
Constant
.
ToFields
Bool
b
))
=>
MaybeFields
a
->
(
a
->
b
)
->
b
restrictMaybe
v
cond
=
matchMaybe
v
$
\
case
Nothing
->
toFields
True
Just
v'
->
cond
v'
src/Gargantext/Database/Query/Facet.hs
View file @
9156825b
This diff is collapsed.
Click to expand it.
src/Gargantext/Database/Query/Facet/Types.hs
View file @
9156825b
...
@@ -97,28 +97,28 @@ instance ( Arbitrary id
...
@@ -97,28 +97,28 @@ instance ( Arbitrary id
)
=>
Arbitrary
(
FacetPaired
id
date
hyperdata
score
)
where
)
=>
Arbitrary
(
FacetPaired
id
date
hyperdata
score
)
where
arbitrary
=
FacetPaired
<$>
arbitrary
<*>
arbitrary
<*>
arbitrary
<*>
arbitrary
arbitrary
=
FacetPaired
<$>
arbitrary
<*>
arbitrary
<*>
arbitrary
<*>
arbitrary
type
FacetPairedRead
=
FacetPaired
(
Column
SqlInt4
)
type
FacetPairedRead
=
FacetPaired
(
Field
SqlInt4
)
(
Column
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
type
FacetPairedReadNull
=
FacetPaired
(
Column
(
Nullable
SqlInt4
)
)
type
FacetPairedReadNull
=
FacetPaired
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlTimestamptz
)
)
(
FieldNullable
SqlTimestamptz
)
(
Column
(
Nullable
SqlJsonb
)
)
(
FieldNullable
SqlJsonb
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
type
FacetPairedReadNullAgg
=
FacetPaired
(
Aggregator
(
Column
(
Nullable
SqlInt4
)
)
type
FacetPairedReadNullAgg
=
FacetPaired
(
Aggregator
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
)
)
(
Aggregator
(
Column
(
Nullable
SqlTimestamptz
)
)
(
Aggregator
(
FieldNullable
SqlTimestamptz
)
(
Column
(
Nullable
SqlTimestamptz
)
)
(
FieldNullable
SqlTimestamptz
)
)
)
(
Aggregator
(
Column
(
Nullable
SqlJsonb
)
)
(
Aggregator
(
FieldNullable
SqlJsonb
)
(
Column
(
Nullable
SqlJsonb
)
)
(
FieldNullable
SqlJsonb
)
)
)
(
Aggregator
(
Column
(
Nullable
SqlInt4
)
)
(
Aggregator
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
)
)
...
@@ -148,13 +148,13 @@ instance Arbitrary FacetDoc where
...
@@ -148,13 +148,13 @@ instance Arbitrary FacetDoc where
$
(
makeAdaptorAndInstance
"pFacetDoc"
''
F
acet
)
$
(
makeAdaptorAndInstance
"pFacetDoc"
''
F
acet
)
-- $(makeLensesWith abbreviatedFields ''Facet)
-- $(makeLensesWith abbreviatedFields ''Facet)
type
FacetDocRead
=
Facet
(
Column
SqlInt4
)
type
FacetDocRead
=
Facet
(
Field
SqlInt4
)
(
Column
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
(
Column
(
Nullable
SqlInt4
)
)
-- Category
(
FieldNullable
SqlInt4
)
-- Category
(
Column
(
Nullable
SqlFloat8
)
)
-- Ngrams Count
(
FieldNullable
SqlFloat8
)
-- Ngrams Count
(
Column
(
Nullable
SqlFloat8
)
)
-- Score
(
FieldNullable
SqlFloat8
)
-- Score
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
...
...
src/Gargantext/Database/Query/Join.hs
View file @
9156825b
...
@@ -111,17 +111,17 @@ leftJoin4 q1 q2 q3 q4
...
@@ -111,17 +111,17 @@ leftJoin4 q1 q2 q3 q4
)
cond34
)
cond34
leftJoin5
::
(
Default
Unpackspec
b2
b2
,
Default
Unpackspec
b3
b3
,
leftJoin5
::
(
Default
Unpackspec
b2
b2
,
Default
Unpackspec
b3
b3
Default
Unpackspec
b4
b4
,
Default
Unpackspec
b5
b5
,
,
Default
Unpackspec
b4
b4
,
Default
Unpackspec
b5
b5
Default
Unpackspec
b6
b6
,
Default
Unpackspec
b7
b7
,
,
Default
Unpackspec
b6
b6
,
Default
Unpackspec
b7
b7
Default
Unpackspec
fieldsL
fieldsL
,
Default
Unpackspec
b8
b8
,
,
Default
Unpackspec
fieldsL
fieldsL
,
Default
Unpackspec
b8
b8
Default
Unpackspec
b9
b9
,
Default
Unpackspec
b10
b10
,
,
Default
Unpackspec
b9
b9
,
Default
Unpackspec
b10
b10
Default
Unpackspec
fieldsR
fieldsR
,
Default
NullMaker
b7
b6
,
,
Default
Unpackspec
fieldsR
fieldsR
,
Default
NullMaker
b7
b6
Default
NullMaker
b6
b11
,
Default
NullMaker
b8
b12
,
,
Default
NullMaker
b6
b11
,
Default
NullMaker
b8
b12
Default
NullMaker
b3
b13
,
Default
NullMaker
b2
b14
,
,
Default
NullMaker
b3
b13
,
Default
NullMaker
b2
b14
Default
NullMaker
b9
b3
,
Default
NullMaker
b10
b2
,
,
Default
NullMaker
b9
b3
,
Default
NullMaker
b10
b2
Default
NullMaker
b5
b9
,
Default
NullMaker
b4
b10
,
,
Default
NullMaker
b5
b9
,
Default
NullMaker
b4
b10
Default
NullMaker
fieldsR
b4
)
=>
,
Default
NullMaker
fieldsR
b4
)
=>
Select
fieldsR
Select
fieldsR
->
Select
b5
->
Select
b5
->
Select
b7
->
Select
b7
...
...
src/Gargantext/Database/Query/Table/Node/Select.hs
View file @
9156825b
...
@@ -10,6 +10,7 @@ Portability : POSIX
...
@@ -10,6 +10,7 @@ Portability : POSIX
{-# LANGUAGE Arrows #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE LambdaCase #-}
module
Gargantext.Database.Query.Table.Node.Select
module
Gargantext.Database.Query.Table.Node.Select
where
where
...
@@ -27,16 +28,19 @@ import Gargantext.Database.Schema.User
...
@@ -27,16 +28,19 @@ import Gargantext.Database.Schema.User
import
Gargantext.Database.Query.Table.User
import
Gargantext.Database.Query.Table.User
selectNodesWithUsername
::
NodeType
->
Username
->
Cmd
err
[
NodeId
]
selectNodesWithUsername
::
NodeType
->
Username
->
Cmd
err
[
NodeId
]
selectNodesWithUsername
nt
u
=
runOpaQuery
(
q
u
)
selectNodesWithUsername
nt
u
=
runOpaQuery
$
proc
()
->
do
where
n
<-
queryNodeTable
-<
()
q
u'
=
proc
()
->
do
usrs
<-
optionalRestrict
queryUserTable
-<
(
n
,
usrs
)
<-
join'
-<
()
(
\
us'
->
_node_user_id
n
.==
user_id
us'
)
restrict
-<
user_username
usrs
.==
(
toNullable
$
sqlStrictText
u'
)
restrict
-<
matchMaybe
usrs
$
\
case
restrict
-<
_node_typename
n
.==
(
sqlInt4
$
toDBid
nt
)
Nothing
->
toFields
True
returnA
-<
_node_id
n
Just
us
->
user_username
us
.==
sqlStrictText
u
restrict
-<
_node_typename
n
.==
sqlInt4
(
toDBid
nt
)
join'
::
Select
(
NodeRead
,
UserReadNull
)
returnA
-<
_node_id
n
join'
=
leftJoin
queryNodeTable
queryUserTable
on1
where
-- join' :: Select (NodeRead, UserReadNull)
on1
(
n
,
us
)
=
_node_user_id
n
.==
user_id
us
-- --join' = leftJoin queryNodeTable queryUserTable on1
-- join' = optionalRestrict queryUserTable -<
-- (\(n, us) -> _node_user_id n .== user_id ud)
-- -- where
-- -- on1 (n,us) = _node_user_id n .== user_id us
src/Gargantext/Database/Query/Table/NodeContext.hs
View file @
9156825b
...
@@ -15,6 +15,7 @@ commentary with @some markup@.
...
@@ -15,6 +15,7 @@ commentary with @some markup@.
{-# LANGUAGE Arrows #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TemplateHaskell #-}
...
@@ -75,7 +76,7 @@ _nodesContexts = runOpaQuery queryNodeContextTable
...
@@ -75,7 +76,7 @@ _nodesContexts = runOpaQuery queryNodeContextTable
getNodeContexts
::
NodeId
->
Cmd
err
[
NodeContext
]
getNodeContexts
::
NodeId
->
Cmd
err
[
NodeContext
]
getNodeContexts
n
=
runOpaQuery
(
selectNodeContexts
$
pgNodeId
n
)
getNodeContexts
n
=
runOpaQuery
(
selectNodeContexts
$
pgNodeId
n
)
where
where
selectNodeContexts
::
Column
SqlInt4
->
Select
NodeContextRead
selectNodeContexts
::
Field
SqlInt4
->
Select
NodeContextRead
selectNodeContexts
n'
=
proc
()
->
do
selectNodeContexts
n'
=
proc
()
->
do
ns
<-
queryNodeContextTable
-<
()
ns
<-
queryNodeContextTable
-<
()
restrict
-<
_nc_node_id
ns
.==
n'
restrict
-<
_nc_node_id
ns
.==
n'
...
@@ -89,7 +90,7 @@ getNodeContext c n = do
...
@@ -89,7 +90,7 @@ getNodeContext c n = do
Nothing
->
nodeError
(
DoesNotExist
c
)
Nothing
->
nodeError
(
DoesNotExist
c
)
Just
r
->
pure
r
Just
r
->
pure
r
where
where
selectNodeContext
::
Column
SqlInt4
->
Column
SqlInt4
->
Select
NodeContextRead
selectNodeContext
::
Field
SqlInt4
->
Field
SqlInt4
->
Select
NodeContextRead
selectNodeContext
c'
n'
=
proc
()
->
do
selectNodeContext
c'
n'
=
proc
()
->
do
ns
<-
queryNodeContextTable
-<
()
ns
<-
queryNodeContextTable
-<
()
restrict
-<
_nc_context_id
ns
.==
c'
restrict
-<
_nc_context_id
ns
.==
c'
...
@@ -211,7 +212,7 @@ nodeContextsCategory :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
...
@@ -211,7 +212,7 @@ nodeContextsCategory :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
nodeContextsCategory
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
nodeContextsCategory
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
<$>
runPGSQuery
catSelect
(
PGS
.
Only
$
Values
fields
inputData
)
<$>
runPGSQuery
catSelect
(
PGS
.
Only
$
Values
fields
inputData
)
where
where
fields
=
map
(
\
t
->
QualifiedIdentifier
Nothing
t
)
[
"int4"
,
"int4"
,
"int4"
]
fields
=
map
(
QualifiedIdentifier
Nothing
)
[
"int4"
,
"int4"
,
"int4"
]
catSelect
::
PGS
.
Query
catSelect
::
PGS
.
Query
catSelect
=
[
sql
|
UPDATE nodes_contexts as nn0
catSelect
=
[
sql
|
UPDATE nodes_contexts as nn0
SET category = nn1.category
SET category = nn1.category
...
@@ -227,7 +228,7 @@ nodeContextsScore :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
...
@@ -227,7 +228,7 @@ nodeContextsScore :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
nodeContextsScore
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
nodeContextsScore
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
<$>
runPGSQuery
catScore
(
PGS
.
Only
$
Values
fields
inputData
)
<$>
runPGSQuery
catScore
(
PGS
.
Only
$
Values
fields
inputData
)
where
where
fields
=
map
(
\
t
->
QualifiedIdentifier
Nothing
t
)
[
"int4"
,
"int4"
,
"int4"
]
fields
=
map
(
QualifiedIdentifier
Nothing
)
[
"int4"
,
"int4"
,
"int4"
]
catScore
::
PGS
.
Query
catScore
::
PGS
.
Query
catScore
=
[
sql
|
UPDATE nodes_contexts as nn0
catScore
=
[
sql
|
UPDATE nodes_contexts as nn0
SET score = nn1.score
SET score = nn1.score
...
@@ -244,9 +245,9 @@ selectCountDocs cId = runCountOpaQuery (queryCountDocs cId)
...
@@ -244,9 +245,9 @@ selectCountDocs cId = runCountOpaQuery (queryCountDocs cId)
where
where
queryCountDocs
cId'
=
proc
()
->
do
queryCountDocs
cId'
=
proc
()
->
do
(
c
,
nc
)
<-
joinInCorpus
-<
()
(
c
,
nc
)
<-
joinInCorpus
-<
()
restrict
-<
nc
^.
nc_node_id
.==
(
toNullable
$
pgNodeId
cId'
)
restrict
-<
restrictMaybe
nc
$
\
nc'
->
(
nc'
^.
nc_node_id
)
.==
pgNodeId
cId'
.&&
restrict
-<
nc
^.
nc_category
.>=
(
toNullable
$
sqlInt4
1
)
(
nc'
^.
nc_category
)
.>=
sqlInt4
1
restrict
-<
c
^.
context_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
restrict
-<
(
c
^.
context_typename
)
.==
sqlInt4
(
toDBid
NodeDocument
)
returnA
-<
c
returnA
-<
c
...
@@ -260,12 +261,12 @@ selectDocsDates cId = map (head' "selectDocsDates" . splitOn "-")
...
@@ -260,12 +261,12 @@ selectDocsDates cId = map (head' "selectDocsDates" . splitOn "-")
selectDocs
::
HasDBid
NodeType
=>
CorpusId
->
Cmd
err
[
HyperdataDocument
]
selectDocs
::
HasDBid
NodeType
=>
CorpusId
->
Cmd
err
[
HyperdataDocument
]
selectDocs
cId
=
runOpaQuery
(
queryDocs
cId
)
selectDocs
cId
=
runOpaQuery
(
queryDocs
cId
)
queryDocs
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
(
Column
SqlJsonb
)
queryDocs
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
(
Field
SqlJsonb
)
queryDocs
cId
=
proc
()
->
do
queryDocs
cId
=
proc
()
->
do
(
c
,
nn
)
<-
joinInCorpus
-<
()
(
c
,
nn
)
<-
joinInCorpus
-<
()
restrict
-<
nn
^.
nc_node_id
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
restrictMaybe
nn
$
\
nn'
->
(
nn'
^.
nc_node_id
)
.==
pgNodeId
cId
.&&
restrict
-<
nn
^.
nc_category
.>=
(
toNullable
$
sqlInt4
1
)
(
nn'
^.
nc_category
)
.>=
sqlInt4
1
restrict
-<
c
^.
context_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
restrict
-<
(
c
^.
context_typename
)
.==
sqlInt4
(
toDBid
NodeDocument
)
returnA
-<
view
(
context_hyperdata
)
c
returnA
-<
view
(
context_hyperdata
)
c
selectDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
Cmd
err
[
Context
HyperdataDocument
]
selectDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
Cmd
err
[
Context
HyperdataDocument
]
...
@@ -274,23 +275,29 @@ selectDocNodes cId = runOpaQuery (queryDocNodes cId)
...
@@ -274,23 +275,29 @@ selectDocNodes cId = runOpaQuery (queryDocNodes cId)
queryDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
ContextRead
queryDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
ContextRead
queryDocNodes
cId
=
proc
()
->
do
queryDocNodes
cId
=
proc
()
->
do
(
c
,
nc
)
<-
joinInCorpus
-<
()
(
c
,
nc
)
<-
joinInCorpus
-<
()
restrict
-<
nc
^.
nc_node_id
.==
(
toNullable
$
pgNodeId
cId
)
-- restrict -< restrictMaybe nc $ \nc' -> (nc' ^. nc_node_id) .== pgNodeId cId .&&
restrict
-<
nc
^.
nc_category
.>=
(
toNullable
$
sqlInt4
1
)
-- (nc' ^. nc_category) .>= sqlInt4 1
restrict
-<
c
^.
context_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
restrict
-<
matchMaybe
nc
$
\
case
Nothing
->
toFields
True
Just
nc'
->
(
nc'
^.
nc_node_id
)
.==
pgNodeId
cId
.&&
(
nc'
^.
nc_category
)
.>=
sqlInt4
1
restrict
-<
(
c
^.
context_typename
)
.==
sqlInt4
(
toDBid
NodeDocument
)
returnA
-<
c
returnA
-<
c
joinInCorpus
::
O
.
Select
(
ContextRead
,
NodeContextReadNull
)
joinInCorpus
::
O
.
Select
(
ContextRead
,
MaybeFields
NodeContextRead
)
joinInCorpus
=
leftJoin
queryContextTable
queryNodeContextTable
cond
joinInCorpus
=
proc
()
->
do
where
c
<-
queryContextTable
-<
()
cond
::
(
ContextRead
,
NodeContextRead
)
->
Column
SqlBool
nc
<-
optionalRestrict
queryNodeContextTable
-<
cond
(
c
,
nc
)
=
c
^.
context_id
.==
nc
^.
nc_context_id
(
\
nc'
->
(
c
^.
context_id
)
.==
(
nc'
^.
nc_context_id
))
returnA
-<
(
c
,
nc
)
joinOn1
::
O
.
Select
(
NodeRead
,
NodeContextReadNull
)
joinOn1
::
O
.
Select
(
NodeRead
,
MaybeFields
NodeContextRead
)
joinOn1
=
leftJoin
queryNodeTable
queryNodeContextTable
cond
joinOn1
=
proc
()
->
do
where
n
<-
queryNodeTable
-<
()
cond
::
(
NodeRead
,
NodeContextRead
)
->
Column
SqlBool
nc
<-
optionalRestrict
queryNodeContextTable
-<
cond
(
n
,
nc
)
=
nc
^.
nc_node_id
.==
n
^.
node_id
(
\
nc'
->
(
nc'
^.
nc_node_id
)
.==
(
n
^.
node_id
))
returnA
-<
(
n
,
nc
)
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -298,8 +305,8 @@ selectPublicContexts :: HasDBid NodeType => (Hyperdata a, DefaultFromField SqlJs
...
@@ -298,8 +305,8 @@ selectPublicContexts :: HasDBid NodeType => (Hyperdata a, DefaultFromField SqlJs
=>
Cmd
err
[(
Node
a
,
Maybe
Int
)]
=>
Cmd
err
[(
Node
a
,
Maybe
Int
)]
selectPublicContexts
=
runOpaQuery
(
queryWithType
NodeFolderPublic
)
selectPublicContexts
=
runOpaQuery
(
queryWithType
NodeFolderPublic
)
queryWithType
::
HasDBid
NodeType
=>
NodeType
->
O
.
Select
(
NodeRead
,
Column
(
Nullable
SqlInt4
))
queryWithType
::
HasDBid
NodeType
=>
NodeType
->
O
.
Select
(
NodeRead
,
MaybeFields
(
Field
SqlInt4
))
queryWithType
nt
=
proc
()
->
do
queryWithType
nt
=
proc
()
->
do
(
n
,
nc
)
<-
joinOn1
-<
()
(
n
,
nc
)
<-
joinOn1
-<
()
restrict
-<
n
^.
node_typename
.==
(
sqlInt4
$
toDBid
nt
)
restrict
-<
(
n
^.
node_typename
)
.==
sqlInt4
(
toDBid
nt
)
returnA
-<
(
n
,
nc
^.
nc_context_id
)
returnA
-<
(
n
,
view
nc_context_id
<$>
nc
)
src/Gargantext/Database/Query/Table/NodeNode.hs
View file @
9156825b
{-| Module : Gargantext.Database.Select.Table.NodeNode
{-| Module : Gargantext.Database.Select.Table.NodeNode
Description :
Description :
Copyright : (c) CNRS, 2017-Present
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Maintainer : team@gargantext.org
...
@@ -14,6 +14,7 @@ commentary with @some markup@.
...
@@ -14,6 +14,7 @@ commentary with @some markup@.
{-# LANGUAGE Arrows #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TemplateHaskell #-}
...
@@ -135,7 +136,7 @@ nodeNodesCategory :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
...
@@ -135,7 +136,7 @@ nodeNodesCategory :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
nodeNodesCategory
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
nodeNodesCategory
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
<$>
runPGSQuery
catQuery
(
PGS
.
Only
$
Values
fields
inputData
)
<$>
runPGSQuery
catQuery
(
PGS
.
Only
$
Values
fields
inputData
)
where
where
fields
=
map
(
\
t
->
QualifiedIdentifier
Nothing
t
)
[
"int4"
,
"int4"
,
"int4"
]
fields
=
map
(
QualifiedIdentifier
Nothing
)
[
"int4"
,
"int4"
,
"int4"
]
catQuery
::
PGS
.
Query
catQuery
::
PGS
.
Query
catQuery
=
[
sql
|
UPDATE nodes_nodes as nn0
catQuery
=
[
sql
|
UPDATE nodes_nodes as nn0
SET category = nn1.category
SET category = nn1.category
...
@@ -160,7 +161,7 @@ nodeNodesScore :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
...
@@ -160,7 +161,7 @@ nodeNodesScore :: [(CorpusId, DocId, Int)] -> Cmd err [Int]
nodeNodesScore
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
nodeNodesScore
inputData
=
map
(
\
(
PGS
.
Only
a
)
->
a
)
<$>
runPGSQuery
catScore
(
PGS
.
Only
$
Values
fields
inputData
)
<$>
runPGSQuery
catScore
(
PGS
.
Only
$
Values
fields
inputData
)
where
where
fields
=
map
(
\
t
->
QualifiedIdentifier
Nothing
t
)
[
"int4"
,
"int4"
,
"int4"
]
fields
=
map
(
QualifiedIdentifier
Nothing
)
[
"int4"
,
"int4"
,
"int4"
]
catScore
::
PGS
.
Query
catScore
::
PGS
.
Query
catScore
=
[
sql
|
UPDATE nodes_nodes as nn0
catScore
=
[
sql
|
UPDATE nodes_nodes as nn0
SET score = nn1.score
SET score = nn1.score
...
@@ -176,9 +177,11 @@ _selectCountDocs cId = runCountOpaQuery (queryCountDocs cId)
...
@@ -176,9 +177,11 @@ _selectCountDocs cId = runCountOpaQuery (queryCountDocs cId)
where
where
queryCountDocs
cId'
=
proc
()
->
do
queryCountDocs
cId'
=
proc
()
->
do
(
n
,
nn
)
<-
joinInCorpus
-<
()
(
n
,
nn
)
<-
joinInCorpus
-<
()
restrict
-<
nn
^.
nn_node1_id
.==
(
toNullable
$
pgNodeId
cId'
)
restrict
-<
matchMaybe
nn
$
\
case
restrict
-<
nn
^.
nn_category
.>=
(
toNullable
$
sqlInt4
1
)
Nothing
->
toFields
True
restrict
-<
n
^.
node_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
Just
nn'
->
(
nn'
^.
nn_node1_id
)
.==
pgNodeId
cId'
.&&
(
nn'
^.
nn_category
)
.>=
sqlInt4
1
restrict
-<
n
^.
node_typename
.==
sqlInt4
(
toDBid
NodeDocument
)
returnA
-<
n
returnA
-<
n
...
@@ -197,10 +200,12 @@ selectDocs cId = runOpaQuery (queryDocs cId)
...
@@ -197,10 +200,12 @@ selectDocs cId = runOpaQuery (queryDocs cId)
queryDocs
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
(
Column
SqlJsonb
)
queryDocs
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
(
Column
SqlJsonb
)
queryDocs
cId
=
proc
()
->
do
queryDocs
cId
=
proc
()
->
do
(
n
,
nn
)
<-
joinInCorpus
-<
()
(
n
,
nn
)
<-
joinInCorpus
-<
()
restrict
-<
nn
^.
nn_node1_id
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
matchMaybe
nn
$
\
case
restrict
-<
nn
^.
nn_category
.>=
(
toNullable
$
sqlInt4
1
)
Nothing
->
toFields
True
restrict
-<
n
^.
node_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
Just
nn'
->
(
nn'
^.
nn_node1_id
)
.==
pgNodeId
cId
.&&
returnA
-<
view
(
node_hyperdata
)
n
(
nn'
^.
nn_category
)
.>=
sqlInt4
1
restrict
-<
n
^.
node_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
returnA
-<
view
node_hyperdata
n
selectDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
Cmd
err
[
Node
HyperdataDocument
]
selectDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
Cmd
err
[
Node
HyperdataDocument
]
selectDocNodes
cId
=
runOpaQuery
(
queryDocNodes
cId
)
selectDocNodes
cId
=
runOpaQuery
(
queryDocNodes
cId
)
...
@@ -208,22 +213,19 @@ selectDocNodes cId = runOpaQuery (queryDocNodes cId)
...
@@ -208,22 +213,19 @@ selectDocNodes cId = runOpaQuery (queryDocNodes cId)
queryDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
NodeRead
queryDocNodes
::
HasDBid
NodeType
=>
CorpusId
->
O
.
Select
NodeRead
queryDocNodes
cId
=
proc
()
->
do
queryDocNodes
cId
=
proc
()
->
do
(
n
,
nn
)
<-
joinInCorpus
-<
()
(
n
,
nn
)
<-
joinInCorpus
-<
()
restrict
-<
nn
^.
nn_node1_id
.==
(
toNullable
$
pgNodeId
cId
)
restrict
-<
matchMaybe
nn
$
\
case
restrict
-<
nn
^.
nn_category
.>=
(
toNullable
$
sqlInt4
1
)
Nothing
->
toFields
True
restrict
-<
n
^.
node_typename
.==
(
sqlInt4
$
toDBid
NodeDocument
)
Just
nn'
->
(
nn'
^.
nn_node1_id
.==
pgNodeId
cId
)
.&&
(
nn'
^.
nn_category
)
.>=
sqlInt4
1
restrict
-<
n
^.
node_typename
.==
sqlInt4
(
toDBid
NodeDocument
)
returnA
-<
n
returnA
-<
n
joinInCorpus
::
O
.
Select
(
NodeRead
,
NodeNodeReadNull
)
joinInCorpus
::
O
.
Select
(
NodeRead
,
MaybeFields
NodeNodeRead
)
joinInCorpus
=
leftJoin
queryNodeTable
queryNodeNodeTable
cond
joinInCorpus
=
proc
()
->
do
where
n
<-
queryNodeTable
-<
()
cond
::
(
NodeRead
,
NodeNodeRead
)
->
Column
SqlBool
nn
<-
optionalRestrict
queryNodeNodeTable
-<
cond
(
n
,
nn
)
=
nn
^.
nn_node2_id
.==
(
view
node_id
n
)
(
\
nn'
->
(
nn'
^.
nn_node2_id
)
.==
view
node_id
n
)
returnA
-<
(
n
,
nn
)
_joinOn1
::
O
.
Select
(
NodeRead
,
NodeNodeReadNull
)
_joinOn1
=
leftJoin
queryNodeTable
queryNodeNodeTable
cond
where
cond
::
(
NodeRead
,
NodeNodeRead
)
->
Column
SqlBool
cond
(
n
,
nn
)
=
nn
^.
nn_node1_id
.==
n
^.
node_id
------------------------------------------------------------------------
------------------------------------------------------------------------
...
@@ -233,17 +235,15 @@ selectPublicNodes = runOpaQuery (queryWithType NodeFolderPublic)
...
@@ -233,17 +235,15 @@ selectPublicNodes = runOpaQuery (queryWithType NodeFolderPublic)
queryWithType
::
HasDBid
NodeType
queryWithType
::
HasDBid
NodeType
=>
NodeType
=>
NodeType
->
O
.
Select
(
NodeRead
,
Column
(
Nullable
SqlInt4
))
->
O
.
Select
(
NodeRead
,
MaybeFields
(
Column
SqlInt4
))
queryWithType
nt
=
proc
()
->
do
queryWithType
nt
=
proc
()
->
do
(
n
,
nn
)
<-
node_NodeNode
-<
()
(
n
,
nn_node2_id'
)
<-
node_NodeNode
-<
()
restrict
-<
n
^.
node_typename
.==
(
sqlInt4
$
toDBid
nt
)
restrict
-<
n
^.
node_typename
.==
sqlInt4
(
toDBid
nt
)
returnA
-<
(
n
,
nn
^.
nn_node2_id
)
returnA
-<
(
n
,
nn_node2_id'
)
node_NodeNode
::
O
.
Select
(
NodeRead
,
NodeNodeReadNull
)
node_NodeNode
::
O
.
Select
(
NodeRead
,
MaybeFields
(
Field
SqlInt4
))
node_NodeNode
=
leftJoin
queryNodeTable
queryNodeNodeTable
cond
node_NodeNode
=
proc
()
->
do
where
n
<-
queryNodeTable
-<
()
cond
::
(
NodeRead
,
NodeNodeRead
)
->
Column
SqlBool
nn
<-
optionalRestrict
queryNodeNodeTable
-<
cond
(
n
,
nn
)
=
nn
^.
nn_node1_id
.==
n
^.
node_id
(
\
nn'
->
(
nn'
^.
nn_node1_id
)
.==
(
n
^.
node_id
))
returnA
-<
(
n
,
view
nn_node2_id
<$>
nn
)
src/Gargantext/Database/Query/Table/User.hs
View file @
9156825b
...
@@ -96,7 +96,7 @@ updateUserDB us = mkCmd $ \c -> runUpdate_ c (updateUserQuery us)
...
@@ -96,7 +96,7 @@ updateUserDB us = mkCmd $ \c -> runUpdate_ c (updateUserQuery us)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
toUserWrite
::
NewUser
HashPassword
->
UserWrite
toUserWrite
::
NewUser
HashPassword
->
UserWrite
toUserWrite
(
NewUser
u
m
(
Auth
.
PasswordHash
p
))
=
toUserWrite
(
NewUser
u
m
(
Auth
.
PasswordHash
p
))
=
UserDB
{
user_id
=
Nothing
UserDB
{
user_id
=
Nothing
,
user_password
=
sqlStrictText
p
,
user_password
=
sqlStrictText
p
,
user_lastLogin
=
Nothing
,
user_lastLogin
=
Nothing
...
...
src/Gargantext/Database/Schema/Context.hs
View file @
9156825b
...
@@ -72,68 +72,68 @@ contextTable = Table "contexts" (pContext Context { _context_id = option
...
@@ -72,68 +72,68 @@ contextTable = Table "contexts" (pContext Context { _context_id = option
queryContextTable
::
Query
ContextRead
queryContextTable
::
Query
ContextRead
queryContextTable
=
selectTable
contextTable
queryContextTable
=
selectTable
contextTable
------------------------------------------------------------------------
------------------------------------------------------------------------
type
ContextWrite
=
ContextPoly
(
Maybe
(
Column
SqlInt4
)
)
type
ContextWrite
=
ContextPoly
(
Maybe
(
Field
SqlInt4
)
)
(
Maybe
(
Column
SqlText
)
)
(
Maybe
(
Field
SqlText
)
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Maybe
(
Column
SqlInt4
)
)
(
Maybe
(
Field
SqlInt4
)
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Maybe
(
Column
SqlTimestamptz
))
(
Maybe
(
Field
SqlTimestamptz
))
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
type
ContextRead
=
ContextPoly
(
Column
SqlInt4
)
type
ContextRead
=
ContextPoly
(
Field
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
type
ContextReadNull
=
ContextPoly
(
Column
(
Nullable
SqlInt4
)
)
type
ContextReadNull
=
ContextPoly
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
FieldNullable
SqlText
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
FieldNullable
SqlText
)
(
Column
(
Nullable
SqlTimestamptz
)
)
(
FieldNullable
SqlTimestamptz
)
(
Column
(
Nullable
SqlJsonb
)
)
(
FieldNullable
SqlJsonb
)
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Context(Read|Write)Search is slower than Context(Write|Read) use it
-- | Context(Read|Write)Search is slower than Context(Write|Read) use it
-- for full text search only
-- for full text search only
type
ContextSearchWrite
=
type
ContextSearchWrite
=
ContextPolySearch
ContextPolySearch
(
Maybe
(
Column
SqlInt4
)
)
(
Maybe
(
Field
SqlInt4
)
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Maybe
(
Column
SqlTimestamptz
))
(
Maybe
(
Field
SqlTimestamptz
))
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
(
Maybe
(
Column
SqlTSVector
)
)
(
Maybe
(
Field
SqlTSVector
)
)
type
ContextSearchRead
=
type
ContextSearchRead
=
ContextPolySearch
ContextPolySearch
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
(
Column
SqlTSVector
)
(
Field
SqlTSVector
)
type
ContextSearchReadNull
=
type
ContextSearchReadNull
=
ContextPolySearch
ContextPolySearch
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
FieldNullable
SqlText
)
(
Column
(
Nullable
SqlTimestamptz
)
)
(
FieldNullable
SqlTimestamptz
)
(
Column
(
Nullable
SqlJsonb
)
)
(
FieldNullable
SqlJsonb
)
(
Column
(
Nullable
SqlTSVector
)
)
(
FieldNullable
SqlTSVector
)
data
ContextPolySearch
id
data
ContextPolySearch
id
...
...
src/Gargantext/Database/Schema/ContextNodeNgrams.hs
View file @
9156825b
...
@@ -40,28 +40,28 @@ data ContextNodeNgramsPoly c n ngrams_id ngt w dc
...
@@ -40,28 +40,28 @@ data ContextNodeNgramsPoly c n ngrams_id ngt w dc
}
deriving
(
Show
)
}
deriving
(
Show
)
type
ContextNodeNgramsWrite
=
type
ContextNodeNgramsWrite
=
ContextNodeNgramsPoly
(
Column
SqlInt4
)
ContextNodeNgramsPoly
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlFloat8
)
(
Field
SqlFloat8
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
type
ContextNodeNgramsRead
=
type
ContextNodeNgramsRead
=
ContextNodeNgramsPoly
(
Column
SqlInt4
)
ContextNodeNgramsPoly
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlFloat8
)
(
Field
SqlFloat8
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
type
ContextNodeNgramsReadNull
=
type
ContextNodeNgramsReadNull
=
ContextNodeNgramsPoly
(
Column
(
Nullable
SqlInt4
)
)
ContextNodeNgramsPoly
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlFloat8
)
)
(
FieldNullable
SqlFloat8
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
$
(
makeAdaptorAndInstance
"pContextNodeNgrams"
''
C
ontextNodeNgramsPoly
)
$
(
makeAdaptorAndInstance
"pContextNodeNgrams"
''
C
ontextNodeNgramsPoly
)
makeLenses
''
C
ontextNodeNgramsPoly
makeLenses
''
C
ontextNodeNgramsPoly
...
@@ -78,3 +78,6 @@ contextNodeNgramsTable = Table "context_node_ngrams"
...
@@ -78,3 +78,6 @@ contextNodeNgramsTable = Table "context_node_ngrams"
,
_cnng_doc_count
=
requiredTableField
"doc_count"
,
_cnng_doc_count
=
requiredTableField
"doc_count"
}
}
)
)
-- queryContextNodeNgramsTable :: Select ContextNodeNgramsRead
-- queryContextNodeNgramsTable = selectTable contextNodeNgramsTable
src/Gargantext/Database/Schema/Ngrams.hs
View file @
9156825b
...
@@ -33,7 +33,7 @@ import Data.Text (Text, splitOn, pack, strip)
...
@@ -33,7 +33,7 @@ import Data.Text (Text, splitOn, pack, strip)
import
Database.PostgreSQL.Simple.FromField
(
returnError
,
ResultError
(
..
))
import
Database.PostgreSQL.Simple.FromField
(
returnError
,
ResultError
(
..
))
import
Gargantext.Core
(
HasDBid
(
..
))
import
Gargantext.Core
(
HasDBid
(
..
))
import
Gargantext.Core.Types
(
TODO
(
..
),
Typed
(
..
))
import
Gargantext.Core.Types
(
TODO
(
..
),
Typed
(
..
))
import
Gargantext.Database.Schema.Prelude
import
Gargantext.Database.Schema.Prelude
hiding
(
over
)
import
Gargantext.Database.Types
import
Gargantext.Database.Types
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Servant
(
FromHttpApiData
(
..
),
Proxy
(
..
),
ToHttpApiData
(
..
))
import
Servant
(
FromHttpApiData
(
..
),
Proxy
(
..
),
ToHttpApiData
(
..
))
...
@@ -52,17 +52,17 @@ data NgramsPoly id terms n = NgramsDB { _ngrams_id :: !id
...
@@ -52,17 +52,17 @@ data NgramsPoly id terms n = NgramsDB { _ngrams_id :: !id
,
_ngrams_n
::
!
n
,
_ngrams_n
::
!
n
}
deriving
(
Show
)
}
deriving
(
Show
)
type
NgramsWrite
=
NgramsPoly
(
Maybe
(
Column
SqlInt4
))
type
NgramsWrite
=
NgramsPoly
(
Maybe
(
Field
SqlInt4
))
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
type
NgramsRead
=
NgramsPoly
(
Column
SqlInt4
)
type
NgramsRead
=
NgramsPoly
(
Field
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
type
NgramsReadNull
=
NgramsPoly
(
Column
(
Nullable
SqlInt4
)
)
type
NgramsReadNull
=
NgramsPoly
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
FieldNullable
SqlText
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
type
NgramsDB
=
NgramsPoly
Int
Text
Int
type
NgramsDB
=
NgramsPoly
Int
Text
Int
...
@@ -155,10 +155,10 @@ instance DefaultFromField (Nullable SqlInt4) NgramsTypeId
...
@@ -155,10 +155,10 @@ instance DefaultFromField (Nullable SqlInt4) NgramsTypeId
where
where
defaultFromField
=
fromPGSFromField
defaultFromField
=
fromPGSFromField
pgNgramsType
::
NgramsType
->
Column
SqlInt4
pgNgramsType
::
NgramsType
->
Field
SqlInt4
pgNgramsType
=
pgNgramsTypeId
.
ngramsTypeId
pgNgramsType
=
pgNgramsTypeId
.
ngramsTypeId
pgNgramsTypeId
::
NgramsTypeId
->
Column
SqlInt4
pgNgramsTypeId
::
NgramsTypeId
->
Field
SqlInt4
pgNgramsTypeId
(
NgramsTypeId
n
)
=
sqlInt4
n
pgNgramsTypeId
(
NgramsTypeId
n
)
=
sqlInt4
n
ngramsTypeId
::
NgramsType
->
NgramsTypeId
ngramsTypeId
::
NgramsType
->
NgramsTypeId
...
...
src/Gargantext/Database/Schema/Node.hs
View file @
9156825b
...
@@ -72,68 +72,68 @@ nodeTable = Table "nodes" (pNode Node { _node_id = optionalTableField "i
...
@@ -72,68 +72,68 @@ nodeTable = Table "nodes" (pNode Node { _node_id = optionalTableField "i
queryNodeTable
::
Query
NodeRead
queryNodeTable
::
Query
NodeRead
queryNodeTable
=
selectTable
nodeTable
queryNodeTable
=
selectTable
nodeTable
------------------------------------------------------------------------
------------------------------------------------------------------------
type
NodeWrite
=
NodePoly
(
Maybe
(
Column
SqlInt4
)
)
type
NodeWrite
=
NodePoly
(
Maybe
(
Field
SqlInt4
)
)
(
Maybe
(
Column
SqlText
)
)
(
Maybe
(
Field
SqlText
)
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Maybe
(
Column
SqlInt4
)
)
(
Maybe
(
Field
SqlInt4
)
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Maybe
(
Column
SqlTimestamptz
))
(
Maybe
(
Field
SqlTimestamptz
))
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
type
NodeRead
=
NodePoly
(
Column
SqlInt4
)
type
NodeRead
=
NodePoly
(
Field
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
type
NodeReadNull
=
NodePoly
(
Column
(
Nullable
SqlInt4
)
)
type
NodeReadNull
=
NodePoly
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
FieldNullable
SqlText
)
(
Column
(
Nullable
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
Field
SqlText
)
(
Column
(
Nullable
SqlTimestamptz
)
)
(
FieldNullable
SqlTimestamptz
)
(
Column
(
Nullable
SqlJsonb
)
)
(
Field
SqlJsonb
)
------------------------------------------------------------------------
------------------------------------------------------------------------
-- | Node(Read|Write)Search is slower than Node(Write|Read) use it
-- | Node(Read|Write)Search is slower than Node(Write|Read) use it
-- for full text search only
-- for full text search only
type
NodeSearchWrite
=
type
NodeSearchWrite
=
NodePolySearch
NodePolySearch
(
Maybe
(
Column
SqlInt4
)
)
(
Maybe
(
Field
SqlInt4
)
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Maybe
(
Column
SqlTimestamptz
))
(
Maybe
(
Field
SqlTimestamptz
))
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
(
Maybe
(
Column
SqlTSVector
)
)
(
Maybe
(
Field
SqlTSVector
)
)
type
NodeSearchRead
=
type
NodeSearchRead
=
NodePolySearch
NodePolySearch
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
SqlInt4
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
SqlText
)
(
Field
SqlText
)
(
Column
SqlTimestamptz
)
(
Field
SqlTimestamptz
)
(
Column
SqlJsonb
)
(
Field
SqlJsonb
)
(
Column
SqlTSVector
)
(
Field
SqlTSVector
)
type
NodeSearchReadNull
=
type
NodeSearchReadNull
=
NodePolySearch
NodePolySearch
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlText
)
)
(
FieldNullable
SqlText
)
(
Column
(
Nullable
SqlTimestamptz
)
)
(
FieldNullable
SqlTimestamptz
)
(
Column
(
Nullable
SqlJsonb
)
)
(
FieldNullable
SqlJsonb
)
(
Column
(
Nullable
SqlTSVector
)
)
(
FieldNullable
SqlTSVector
)
data
NodePolySearch
id
data
NodePolySearch
id
...
...
src/Gargantext/Database/Schema/NodeContext.hs
View file @
9156825b
...
@@ -34,23 +34,23 @@ data NodeContextPoly id node_id context_id score cat
...
@@ -34,23 +34,23 @@ data NodeContextPoly id node_id context_id score cat
,
_nc_category
::
!
cat
,
_nc_category
::
!
cat
}
deriving
(
Show
)
}
deriving
(
Show
)
type
NodeContextWrite
=
NodeContextPoly
(
Maybe
(
Column
(
SqlInt4
)
))
type
NodeContextWrite
=
NodeContextPoly
(
Maybe
(
Field
SqlInt4
))
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
(
Maybe
(
Column
(
SqlFloat8
)
))
(
Maybe
(
Field
SqlFloat8
))
(
Maybe
(
Column
(
SqlInt4
)
))
(
Maybe
(
Field
SqlInt4
))
type
NodeContextRead
=
NodeContextPoly
(
Column
(
SqlInt4
)
)
type
NodeContextRead
=
NodeContextPoly
(
Field
SqlInt4
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
SqlFloat8
)
)
(
Field
SqlFloat8
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
type
NodeContextReadNull
=
NodeContextPoly
(
Column
(
Nullable
SqlInt4
)
)
type
NodeContextReadNull
=
NodeContextPoly
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
(
Column
(
Nullable
SqlFloat8
)
)
(
FieldNullable
SqlFloat8
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
type
NodeContext
=
NodeContextPoly
(
Maybe
Int
)
NodeId
NodeId
(
Maybe
Double
)
(
Maybe
Int
)
type
NodeContext
=
NodeContextPoly
(
Maybe
Int
)
NodeId
NodeId
(
Maybe
Double
)
(
Maybe
Int
)
...
...
src/Gargantext/Database/Schema/NodeNode.hs
View file @
9156825b
{-|
{-|
Module : Gargantext.Database.Schema.NodeNode
Module : Gargantext.Database.Schema.NodeNode
Description :
Description :
Copyright : (c) CNRS, 2017-Present
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Maintainer : team@gargantext.org
...
@@ -30,20 +30,20 @@ data NodeNodePoly node1_id node2_id score cat
...
@@ -30,20 +30,20 @@ data NodeNodePoly node1_id node2_id score cat
,
_nn_category
::
!
cat
,
_nn_category
::
!
cat
}
deriving
(
Show
)
}
deriving
(
Show
)
type
NodeNodeWrite
=
NodeNodePoly
(
Column
(
SqlInt4
)
)
type
NodeNodeWrite
=
NodeNodePoly
(
Field
SqlInt4
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
(
Maybe
(
Column
(
SqlFloat8
)
))
(
Maybe
(
Field
SqlFloat8
))
(
Maybe
(
Column
(
SqlInt4
)
))
(
Maybe
(
Field
SqlInt4
))
type
NodeNodeRead
=
NodeNodePoly
(
Column
(
SqlInt4
)
)
type
NodeNodeRead
=
NodeNodePoly
(
Field
SqlInt4
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
SqlFloat8
)
)
(
Field
SqlFloat8
)
(
Column
(
SqlInt4
)
)
(
Field
SqlInt4
)
type
NodeNodeReadNull
=
NodeNodePoly
(
Column
(
Nullable
SqlInt4
)
)
type
NodeNodeReadNull
=
NodeNodePoly
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlInt4
)
)
(
Field
SqlInt4
)
(
Column
(
Nullable
SqlFloat8
)
)
(
FieldNullable
SqlFloat8
)
(
Column
(
Nullable
SqlInt4
)
)
(
FieldNullable
SqlInt4
)
type
NodeNode
=
NodeNodePoly
NodeId
NodeId
(
Maybe
Double
)
(
Maybe
Int
)
type
NodeNode
=
NodeNodePoly
NodeId
NodeId
(
Maybe
Double
)
(
Maybe
Int
)
...
@@ -60,4 +60,3 @@ nodeNodeTable =
...
@@ -60,4 +60,3 @@ nodeNodeTable =
,
_nn_category
=
optionalTableField
"category"
,
_nn_category
=
optionalTableField
"category"
}
}
)
)
src/Gargantext/Database/Schema/User.hs
View file @
9156825b
...
@@ -99,11 +99,11 @@ type UserRead = UserPoly (Column SqlInt4) (Column SqlText)
...
@@ -99,11 +99,11 @@ type UserRead = UserPoly (Column SqlInt4) (Column SqlText)
(
Column
SqlTimestamptz
)
(
Column
SqlTimestamptz
)
(
Column
SqlText
)
(
Column
SqlText
)
type
UserReadNull
=
UserPoly
(
Column
(
Nullable
SqlInt4
))
(
Column
(
Nullable
SqlText
)
)
type
UserReadNull
=
UserPoly
(
Column
(
Nullable
SqlInt4
))
(
Column
SqlText
)
(
Column
(
Nullable
SqlTimestamptz
))
(
Column
(
Nullable
SqlBool
)
)
(
Column
(
Nullable
SqlTimestamptz
))
(
Column
SqlBool
)
(
Column
(
Nullable
SqlText
))
(
Column
(
Nullable
SqlText
)
)
(
Column
SqlText
)
(
Column
SqlText
)
(
Column
(
Nullable
SqlText
))
(
Column
(
Nullable
SqlText
)
)
(
Column
SqlText
)
(
Column
SqlText
)
(
Column
(
Nullable
SqlBool
))
(
Column
(
Nullable
SqlBool
)
)
(
Column
SqlBool
)
(
Column
SqlBool
)
(
Column
(
Nullable
SqlTimestamptz
))
(
Column
(
Nullable
SqlTimestamptz
))
(
Column
(
Nullable
SqlText
))
(
Column
(
Nullable
SqlText
))
...
...
src/Gargantext/Utils/Tuple.hs
0 → 100644
View file @
9156825b
module
Gargantext.Utils.Tuple
where
import
Protolude
uncurryMaybe
::
(
Maybe
a
,
Maybe
b
)
->
Maybe
(
a
,
b
)
uncurryMaybe
(
Nothing
,
_
)
=
Nothing
uncurryMaybe
(
_
,
Nothing
)
=
Nothing
uncurryMaybe
(
Just
a
,
Just
b
)
=
Just
(
a
,
b
)
stack.yaml
View file @
9156825b
...
@@ -64,8 +64,8 @@ extra-deps:
...
@@ -64,8 +64,8 @@ extra-deps:
commit
:
fd7e5d7325939103cd87d0dc592faf644160341c
commit
:
fd7e5d7325939103cd87d0dc592faf644160341c
# Databases libs
# Databases libs
-
git
:
https://github.com/
delanoe
/haskell-opaleye.git
-
git
:
https://github.com/
garganscript
/haskell-opaleye.git
commit
:
756cb90f4ce725463d957bc899d764e0ed73738c
commit
:
18c4958e076f5f8f82a4e4a3fc9ec659d2bd8766
-
git
:
https://github.com/delanoe/hsparql.git
-
git
:
https://github.com/delanoe/hsparql.git
commit
:
2acbbc55ac9bbd4bf1a713c586b8b8e8b82892eb
commit
:
2acbbc55ac9bbd4bf1a713c586b8b8e8b82892eb
-
git
:
https://github.com/robstewart57/rdf4h.git
-
git
:
https://github.com/robstewart57/rdf4h.git
...
...
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