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
144
Issues
144
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
969c844f
Commit
969c844f
authored
Nov 19, 2024
by
Grégoire Locqueville
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add route for making a subcorpus
parent
67532a54
Pipeline
#7015
passed with stages
in 54 minutes and 8 seconds
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
26 deletions
+71
-26
gargantext.cabal
gargantext.cabal
+1
-1
Subcorpus.hs
src/Gargantext/API/Node/Corpus/Subcorpus.hs
+32
-0
Corpus.hs
src/Gargantext/API/Routes/Named/Corpus.hs
+28
-1
Private.hs
src/Gargantext/API/Routes/Named/Private.hs
+8
-7
Private.hs
src/Gargantext/API/Server/Named/Private.hs
+2
-0
Node.hs
src/Gargantext/Database/Admin/Types/Node.hs
+0
-3
Query.hs
src/Gargantext/Database/Query.hs
+0
-14
No files found.
gargantext.cabal
View file @
969c844f
...
...
@@ -315,6 +315,7 @@ library
Gargantext.API.Node.Corpus.Export
Gargantext.API.Node.Corpus.Export.Types
Gargantext.API.Node.Corpus.Searx
Gargantext.API.Node.Corpus.Subcorpus
Gargantext.API.Node.Document.Export
Gargantext.API.Node.Document.Export.Types
Gargantext.API.Node.Phylo.Export
...
...
@@ -435,7 +436,6 @@ library
Gargantext.Database.Admin.Types.Hyperdata.User
Gargantext.Database.Admin.Types.Metrics
Gargantext.Database.GargDB
Gargantext.Database.Query
Gargantext.Database.Query.Facet.Types
Gargantext.Database.Query.Filter
Gargantext.Database.Query.Join
...
...
src/Gargantext/API/Node/Corpus/Subcorpus.hs
0 → 100644
View file @
969c844f
module
Gargantext.API.Node.Corpus.Subcorpus
where
import
Gargantext.Prelude
import
Gargantext.API.Errors.Types
(
BackendInternalError
)
import
Gargantext.API.Routes.Named.Corpus
(
MakeSubcorpusAPI
(
..
),
SubcorpusParams
(
..
))
import
Gargantext.Core.NodeStory.Types
(
HasNodeStoryEnv
)
import
Gargantext.Core.NLP
(
HasNLPServer
)
import
Gargantext.Core.Text.Corpus
(
makeSubcorpusFromQuery
)
import
Gargantext.Core.Text.Corpus.Query
(
RawQuery
(
..
),
parseQuery
)
import
Gargantext.Core.Types
(
UserId
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Prelude
(
DbCmd
'
)
import
Servant.Server.Generic
(
AsServerT
)
makeSubcorpus
::
(
HasNodeStoryEnv
env
,
HasNLPServer
env
,
DbCmd'
env
BackendInternalError
m
)
=>
UserId
->
MakeSubcorpusAPI
(
AsServerT
m
)
makeSubcorpus
user
=
MakeSubcorpusAPI
$
\
corpusId
params
->
do
case
parseQuery
(
RawQuery
$
_subcorpusParams_query
params
)
of
Left
_
->
return
False
Right
q
->
do
_
<-
makeSubcorpusFromQuery
(
UserDBId
user
)
corpusId
q
(
_subcorpusParams_reuseParentList
params
)
return
True
src/Gargantext/API/Routes/Named/Corpus.hs
View file @
969c844f
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
module
Gargantext.API.Routes.Named.Corpus
(
...
...
@@ -5,15 +6,22 @@ module Gargantext.API.Routes.Named.Corpus (
CorpusExportAPI
(
..
)
,
AddWithForm
(
..
)
,
AddWithQuery
(
..
)
,
MakeSubcorpusAPI
(
..
)
-- * Others
,
SubcorpusParams
(
..
)
)
where
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Swagger
(
ToSchema
(
..
),
genericDeclareNamedSchema
)
import
Data.Text
(
Text
)
import
GHC.Generics
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Node.Corpus.Export.Types
import
Gargantext.API.Node.Types
import
Gargantext.Core.Text.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Prelude
(
Bool
)
import
Servant
--------------------------------------------------
...
...
@@ -42,3 +50,22 @@ newtype AddWithQuery mode = AddWithQuery
:>
"query"
:>
NamedRoutes
(
AsyncJobs
JobLog
'[
J
SON
]
WithQuery
JobLog
)
}
deriving
Generic
newtype
MakeSubcorpusAPI
mode
=
MakeSubcorpusAPI
{
makeSubcorpusAPI
::
mode
:-
Summary
"Make a subcorpus based on a text search"
:>
"corpus"
:>
Capture
"corpus_id"
CorpusId
:>
"subcorpus"
:>
ReqBody
'[
J
SON
]
SubcorpusParams
:>
Post
'[
J
SON
]
Bool
-- was request successful
}
deriving
Generic
data
SubcorpusParams
=
SubcorpusParams
{
_subcorpusParams_query
::
Text
,
_subcorpusParams_reuseParentList
::
Bool
}
deriving
Generic
$
(
deriveJSON
(
unPrefix
"_subcorpusParams_"
)
''
S
ubcorpusParams
)
instance
ToSchema
SubcorpusParams
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"_subcorpusParams_"
)
src/Gargantext/API/Routes/Named/Private.hs
View file @
969c844f
...
...
@@ -87,6 +87,7 @@ data GargPrivateAPI' mode = GargPrivateAPI'
,
membersAPI
::
mode
:-
"members"
:>
Summary
"Team node members"
:>
NamedRoutes
MembersAPI
,
addWithFormAPI
::
mode
:-
NamedRoutes
AddWithForm
,
addWithQueryEp
::
mode
:-
NamedRoutes
AddWithQuery
,
makeSubcorpusAPI
::
mode
:-
NamedRoutes
MakeSubcorpusAPI
,
listGetAPI
::
mode
:-
NamedRoutes
List
.
GETAPI
,
listJsonAPI
::
mode
:-
NamedRoutes
List
.
JSONAPI
,
listTsvAPI
::
mode
:-
NamedRoutes
List
.
TSVAPI
...
...
src/Gargantext/API/Server/Named/Private.hs
View file @
969c844f
...
...
@@ -12,6 +12,7 @@ import Gargantext.API.Node
import
Gargantext.API.Node
qualified
as
Tree
import
Gargantext.API.Node.Contact
as
Contact
import
Gargantext.API.Node.Corpus.Export
qualified
as
CorpusExport
import
Gargantext.API.Node.Corpus.Subcorpus
qualified
as
Subcorpus
import
Gargantext.API.Node.Document.Export
(
documentExportAPI
)
import
Gargantext.API.Node.Phylo.Export
qualified
as
PhyloExport
import
Gargantext.API.Node.ShareURL
(
shareURL
)
...
...
@@ -60,6 +61,7 @@ serverPrivateGargAPI' authenticatedUser@(AuthenticatedUser userNodeId userId)
,
membersAPI
=
members
,
addWithFormAPI
=
addCorpusWithForm
(
RootId
userNodeId
)
,
addWithQueryEp
=
addCorpusWithQuery
(
RootId
userNodeId
)
,
makeSubcorpusAPI
=
Subcorpus
.
makeSubcorpus
userId
,
listGetAPI
=
List
.
getAPI
,
listJsonAPI
=
List
.
jsonAPI
,
listTsvAPI
=
List
.
tsvAPI
...
...
src/Gargantext/Database/Admin/Types/Node.hs
View file @
969c844f
...
...
@@ -38,10 +38,7 @@ import Data.Text (pack, unpack)
import
Data.Text
qualified
as
T
import
Data.Time
(
UTCTime
)
import
Data.TreeDiff
import
Database.PostgreSQL.Simple.FromField
(
FromField
,
fromField
,
fromJSONField
)
import
Database.PostgreSQL.Simple.ToField
(
ToField
,
toField
,
toJSONField
)
import
Database.PostgreSQL.Simple.FromRow
(
FromRow
,
fromRow
,
field
)
import
Database.PostgreSQL.Simple.ToRow
(
ToRow
,
toRow
)
import
Fmt
(
Buildable
(
..
)
)
import
Gargantext.Core
(
HasDBid
(
..
))
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
,
wellNamedSchema
)
...
...
src/Gargantext/Database/Query.hs
deleted
100644 → 0
View file @
67532a54
{-|
Module : Gargantext.Database.Query
Description : Main Tools of Node to the database
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module
Gargantext.Database.Query
where
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