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
145
Issues
145
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
6651d0d6
Commit
6651d0d6
authored
Nov 08, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API][NGRAMS] to discuss
parent
30aae72b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
13 deletions
+19
-13
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+8
-6
Node.hs
src/Gargantext/API/Node.hs
+7
-3
Main.hs
src/Gargantext/Core/Types/Main.hs
+1
-1
Flow.hs
src/Gargantext/Database/Flow.hs
+3
-3
No files found.
src/Gargantext/API/Ngrams.hs
View file @
6651d0d6
...
...
@@ -97,10 +97,6 @@ data NgramsTable = NgramsTable { _ngramsTable :: [Tree NgramsElement] }
$
(
deriveJSON
(
unPrefix
"_"
)
''
N
gramsTable
)
-- TODO
instance
FromJSON
(
Tree
NgramsElement
)
instance
ToJSON
(
Tree
NgramsElement
)
------------------------------------------------------------------------
-- On the Client side:
--data Action = InGroup NgramsId NgramsId
...
...
@@ -145,7 +141,6 @@ instance ToSchema NgramsIdPatchs
instance
Arbitrary
NgramsIdPatchs
where
arbitrary
=
NgramsIdPatchs
<$>
arbitrary
------------------------------------------------------------------------
------------------------------------------------------------------------
type
Version
=
Int
...
...
@@ -178,11 +173,16 @@ ngramsIdPatch = fromList $ catMaybes $ reverse [ replace (1::NgramsId) (Just $ n
------------------------------------------------------------------------
------------------------------------------------------------------------
type
CorpusId
=
Int
type
TableNgramsApi
=
Summary
" Table Ngrams API"
type
TableNgramsApi
=
Summary
" Table Ngrams API
Change
"
:>
QueryParam
"list"
ListId
:>
ReqBody
'[
J
SON
]
NgramsIdPatchs
:>
Put
'[
J
SON
]
NgramsIdPatchsBack
type
TableNgramsApiGet
=
Summary
" Table Ngrams API Get"
:>
QueryParam
"ngramsType"
TabType
:>
QueryParam
"list"
ListId
:>
Get
'[
J
SON
]
NgramsIdPatchsBack
type
NgramsIdPatchsFeed
=
NgramsIdPatchs
type
NgramsIdPatchsBack
=
NgramsIdPatchs
...
...
@@ -219,3 +219,5 @@ tableNgramsPatch conn corpusId maybeList patchs = do
_
<-
updateNodeNgrams
conn
(
toLists
listId
patchs
)
pure
(
NgramsIdPatchs
[]
)
getTableNgramsPatch
::
Connection
->
CorpusId
->
Maybe
TabType
->
Maybe
ListId
->
IO
NgramsTable
getTableNgramsPatch
=
undefined
src/Gargantext/API/Node.hs
View file @
6651d0d6
...
...
@@ -48,7 +48,7 @@ import Database.PostgreSQL.Simple (Connection)
import
GHC.Generics
(
Generic
)
import
Servant
import
Gargantext.API.Ngrams
(
TabType
(
..
),
TableNgramsApi
,
t
ableNgramsPatch
,
NgramsIdPatchsFeed
,
NgramsIdPatchsBack
)
import
Gargantext.API.Ngrams
(
TabType
(
..
),
TableNgramsApi
,
TableNgramsApiGet
,
tableNgramsPatch
,
getT
ableNgramsPatch
,
NgramsIdPatchsFeed
,
NgramsIdPatchsBack
)
import
Gargantext.Prelude
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Node
(
runCmd
...
...
@@ -110,6 +110,7 @@ type NodeAPI a = Get '[JSON] (Node a)
-- TODO gather it
:<|>
"table"
:>
TableApi
:<|>
"list"
:>
TableNgramsApi
:<|>
"listGet"
:>
TableNgramsApiGet
:<|>
"chart"
:>
ChartApi
:<|>
"favorites"
:>
FavApi
...
...
@@ -142,7 +143,8 @@ nodeAPI conn p id
-- TODO gather it
:<|>
getTable
conn
id
:<|>
tableNgramsPatch'
conn
id
:<|>
getTableNgramsPatch'
conn
id
:<|>
getChart
conn
id
:<|>
favApi
conn
id
:<|>
delDocs
conn
id
...
...
@@ -233,7 +235,6 @@ type ChartApi = Summary " Chart API"
-- To launch a query and update the corpus
-- :<|> "query" :> Capture "string" Text :> Get '[JSON] Text
------------------------------------------------------------------------
type
GraphAPI
=
Get
'[
J
SON
]
Graph
graphAPI
::
Connection
->
NodeId
->
Server
GraphAPI
...
...
@@ -288,6 +289,9 @@ getNodesWith' conn id p nodeType offset limit = liftIO (getNodesWith conn id p
tableNgramsPatch'
::
Connection
->
CorpusId
->
Maybe
ListId
->
NgramsIdPatchsFeed
->
Handler
NgramsIdPatchsBack
tableNgramsPatch'
c
cId
mL
ns
=
liftIO
$
tableNgramsPatch
c
cId
mL
ns
getTableNgramsPatch'
::
Connection
->
CorpusId
->
Maybe
TabType
->
Maybe
ListId
->
Handler
NgramsIdPatchsBack
getTableNgramsPatch'
c
cId
nType
mL
=
liftIO
$
getTableNgramsPatch
c
cId
nType
mL
query
::
Text
->
Handler
Text
query
s
=
pure
s
...
...
src/Gargantext/Core/Types/Main.hs
View file @
6651d0d6
...
...
@@ -135,7 +135,7 @@ type Offset = Int
data
Tree
a
=
TreeN
a
[
Tree
a
]
deriving
(
Show
,
Read
,
Eq
,
Generic
,
Ord
)
instance
ToJSON
(
Tree
NodeTree
)
where
instance
ToJSON
a
=>
ToJSON
(
Tree
a
)
where
toJSON
(
TreeN
node
nodes
)
=
object
[
"node"
A
..=
toJSON
node
,
"children"
A
..=
toJSON
nodes
]
...
...
src/Gargantext/Database/Flow.hs
View file @
6651d0d6
...
...
@@ -32,7 +32,7 @@ import Data.Tuple.Extra (both, second)
import
qualified
Data.Map
as
DM
import
Gargantext.Core.Types
(
NodePoly
(
..
),
ListType
(
..
),
listId
)
import
Gargantext.Database.Bashql
(
runCmd'
,
del
)
import
Gargantext.Database.Bashql
(
runCmd'
)
--
, del)
import
Gargantext.Database.Ngrams
(
insertNgrams
,
Ngrams
(
..
),
NgramsT
(
..
),
NgramsIndexed
(
..
),
indexNgramsT
,
ngramsTypeId
,
NgramsType
(
..
),
text2ngrams
)
import
Gargantext.Database.Node
(
getRoot
,
mkRoot
,
mkCorpus
,
Cmd
(
..
),
mkList
)
import
Gargantext.Database.Node.Document.Add
(
add
)
...
...
@@ -68,8 +68,8 @@ flow fp cName = do
_
<-
runCmd'
$
insertToNodeNgrams
indexedNgrams
-- List Flow
listId
<-
runCmd'
$
listFlow
masterUserId
corpusId
indexedNgrams
printDebug
"list id:"
listId
listId
2
<-
runCmd'
$
listFlow
masterUserId
corpusId
indexedNgrams
printDebug
"list id:"
listId
2
printDebug
"Docs IDs : "
(
length
idsRepeat
)
...
...
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