AI Code Report — 2025-09-15T17:34:16Z
Objective
Create a proof-of-concept Draw.io plugin that exposes an RDF/XML export option, register it so the editor can load it like built-in plugins, describe how to use it, and document the engineering work.
Repository analysis
Located the plugin infrastructure under
src/main/webapp/plugins/and reviewed existing samples (svgdata.js,tags.js,anonymize.js) to understand how actions are registered and menus are extended.Inspected
App.jsandapp.min.jsto learn how plugins are registered and exposed to the plug-in dialog viaApp.pluginRegistryandApp.publicPlugin.Confirmed that production builds rely on the minified bundle by reading
index.html, which meant registry updates had to land in both the source and minified versions.
Implementation summary
New plugin file — Added
src/main/webapp/plugins/rdfexport.jsthat registers anexportRdfXmlaction. The plugin:Builds a new DOM document rooted at
<rdf:RDF>with both the RDF andexamplenamespaces declared.Clones the editor’s
<mxGraphModel>tree usingcreateElementNSso each element becomes anexample:*node while all attributes/text nodes are preserved, using the element returned byeditorUi.editor.getGraphXml()directly to avoid dropping the model from the export.Wraps the cloned tree inside
<example:Diagram>tagged withrdf:about="urn:diagram:{pageId}"and a human-readable title element.Hooks into the File → Export as menu to surface the new action and uses
editorUi.saveDatato produce a.rdfdownload with MIME typeapplication/rdf+xml.
Registry updates — Extended
App.pluginRegistry/App.publicPluginin bothApp.jsandapp.min.jswith therdfidentifier so the plugin can be loaded via?p=rdfand appears in the plugin manager.User documentation — Authored
docs/plugins/rdfexport/README.mddescribing how to enable the plugin (URL parameter or plugin dialog) and what the exporter produces.Engineering log — Recorded these steps in this report for future reference.
Testing
No automated test harness exists in this repository (no
package.jsonor documented build scripts). The changes are isolated to a plugin and related documentation, so no commands were executed. Manual verification guidance is captured in the README.
Follow-up ideas
Expand the exporter to cover multi-page diagrams and embed richer RDF semantics instead of the current namespace-only clone.
Add a round-trip smoke test that ensures the plugin action generates valid XML by parsing it before download when running in development mode.