使用 xsl 转换将 UML 图转换为规范 Z

发布于 2024-08-29 18:20:35 字数 192 浏览 7 评论 0原文

我正在尝试将一些 uml 图(singleton、AbstractFactory ...)转换为 Z 规范,首先我使用 starUML 将我的 uml 图转换为 xml 文件,然后 我使用 xsl 程序和 saxon 将我的 xml 文件转换为 .tex(代表 Z),但它不起作用。 如果有人知道如何编写 xsl 程序(也许只是步骤),那就太好了。

谢谢

I'm trying to transform some uml diagrams (of singleton , AbstractFactory ...) to Z specification , first i transformed my uml diagram to an xml file using starUML then
i used an xsl program and saxon to transform my xml file to .tex( for Z ) , but it didnt work .
if someone has an idea about how the xsl program should be written (just maybe the steps) that will be great.

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若无相欠,怎会相见 2024-09-05 18:20:35

我想说,这通常是一个非常糟糕的主意。有许多不同的格式用于存储 UML。 XMI 是一个标准,但是至少有三个不同的版本,而且它们相当复杂。使用 XSLT 将 XML 转换为 TeX 肯定也是一个很大的障碍,特别是当您试图获得 Z 规范时,这些规范是函数式和过程式的,而 UML 是基于面向对象编程的。
我认为它们可能是实现你想要的更好的方法。以 Maude for Eclipse 为例,它可以从基于 EMF(Eclipse 建模框架)的模型生成 Maude 规范(代数数据类型规范),该模型也可以是 Eclipse 工具中的 UML2。

I would say, this is a generally a very bad idea. There are many different formats for storing UML. XMI is a standard, however there are afaik at least three different versions and they are quite complex. Transforming XML to TeX using XSLT must be as well quite a big hurdle, especially when you are trying to get Z specifications, which are afaik functional and procedural and UML is based on object oriented programming.
I think they might be a better way to achieve what you want. Take for example Maude for Eclipse, which can generate Maude specifications (algebraic data type specifications) from EMF (Eclipse Modeling Framework) based models, which can be also UML2 as found in Eclipse tools.

北渚 2024-09-05 18:20:35

与其尝试编写 XSLT 转换,不如编写模型到文本转换要好得多。给定表示为 UML 元模型(一种 AST)实例的 UML 模型,您可以编写一个模型到文本转换来遍历 UML 模型并生成相应的文本。有几个 Eclipse 项目用于此目的。

另一个解决方案(更简洁但也更复杂)是定义 Z 的元模型并编写一个模型到两个元模型之间的模型转换。

Instead of trying to write a XSLT transformation, it would be much better to write a model to text transformation. Given the UML model represented as an instance of the UML metamodel (kind of a AST) you could write an Model to text transformation that traverses the UML model and generates the corresponding text. There are several Eclipse projects for this.

Another solution (neater but also more complex) would be to define the metamodel of Z and write a model to model transformation between both metamodels.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文