Getting started

library(ruml)
library(plantuml) # install from: https://github.com/rkrug/plantuml
library(magrittr)
library(polmineR)

Scenario 1: Create PlantUML Diagram for S4 classes in a package

Plain plantuml-output

plantuml_code <- make_plantuml_code("count", pkg = polmineR)
plantuml_obj <- plantuml(plantuml_code)
plot(plantuml_obj, vector = TRUE)

SVG output

[not evaluated]

plantuml_svg_file <- tempfile(fileext = ".svg")
svg(filename = plantuml_svg_file)
plot(plantuml_obj, vector = TRUE)
dev.off()
browseURL(url = plantuml_svg_file)

Zoomable output

svglite::xmlSVG(plot(plantuml_obj, vector = TRUE)) %>%
  svgPanZoom::svgPanZoom(width = "100%", height = "100%")

Scenario 2: Create UML for XML (Schema)

Generate PlantUML code from XML document

xml_file <- system.file(package = "ruml", "extdata", "xml", "shiporder.xml")
make_plantuml_code(xml_file) %>%
  paste(collapse = "\n") %>%
  plantuml() %>%
  plot(vector = TRUE)

Generate PlantUML code from XML Schema Definition (XSD)

xsd_file <- system.file(package = "ruml", "extdata", "xml", "shiporder.xsd")
make_plantuml_code(xsd_file) %>%
  paste(collapse = "\n") %>%
  plantuml() %>%
  plot(vector = TRUE)
xsd_file <- system.file(package = "ruml", "extdata", "xml", "plenaryprotocol.xsd")
make_plantuml_code(xsd_file) %>%
  paste(collapse = "\n") %>%
  plantuml() %>%
  plot(vector = TRUE)


PolMine/ruml documentation built on April 8, 2023, 7:26 a.m.