flowpipe icon indicating copy to clipboard operation
flowpipe copied to clipboard

export to graphml

Open PaulSchweizer opened this issue 7 years ago • 9 comments

PaulSchweizer avatar Dec 20 '17 20:12 PaulSchweizer

@PaulSchweizer should I just add serialize_graphml and deserialize_graphml methods to the Graph class? I currently have this implemented in json so rewriting this to graphml will require little effort.

Anton-4 avatar Jan 18 '19 13:01 Anton-4

@Anton-4 , good idea! Yes, adding these two methods to the graph would be really good. It could look something like this maybe (just a quick idea):

<graph id="{graph.name}" edgedefault="directed">
    <node id="{node1.identifier}"/>
    <node id="{node2.identifier>"/>
    <edge id="{node1.outputs[output_name].name}-{node2.inputs[input_name].name}" source="{node1.identifier}" target="{node2.identifier}"/>
  </graph>

Not sure where to put the other attributes of the Node like "metadata", "class", "module" etc. but you'll find a way :D Thanks again!

PaulSchweizer avatar Jan 18 '19 17:01 PaulSchweizer

I started working on this and thought: do we really need full serialization and deserialization or just exporting of graph, nodes and edges without attributes like metadata, class, module... ?

I mainly wanted to export to graphml to have a standardized format to feed into the visualizer. What was your intended use-case for full serialization and deserialization?

Anton-4 avatar Jan 24 '19 12:01 Anton-4

I see your point @Anton-4 but if we would fully serialize the graph like we currently do in json, we could use the graphml file to fully reconstruct the graph afterwards. Otherwise we would need to keep another (json) file for that purpose. If it is too much work though, we can start by only serializing as much as you need for visualizing the graph, it should be possible to extend the graphml serialization later.

PaulSchweizer avatar Jan 24 '19 14:01 PaulSchweizer

I now found how I can cleanly add in nested xml. That issue was kind of holding me back. I will make it work :)

Anton-4 avatar Jan 24 '19 15:01 Anton-4

Amazing! Thanks @Anton-4

PaulSchweizer avatar Jan 24 '19 15:01 PaulSchweizer

@Anton-4 I'm planning to put some time into flowpipe over the next weeks and am browsing through the backlog here, trying to get back into it and do some planning. Let me know if you're still working on this

PaulSchweizer avatar Jul 06 '19 19:07 PaulSchweizer

I have not continued working in this. This did require some work to define the complex types as explained here. Feel free to continue working on the schema definition I started here.

Anton-4 avatar Jul 10 '19 15:07 Anton-4

Perfect! Thanks for the links and the work you put into this already! I'm going to put some time into this after the compound plugs are done

PaulSchweizer avatar Jul 14 '19 13:07 PaulSchweizer