Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
398223ff
Commit
398223ff
authored
Apr 08, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[VIZ.API][FACTO]
parent
73114c78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
20 deletions
+30
-20
API.hs
src/Gargantext/Viz/Graph/API.hs
+30
-20
No files found.
src/Gargantext/Viz/Graph/API.hs
View file @
398223ff
...
@@ -17,44 +17,45 @@ Portability : POSIX
...
@@ -17,44 +17,45 @@ Portability : POSIX
{-# LANGUAGE OverloadedStrings #-}
-- allows to write Text literals
{-# LANGUAGE OverloadedStrings #-}
-- allows to write Text literals
{-# LANGUAGE OverloadedLists #-}
-- allows to write Map and HashMap as lists
{-# LANGUAGE OverloadedLists #-}
-- allows to write Map and HashMap as lists
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
module
Gargantext.Viz.Graph.API
module
Gargantext.Viz.Graph.API
where
where
import
Control.Monad.IO.Class
(
liftIO
)
import
Control.Lens
(
set
)
import
Control.Lens
(
set
)
--import Servant.Job.Utils (swaggerOptions
)
import
Control.Monad.IO.Class
(
liftIO
)
import
Gargantext.
Database.Schema.Ngram
s
import
Gargantext.
API.Ngrams.Tool
s
import
Gargantext.API.Types
import
Gargantext.API.Types
import
Gargantext.Core.Types.Main
import
Gargantext.Database.Metrics.NgramsByNode
(
getNodesByNgramsOnlyUser
)
import
Gargantext.Database.Metrics.NgramsByNode
(
getNodesByNgramsOnlyUser
)
import
Gargantext.Database.Schema.Ngrams
import
Gargantext.Database.Schema.Node
(
getNode
)
import
Gargantext.Database.Schema.Node
(
getNode
)
import
Gargantext.Database.Schema.Node
(
defaultList
)
import
Gargantext.Database.Types.Node
-- (GraphId, ListId, CorpusId, NodeId)
import
Gargantext.Database.Types.Node
-- (GraphId, ListId, CorpusId, NodeId)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.API.Ngrams.Tools
import
Gargantext.Core.Types.Main
import
Gargantext.Viz.Graph.Tools
-- (cooc2graph)
import
Gargantext.Database.Schema.Node
(
defaultList
)
import
Gargantext.Viz.Graph
import
Gargantext.Viz.Graph
import
Gargantext.Viz.Graph.Tools
-- (cooc2graph)
import
Servant
import
Servant
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
{-
------------------------------------------------------------------------
getgraph :: GraphId -> GraphView
getgraph _GraphId = phyloView
--getgraph :: GraphId -> Maybe PhyloQueryView -> PhyloView
--getgraph _GraphId _phyloQueryView = phyloView
postgraph :: CorpusId -> Maybe ListId -> GraphQueryBuild -> Phylo
postgraph = undefined
putgraph :: GraphId -> Maybe ListId -> PhyloQueryBuild -> Phylo
-- | There is no Delete specific API for Graph since it can be deleted
putgraph = undefined
-- as simple Node.
-}
type
GraphAPI
=
Get
'[
J
SON
]
Graph
:<|>
Post
'[
J
SON
]
[
NodeId
]
:<|>
Put
'[
J
SON
]
Int
type
GraphAPI
=
Get
'[
J
SON
]
Graph
graphAPI
::
NodeId
->
GargServer
GraphAPI
graphAPI
::
NodeId
->
GargServer
GraphAPI
graphAPI
nId
=
do
graphAPI
n
=
getGraph
n
:<|>
postGraph
n
:<|>
putGraph
n
------------------------------------------------------------------------
getGraph
::
NodeId
->
GargServer
(
Get
'[
J
SON
]
Graph
)
getGraph
nId
=
do
nodeGraph
<-
getNode
nId
HyperdataGraph
nodeGraph
<-
getNode
nId
HyperdataGraph
let
metadata
=
GraphMetadata
"Title"
[
maybe
0
identity
$
_node_parentId
nodeGraph
]
let
metadata
=
GraphMetadata
"Title"
[
maybe
0
identity
$
_node_parentId
nodeGraph
]
...
@@ -74,5 +75,14 @@ graphAPI nId = do
...
@@ -74,5 +75,14 @@ graphAPI nId = do
liftIO
$
set
graph_metadata
(
Just
metadata
)
<$>
cooc2graph
myCooc
liftIO
$
set
graph_metadata
(
Just
metadata
)
<$>
cooc2graph
myCooc
postGraph
::
NodeId
->
GargServer
(
Post
'[
J
SON
]
[
NodeId
])
postGraph
=
undefined
putGraph
::
NodeId
->
GargServer
(
Put
'[
J
SON
]
Int
)
putGraph
=
undefined
-- | Instances
-- | Instances
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