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
534652ed
Commit
534652ed
authored
Jan 21, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] Connecting graph.
parent
74ee77a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
Node.hs
src/Gargantext/API/Node.hs
+19
-5
Flow.hs
src/Gargantext/Text/Flow.hs
+1
-0
No files found.
src/Gargantext/API/Node.hs
View file @
534652ed
...
@@ -55,10 +55,12 @@ import Gargantext.Database.Node.Children (getChildren)
...
@@ -55,10 +55,12 @@ import Gargantext.Database.Node.Children (getChildren)
import
qualified
Gargantext.Database.Node.Update
as
U
(
update
,
Update
(
..
))
import
qualified
Gargantext.Database.Node.Update
as
U
(
update
,
Update
(
..
))
import
Gargantext.Database.Facet
(
FacetDoc
,
runViewDocuments
,
OrderBy
(
..
),
FacetChart
,
runViewAuthorsDoc
)
import
Gargantext.Database.Facet
(
FacetDoc
,
runViewDocuments
,
OrderBy
(
..
),
FacetChart
,
runViewAuthorsDoc
)
import
Gargantext.Database.Tree
(
treeDB
,
HasTreeError
(
..
),
TreeError
(
..
))
import
Gargantext.Database.Tree
(
treeDB
,
HasTreeError
(
..
),
TreeError
(
..
))
import
Gargantext.Database.Metrics.Count
(
getCoocByDocDev
)
import
Gargantext.Database.Schema.Node
(
defaultList
)
import
Gargantext.Database.Schema.NodeNode
(
nodesToFavorite
,
nodesToTrash
)
import
Gargantext.Database.Schema.NodeNode
(
nodesToFavorite
,
nodesToTrash
)
import
Gargantext.API.Search
(
SearchAPI
,
searchIn
,
SearchInQuery
)
import
Gargantext.API.Search
(
SearchAPI
,
searchIn
,
SearchInQuery
)
-- Graph
-- Graph
--import Gargantext.Text.Flow
import
Gargantext.Text.Flow
(
cooc2graph
)
import
Gargantext.Viz.Graph
hiding
(
Node
)
-- (Graph(_graph_metadata),LegendField(..), GraphMetadata(..),readGraphFromJson,defaultGraph)
import
Gargantext.Viz.Graph
hiding
(
Node
)
-- (Graph(_graph_metadata),LegendField(..), GraphMetadata(..),readGraphFromJson,defaultGraph)
-- import Gargantext.Core (Lang(..))
-- import Gargantext.Core (Lang(..))
import
Gargantext.Core.Types
(
Offset
,
Limit
)
import
Gargantext.Core.Types
(
Offset
,
Limit
)
...
@@ -245,10 +247,15 @@ type ChartApi = Summary " Chart API"
...
@@ -245,10 +247,15 @@ type ChartApi = Summary " Chart API"
------------------------------------------------------------------------
------------------------------------------------------------------------
type
GraphAPI
=
Get
'[
J
SON
]
Graph
type
GraphAPI
=
Get
'[
J
SON
]
Graph
graphAPI
::
NodeId
->
GargServer
GraphAPI
graphAPI
::
NodeId
->
GargServer
GraphAPI
graphAPI
nId
=
do
graphAPI
cId
=
undefined
--graphAPI' :: NodeId -> GargServer GraphAPI
--graphAPI' :: NodeId -> Cmd err Graph -- GargServer GraphAPI
graphAPI'
cId
=
do
nodeGraph
<-
getNode
n
Id
HyperdataGraph
nodeGraph
<-
getNode
c
Id
HyperdataGraph
let
title
=
"IMT - Scientific publications - 1982-2017 - English"
let
title
=
"IMT - Scientific publications - 1982-2017 - English"
let
metadata
=
GraphMetadata
title
[
maybe
0
identity
$
_node_parentId
nodeGraph
]
[
LegendField
6
"#FFF"
"Data processing"
let
metadata
=
GraphMetadata
title
[
maybe
0
identity
$
_node_parentId
nodeGraph
]
[
LegendField
6
"#FFF"
"Data processing"
...
@@ -257,12 +264,19 @@ graphAPI nId = do
...
@@ -257,12 +264,19 @@ graphAPI nId = do
,
LegendField
5
"#FFF"
"Energy / Environment"
,
LegendField
5
"#FFF"
"Energy / Environment"
]
]
-- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10])
-- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10])
lId
<-
defaultList
cId
cooc
<-
getCoocByDocDev
cId
lId
graph
<-
set
graph_metadata
(
Just
metadata
)
graph
<-
set
graph_metadata
(
Just
metadata
)
<$>
maybe
defaultGraph
identity
-- <$> maybe defaultGraph identity
<$>
cooc2graph
cooc
{-
<$> readGraphFromJson "purescript-gargantext/dist/examples/imtNew.json"
<$> readGraphFromJson "purescript-gargantext/dist/examples/imtNew.json"
-}
pure
graph
pure
graph
-- t <- textFlow (Mono EN) (Contexts contextText)
-- t <- textFlow (Mono EN) (Contexts contextText)
-- liftIO $ liftIO $ pure $ maybe t identity maybeGraph
-- liftIO $ liftIO $ pure $ maybe t identity maybeGraph
-- TODO what do we get about the node? to replace contextText
-- TODO what do we get about the node? to replace contextText
...
@@ -275,7 +289,7 @@ instance HasNodeError ServantErr where
...
@@ -275,7 +289,7 @@ instance HasNodeError ServantErr where
mk
NoRootFound
=
err404
{
errBody
=
e
<>
"No Root found"
}
mk
NoRootFound
=
err404
{
errBody
=
e
<>
"No Root found"
}
mk
NoCorpusFound
=
err404
{
errBody
=
e
<>
"No Corpus found"
}
mk
NoCorpusFound
=
err404
{
errBody
=
e
<>
"No Corpus found"
}
mk
NoUserFound
=
err404
{
errBody
=
e
<>
"No User found"
}
mk
NoUserFound
=
err404
{
errBody
=
e
<>
"No User found"
}
mk
MkNode
=
err500
{
errBody
=
e
<>
"Cannot mk node"
}
mk
MkNode
=
err500
{
errBody
=
e
<>
"Cannot mk node"
}
mk
NegativeId
=
err500
{
errBody
=
e
<>
"Node with negative Id"
}
mk
NegativeId
=
err500
{
errBody
=
e
<>
"Node with negative Id"
}
mk
UserNoParent
=
err500
{
errBody
=
e
<>
"Should not have parent"
}
mk
UserNoParent
=
err500
{
errBody
=
e
<>
"Should not have parent"
}
...
...
src/Gargantext/Text/Flow.hs
View file @
534652ed
...
@@ -35,6 +35,7 @@ import Database.PostgreSQL.Simple (Connection)
...
@@ -35,6 +35,7 @@ import Database.PostgreSQL.Simple (Connection)
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Schema.Node
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Types.Node
import
Gargantext.Database.Utils
(
Cmd
,
mkCmd
)
import
Gargantext.Core
(
Lang
)
import
Gargantext.Core
(
Lang
)
import
Gargantext.Prelude
import
Gargantext.Prelude
...
...
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