[xml] initial changes to GEXF rendering with use of xml-conduit

parent c71dbb14
Pipeline #5321 failed with stages
in 68 minutes and 51 seconds
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment