从XMI生成类图 [英] Generation of Class Diagram from XMI

查看:143
本文介绍了从XMI生成类图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况


我有一个PHP项目,它遵循。下载并安装。导入XMI时有些麻烦(必须将版本显式更改为1)。失败(请参阅尝试3)。


结论


这看似微不足道的任务,但如此困难。我是否必须遍历整个列表,尝试每个应用程序?

解决方案

执行此操作的方法之一是采用我的尝试2或4中所示的方法,
然后按照给出的说明进行操作< a href = https://stackoverflow.com/a/12594305/565229>此处(适用于Enterprise Architect)。



要生成使用PHP_UML的XMI 文件:




  • 按照这些说明进行操作,如果尚未安装PEAR,如果您单独安装了PHP。

  • 如果您在Windows下使用XAMPP(以我​​为例),请遵循这些说明将PEAR添加到他 PATH环境变量,因此可以通过 CMD ,并了解如何在* nix和Windows系统中安装软件包。 提示:PATH分隔符为; (分号)(适用于Windows)。

  • 在某些设置中,例如是否使用 XAMPP ,您>可能需要激活XSL扩展名。在这种情况下,请打开您的 php.ini 文件(您可能需要管理员权限才能保存它),然后取消注释或在动态扩展部分的底部添加以下行: extension = php_xsl.dll

  • 使用 pear安装 PHP_UML 软件包梨安装PHP_UML

  • 执行 phpuml -f xmi -o name_of_output_dir 。如果计划以后将生成的XMI与某些较旧的程序一起使用,则可能需要通过添加 -x 1 来指定XMI版本1。

  • 对我来说,这无法立即生效,表示我缺少../../data/xmlschema.rng。不知道为什么会这样,但是如果遇到类似的错误,可以从此处并将其放入数据文件夹位于您的PEAR目录下。



此XMI以后可与企业架构师 ArgoUML 其他XMI工具


Situation

I have a PHP project with lots of classes with lots of relationships in lots of folders following the Zend Naming Convention.

I use the NetBeans IDE 7.1. I work under Windows 7.

Goal

I need to see a graphical representation of the class relationships, possibly in varying depths and varying degrees of complexity. Also, it would be nice if the classes in the diagram are clickable. I do not necessarily need to generate documentation.

Attempts

1. Within NetBeans

NetBeans is an awesome IDE with lots of features. In fact, it recognizes class dependencies, and it would be wise to assume that it has some sort of way to graphically view this relationship, natively, or through a plugin. Such a plugin exists, but is for version 5.5. I have 7.1, and it's not compatible. Fail.

2. Enterprise Architect

A simple google search brings up Enterprise Architect as an all-capable, completely comprehensive tool for solving such problems. So, I download and install. I'm not going to go to the detail of how I couldn't understand how to do anything, and how the tutorials are bragging about what the software can do, but rarely say how.

So, I imported the source. It generated many different classes and parsed all the members. Also, it generated the class diagrams. "Perfect!", I though, but alas. The class diagrams only show relationships between classes, the files of which were in the same source folder, despite the relationships being visibly registered in the classes' properties. A search for documentation on how I could merge all these diagrams into one was unsuccessful. Fail.

NOTE: I created a parallel thread before this one here.

3. PHP_UML

Found this PEAR tool. Looked good. So, I read through documentation on how to install it for my setup from various sources, and ran it. First, I used the html output format. Great! Lots of documentation with an index, bla bla bla. However, the best it could do in the direction I want was this: Needless to say, I guess, that this is a very poor, super simplified version of what I actually need. Conclusion: fail.

4. Enterprise Architect + PHP_UML

However, PHP_UML can also generate XMI. Wow. Very nice. I can store my relationships and view them in different ways and exchange with other people.

So, I imported it into Enterprise Architect. Result: same as before with Enterprise Architect alone, only no class diagrams. Just the classes. As far as I've read about it, I can now manually create the relationships. Epic fail.

5. ArgoUML + PHP_UML

Somewhere through my search for solution I stumbled upon someone's comment that said they use ArgoUML. Downloaded and installed. XMI imported with some hassle (had to change version explicitly to 1). Fail (see Attempt 3).

Conclusion

Such a seemingly trivial task, and yet, so difficult. Do I have to go through this whole list, trying out each application?

解决方案

One of the ways to do this would be to take the approach illustrated in my attempt 2 or 4, and then follow instructions given here for Enterprise Architect.

To generate an XMI file using PHP_UML:

  • Follow these instructions to install PEAR if not installed already, if you have PHP installed separately.
  • If you are using XAMPP under Windows (my case), follow these instructions to add PEAR to the PATH env variable and thus make PEAR available through CMD, and to learn how to install packages in both *nix and Windows systems. Hint: the PATH separator is ";" (semicolon) for Windows.
  • In some setups, like if using XAMPP, you may need to activate the XSL extension. In this case, open your php.ini file (you may need Administrator privileges to save it), and uncomment or add the following line to the bottom of the "Dynamic Extensions" section: extension=php_xsl.dll.
  • Install the PHP_UML package with pear install PHP_UML.
  • Execute phpuml -f xmi -o name_of_output_dir. If you're planning to use the generated XMI with some older programs later, you may need to specify XMI version 1 by adding -x 1.
  • For me, this did not work immediately, saying that I am missing ../../data/xmlschema.rng. Not sure why this happened, but if you get a similar error, you can download it from here and place it into the data folder right under your PEAR directory.

This XMI can later be used with Enterprise Architect, ArgoUML and other XMI tools.

这篇关于从XMI生成类图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆