Skip to content

rescile/graphml-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

rescile GraphML Export Module

A lightweight rescile application module that allows you to instantly download your modeled environment as a standard GraphML XML file.

This module acts as an "invisible launcher." When accessed, it fetches the current state of the graph, dynamically parses and types all node and edge properties, and seamlessly triggers a file download without displaying a web interface. The resulting graph.graphml file can be imported into network analysis and visualization tools like Gephi, yEd, or Cytoscape.

✨ Features

  • Instant GraphML Export: Fetches the raw graph representation via GraphQL and converts it into a well-formed GraphML structure.
  • Dynamic Type Inference: Automatically scans all vertex and edge properties to infer and promote correct GraphML attribute types (boolean, long, double, string).
  • Invisible Launcher Mechanism: Uses an SVG-namespaced XML file to silently execute JavaScript, construct the XML payload in the browser, and trigger a download automatically.
  • Zero Build Step: Implemented entirely as a single static file (app/index.xml) with zero external dependencies, build tools, or CDNs required.

πŸš€ Usage

You can load this module into your rescile project directly from the GitHub repository using the rescile-ce CLI.

Start the rescile server with the module:

rescile-ce --module https://github.com/rescile/graphml-module serve

Once the server is running, navigate to the module's subpath in your web browser.

Triggering the Export

By default, simply visiting the module's URL will immediately download a file named graph.graphml to your machine.

πŸ“‚ Anatomy of this App Module

This module is a perfect demonstration of the Alternate Formats (XML) pattern described in the rescile Application Modules documentation.

  • module.toml: The manifest defining the module's name, version (0.0.2), and compatibility (>=0.1.114).
  • app/index.xml: The application's entry point.
    • The SVG Trick: Because web browsers do not natively execute JavaScript inside generic XML files, the root element is an <svg>. The browser recognizes the SVG namespace and executes the embedded <script type="text/javascript">.
    • CDATA Protection: The script is wrapped in <![CDATA[ ... ]]> so that characters like < and & do not break strict XML parsing.
    • Client-Side Fetching: The script makes a native POST request to the local /graphql endpoint to execute the { graphJson } query.
    • Blob Downloading: Once the GraphML string is constructed, it is converted into an application/xml Blob and downloaded via an ephemeral, click-triggered <a> tag.

About

Download the modeled environment as a GraphML XML file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors