{"id":23029717,"url":"https://github.com/antononcube/raku-uml-translators","last_synced_at":"2025-09-12T00:37:06.191Z","repository":{"id":48095418,"uuid":"393378089","full_name":"antononcube/Raku-UML-Translators","owner":"antononcube","description":"Raku package for translating code into UML diagrams specifications and vice versa.","archived":false,"fork":false,"pushed_at":"2024-01-28T16:40:51.000Z","size":63,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-14T12:42:22.756Z","etag":null,"topics":["introspection","mermaidjs","plantuml","raku","rakulang","uml","wolfram-language"],"latest_commit_sha":null,"homepage":"https://raku.land/zef:antononcube/UML::Translators","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antononcube.png","metadata":{"files":{"readme":"README-work.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-08-06T13:00:38.000Z","updated_at":"2024-06-07T01:37:08.000Z","dependencies_parsed_at":"2024-01-28T17:38:55.916Z","dependency_job_id":"d677d978-ae67-4abe-80bf-c34e8437314f","html_url":"https://github.com/antononcube/Raku-UML-Translators","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antononcube/Raku-UML-Translators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-UML-Translators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-UML-Translators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-UML-Translators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-UML-Translators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antononcube","download_url":"https://codeload.github.com/antononcube/Raku-UML-Translators/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-UML-Translators/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274732448,"owners_count":25339345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["introspection","mermaidjs","plantuml","raku","rakulang","uml","wolfram-language"],"created_at":"2024-12-15T14:16:56.595Z","updated_at":"2025-09-12T00:37:06.162Z","avatar_url":"https://github.com/antononcube.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raku UML::Translators\n\n## In brief\n\nThis repository is for a Raku package for the translations of code into \n[Unified Modeling Language (UML)](https://en.wikipedia.org/wiki/Unified_Modeling_Language) \nspecifications and vice versa.\n\nCurrently, the package only translates Object-Oriented Programming (OOP) Raku code into: \n\n- The Domain Specific Language (DSL) of [Mermaid-JS](https://mermaid-js.github.io/mermaid/)\n\n- The DSL of [PlantUML](https://plantuml.com)\n\n- Argument specification of the UML class diagram function [`UMLClassGraph`](https://github.com/antononcube/MathematicaForPrediction/blob/master/Misc/UMLDiagramGeneration.m)\n  of the Mathematica / Wolfram Language (WL) package [AAp1] \n\nSee [AA2] for usage examples of both PlantUML and `UMLClassGraph` in Mathematica.\n\n**Remark:** The package provides Command Line Interface (CLI) script.\n\n**Remark:** (Currently) the development of PlantUML is more robust and complete than that of Mermaid-JS.\nHence, workflow-wise, using this package to generate PlantUML specs would produce (on average) best results.\n\n  \n### Future plans\n\nA fully fledged version of this package would translate:\n- C++, Java, Kotlin, or Raku code into UML specs\n- UML specs into C++, Java, Kotlin, or Raku code\n\nCurrently, only UML specs are generated to PlantUML's DSL and a much poorer WL DSL.\nIdeally, subsequent versions of this package would be able to use UML specifications\nencoded in XML and JSON.\n\n------ \n\n## Installation\n\n### From zef's ecosystem\n\n```\nzef install UML::Translators\n```\n\n### From GitHub\n\n```\nzef install https://github.com/antononcube/Raku-UML-Translators.git \n```\n\n------ \n\n## Command Line Interface\n\nThe package provides the CLI script `to-uml-spec`. Here is its usage message:\n\n```shell\nto-uml-spec --help\n```\n\n### Usage examples\n\nGenerate PlantUML spec for the Raku package \n[\"ML::Clustering\"](https://raku.land/zef:antononcube/ML::Clustering):\n\n```shell\nto-uml-spec --/methods --/attributes \"ML::Clustering\"\n```\n\nWith this shell command we generate a Plant UML spec for the package \n[\"Chemistry::Stoichiometry\"](https://raku.land/cpan:ANTONOV/Chemistry::Stoichiometry)\nand create the UML diagram image with a local PlantUML JAR file (downloaded from [PUML1]):\n\n```\nto-uml-spec --/methods --/attributes 'Chemistry::Stoichiometry' | java -jar ~/Downloads/plantuml-1.2022.5.jar -pipe -tjpg \u003e /tmp/myuml.jpg\n```\n\n-----\n\n## Raku session\n\n### UML for ad hoc classes\n\nHere we generate a PlantUML spec:\n\n```perl6\nuse UML::Translators;\nmodule MyPackageClass {\n  role A { method a1 {} }\n  role B { method b1 {} }\n  class C does A { has $!c-var; method c1 {} }\n  class D does B is C { has $!d-var; method d1 {} }\n}\nto-uml-spec('MyPackageClass')\n```\n\nHere we generate a MermaidJS spec:\n\n```perl6, outputPrompt=NONE, outputLang=mermaid\nto-uml-spec('MyPackageClass', format =\u003e 'mermaid')\n```\n\n### UML for packages\n\nGet PlantUML code for the package\n['Chemistry::Stoichiometry'](https://raku.land/cpan:ANTONOV/Chemistry::Stoichiometry):\n\n```perl6\nsay to-uml-spec('Chemistry::Stoichiometry'):!methods:!attributes\n```\n\nGet WL UML graph spec for the package [AAp1]:\n\n```perl6\nsay to-uml-spec('Chemistry::Stoichiometry', format =\u003e 'wluml'):!methods:!attributes\n```\n\n### Classes in a name space\n\nGet the classes, roles, subs, and constants of a namespace:\n\n```perl6\n.say for namespace-types('ML::TriesWithFrequencies', :how-pairs).sort(*.key)\n```\n\n------ \n\n## Potential problems\n\n### Mermaid JS\n\nThe package can export class diagrams in the \n[Mermaid-JS format](https://mermaid-js.github.io/mermaid/#/classDiagram).\nUnfortunately, currently (November 2022) Mermaid-JS does not support colon characters in class names.\nHence, colons are replaced with underscores.\n\nAlso, currently (November 2022) class specs in Mermaid-JS cannot be empty. I.e. the Mermaid JS code\ngenerated here ***will not*** produce a diagram:\n\n```shell\nto-uml-spec --/methods --/attributes \"ML::Clustering\" --format=mermaid  \n```\n\n(Because of the empty definition `ML_Clustering_KMeans {  }`.)\n\nThis command should produce Mermaid JS code that will produce diagram:\n\n```\nto-uml-spec --/methods --/attributes \"ML::Clustering\" --format=mermaid  \n```\n\n------ \n\n## References\n\n[AA1] Anton Antonov, et al.,\n[\"Find programmatically all classes, grammars, and roles in a Raku package\"](https://stackoverflow.com/q/68622047/14163984),\n(2021),\n[StackOverflow](https://stackoverflow.com).\n\n[AA2] Anton Antonov,\n[\"Generating UML diagrams for Raku namespaces\"](https://community.wolfram.com/groups/-/m/t/2549055),\n(2022),\n[community.wolfram.com](https://community.wolfram.com).\n\n[AAp1] Anton Antonov,\n[\"UML Diagram Generation Mathematica package\"](https://github.com/antononcube/MathematicaForPrediction/blob/master/Misc/UMLDiagramGeneration.m),\n(2016),\n[MathematicaForPrediction at GitHub/antononcube](https://github.com/antononcube).\n\n[ES1] Eugene Steinberg and Vojtech Krasa, \n[PlantUML integration IntelliJ IDEA plugin](https://plugins.jetbrains.com/plugin/7017-plantuml-integration), \n[JetBrains Plugins Marketplace](https://plugins.jetbrains.com).\n\n[GV1] [graphviz.org](https://graphviz.org).\n\n[PUML1] [plantuml.com](https://plantuml.com).\n\n[PUML2] [PlantUML online demo server](http://www.plantuml.com/plantuml).\n\n[UMLD1] [uml-diagrams.org](https://www.uml-diagrams.org).\n\n[WK1] Wikipedia entry, [\"Graphviz\"](https://en.wikipedia.org/wiki/Graphviz).\n\n[WK2] Wikipedia entry, [\"PlantUML\"](https://en.wikipedia.org/wiki/PlantUML).\n\n[WK3] Wikipedia entry, [\"Unified Modeling Language\"](https://en.wikipedia.org/wiki/Unified_Modeling_Language).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantononcube%2Fraku-uml-translators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantononcube%2Fraku-uml-translators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantononcube%2Fraku-uml-translators/lists"}