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
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
Christian Merten
haskell-gargantext
Commits
d290a871
Verified
Commit
d290a871
authored
Nov 02, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[xml] initial changes to GEXF rendering with use of xml-conduit
parent
c71dbb14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
gargantext.cabal
gargantext.cabal
+1
-1
GEXF.hs
src/Gargantext/Core/Viz/Graph/GEXF.hs
+25
-0
No files found.
gargantext.cabal
View file @
d290a871
...
...
@@ -560,7 +560,7 @@ library
, websockets ^>= 0.12.7.3
, wikiparsec ^>= 1.2.0
, wreq ^>= 0.5.3.3
, xml-conduit ^>= 1.9.1.
1
, xml-conduit ^>= 1.9.1.
3
, xml-types ^>= 0.3.8
, xmlbf ^>= 0.6.1
, yaml ^>= 0.11.8.0
...
...
src/Gargantext/Core/Viz/Graph/GEXF.hs
View file @
d290a871
...
...
@@ -18,13 +18,38 @@ Portability : POSIX
module
Gargantext.Core.Viz.Graph.GEXF
where
import
Conduit
import
Data.HashMap.Lazy
qualified
as
HashMap
import
Data.XML.Types
qualified
as
XML
import
Gargantext.Core.Viz.Graph.Types
qualified
as
G
import
Gargantext.Prelude
import
Gargantext.Prelude
qualified
as
P
import
Prelude
qualified
-- import Text.XML qualified as XML
import
Text.XML.Stream.Render
qualified
as
XML
import
Xmlbf
qualified
as
Xmlbf
graphToXML
::
Monad
m
=>
G
.
Graph
->
ConduitT
i
XML
.
Event
m
()
graphToXML
(
G
.
Graph
{
..
})
=
root
_graph_nodes
_graph_edges
where
-- root :: [G.Node] -> [G.Edge] -> ConduitT i XML.Event m ()
root
gn
ge
=
XML
.
tag
"gexf"
params
$
meta
.|
(
graph
gn
ge
)
where
params
=
XML
.
attr
"xmlns"
"http://www.gexf.net/1.3"
<>
XML
.
attr
"xmlns:viz"
"http://gexf.net/1.3/viz"
<>
XML
.
attr
"xmlns:xsi"
"http://www.w3.org/2001/XMLSchema-instance"
<>
XML
.
attr
"xsi:schemaLocation"
"http://gexf.net/1.3 http://gexf.net/1.3/gexf.xsd"
<>
XML
.
attr
"version"
"1.3"
meta
=
XML
.
tag
"meta"
params
$
XML
.
content
"x"
where
params
=
XML
.
attr
"lastmodifieddate"
"2020-03-13"
graph
_gn
_ge
=
XML
.
tag
"graph"
mempty
$
XML
.
content
"graph here"
-- Converts to GEXF format
-- See https://gephi.org/gexf/format/
instance
Xmlbf
.
ToXml
G
.
Graph
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