Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
dc1820d0
Commit
dc1820d0
authored
Mar 06, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[OPTIM] MVar for Graph Clustering.
parent
531317c8
Pipeline
#776
failed with stage
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
48 deletions
+60
-48
API.hs
src/Gargantext/API.hs
+41
-39
New.hs
src/Gargantext/API/Corpus/New.hs
+9
-4
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+3
-3
Tools.hs
src/Gargantext/Viz/Graph/Tools.hs
+7
-2
No files found.
src/Gargantext/API.hs
View file @
dc1820d0
...
...
@@ -239,11 +239,11 @@ type GargPrivateAPI' =
:>
NodeAPI
HyperdataAny
-- Corpus endpoints
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:>
Capture
"corpus_id"
CorpusId
:>
NodeAPI
HyperdataCorpus
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:<|>
"corpus"
:>
Summary
"Corpus endpoint"
:>
Capture
"node1_id"
NodeId
:>
"document"
:>
Capture
"node2_id"
NodeId
...
...
@@ -253,27 +253,29 @@ type GargPrivateAPI' =
:>
Export
.
API
-- Annuaire endpoint
:<|>
"annuaire"
:>
Summary
"Annuaire endpoint"
:<|>
"annuaire"
:>
Summary
"Annuaire endpoint"
:>
Capture
"annuaire_id"
AnnuaireId
:>
NodeAPI
HyperdataAnnuaire
:<|>
"annuaire"
:>
Summary
"Contact endpoint"
:>
Capture
"annuaire_id"
NodeId
:>
"contact"
:>
Capture
"contact_id"
NodeId
:>
"contact"
:>
Capture
"contact_id"
NodeId
:>
NodeNodeAPI
HyperdataContact
-- Document endpoint
:<|>
"document"
:>
Summary
"Document endpoint"
:<|>
"document"
:>
Summary
"Document endpoint"
:>
Capture
"doc_id"
DocId
:>
"ngrams"
:>
TableNgramsApi
-- :<|> "counts" :> Stream GET NewLineFraming '[JSON] Count :> CountAPI
-- TODO-SECURITY
:<|>
"count"
:>
Summary
"Count endpoint"
:>
ReqBody
'[
J
SON
]
Query
:>
CountAPI
:>
ReqBody
'[
J
SON
]
Query
:>
CountAPI
-- Corpus endpoint --> TODO rename s/search/filter/g
:<|>
"search"
:>
Capture
"corpus"
NodeId
:<|>
"search"
:>
Capture
"corpus"
NodeId
:>
SearchPairsAPI
-- TODO move to NodeAPI?
...
...
@@ -470,7 +472,7 @@ type Desc t n = Description (AppendSymbol (TypeName t) (AppendSymbol " | " n))
swaggerDoc
::
Swagger
swaggerDoc
=
toSwagger
(
Proxy
::
Proxy
GargAPI
)
&
info
.
title
.~
"Gargantext"
&
info
.
version
.~
"
4.0.2
"
-- TODO same version as Gargantext
&
info
.
version
.~
"
0.0.1.3.1
"
-- TODO same version as Gargantext
-- & info.base_url ?~ (URL "http://gargantext.org/")
&
info
.
description
?~
"REST API specifications"
-- & tags .~ Set.fromList [Tag "Garg" (Just "Main perations") Nothing]
...
...
src/Gargantext/API/Corpus/New.hs
View file @
dc1820d0
...
...
@@ -78,10 +78,15 @@ instance Arbitrary Query where
instance
ToSchema
Query
where
declareNamedSchema
=
genericDeclareNamedSchema
(
unPrefixSwagger
"query_"
)
type
Api
=
Summary
"New Corpus endpoint"
------------------------------------------------------------------------
type
Api
=
PostApi
:<|>
GetApi
type
PostApi
=
Summary
"New Corpus endpoint"
:>
ReqBody
'[
J
SON
]
Query
:>
Post
'[
J
SON
]
CorpusId
:<|>
Get
'[
J
SON
]
ApiInfo
type
GetApi
=
Get
'[
J
SON
]
ApiInfo
-- | TODO manage several apis
-- TODO-ACCESS
...
...
src/Gargantext/API/Ngrams.hs
View file @
dc1820d0
src/Gargantext/Viz/Graph/Tools.hs
View file @
dc1820d0
...
...
@@ -15,6 +15,8 @@ Portability : POSIX
module
Gargantext.Viz.Graph.Tools
where
import
Control.Monad.IO.Class
(
liftIO
)
import
Control.Concurrent
(
newEmptyMVar
,
takeMVar
,
putMVar
,
forkIO
)
import
Debug.Trace
(
trace
)
import
Data.Graph.Clustering.Louvain.CplusPlus
(
LouvainNode
(
..
))
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
)
...
...
@@ -68,11 +70,14 @@ cooc2graph threshold myCooc = do
n'
=
Set
.
size
$
Set
.
fromList
$
as
<>
bs
ClustersParams
rivers
level
=
{-trace ("nodesApprox: " <> show nodesApprox) $-}
clustersParams
nodesApprox
partitions
<-
case
Map
.
size
distanceMap
>
0
of
partitionsV
<-
liftIO
newEmptyMVar
partitions
'
<-
case
Map
.
size
distanceMap
>
0
of
True
->
trace
(
"level"
<>
show
level
)
$
cLouvain
level
distanceMap
False
->
panic
"Text.Flow: DistanceMap is empty"
_
<-
liftIO
$
forkIO
$
putMVar
partitionsV
partitions'
partitions
<-
liftIO
$
takeMVar
partitionsV
let
bridgeness'
=
{-trace ("rivers: " <> show rivers) $-}
bridgeness
rivers
partitions
distanceMap
...
...
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