Version controlled meta information such as tags and filters in EA - enterprise-architect

The goal is to have a fully version controlled EA model with the UML/SysML/... content aswell as metainformation like tags (inluding enum type specification) or configured filters.
Using the CVS-integration with SVN its easily possible to synchronize the general model data within the team. Tags can be defined by a developer as a enum with the valid values by adding the following snippet to "UML Typed" -> "Tagged Values Types":
Type=Enum;
Values=A, B, C;
I expect EA to synchronize the Tags enum definition using the VCS once created or after the first usage. However, EA seems to only sync the tags that have been applied to model elements without any meta information like enum-definitions or descriptions. I can confirm that the defined tag gets saved inside the "local model"-File of the EA-Project and is not saved in some user-only directory.
One possible solution I found is using the "Export/Import Reference Data" function of EA that is described here and to sync the data in a separate repository. It's a really clunky approach including several manual steps that can lead to faults - such as forgetting about exporting after a change of the tagged value types.
Is there a better solution that I just missed?

With the version control integration you are storing package information into an XMI file and upload that to the version control system (SVN in your case).
The tagged values definition is meta- information that is not stored in that package, and thus not part of the XMI file that is uploaded to SVN.
The best way to deal with things like this is to add tagged values to stereotypes in a UML profile, that is packaged into an MDG file.
MDG files can be considered as packaged meta-models. You can store the MDG file in your version control system as well, and instruct users to use the latest MDG file when using EA.

Related

VSCode ANTLR4 Plugin: Export Call Graph to JSON?

The vscode-antlr4 plugin for VisualStudio Code has a nice call-graph feature which visualizes (as a dendrogram) how grammar (and lexer) rules interact. You can save the graphic as SVG.
Is there a way to export the information as JSON? I wouldn't mind going into the plugin's code to find a way to do it.
My aim is to create reachability graphs for individual rules, i.e. graphs that show from which other rules a particular rule can be reached (transitively). The "calls" and "is-called" information from the call-graph feature would be a nice starting point.
The data for the call graph comes from a source context instance (for each grammar file there's a single source context to manage all details for it). See the function getReferenceGraph, which collects the relations into a map object. You can use that object to generate a JSON object from it. Or you create another function, taking this one as template, to generate the JSON directly, without the overhead required for the UI.

Custom XML formatter for Eclipse

Is it possible to define a new XML formatter in an Eclipse plugin? I have some XML files that must follow specific formatting rules, but see how way of plugging in to the formatter engine.
I can tie this formatter to files that are part of a project with a specific facet.
For context, I am maintaining the Sling IDE Tooling for Eclipse, and part of that application is concerned with synchronising local state with a remote JCR repository.
The synchronisation is based on XML files and folders stored on disk, following a well defined format - FileVault DocView. These XML files can contain metadata attached to files and folders, but also arbitrary hierarchical data.
The CLI tool that is used as an alternative to the IDE tooling and almost always in production follows strict set of rules regarding indentation, XML attribute ordering, etc and also rewrites files when pushing them to the repository.
I would like to follow this model and allow the users of the IDE to format the XML files following the exact same preset. The formatting model is actually quite simple, shown below:
format = new OutputFormat("xml", "UTF-8", true);
format.setIndent(4);
format.setLineWidth(0);
format.setBreakEachAttribute(true);
format.setSortAttributeNamesBy(AttributeNameComparator.INSTANCE);
The name comparator is also quite simple, sorting xmlns instructions first, then the namespaced properties, and then the other properties.
This was requested in https://bugs.eclipse.org/460055 , but not implemented.

Opening Anylogic model in an older version

I have created a model in Anylogic 8.3. Now I want to open this model on a different computer that contains an older version, Anylogic 8.2.3. This, however, does not work, as I am prompted with the fact that the model is created in a newer Anylogic version.
Is there a way to circumvent this issue?
I am not a system admin on the computer with the older Anylogic, nor does our license cover updating to a newer version of Anylogic (expired in december 2018).
You can easily do that by opening the .alp file of your model with Notepad or a similar text editor. Then:
Get your actual AnyLogic build version (open AnyLogic, click "Help" and then "About". You can find your build-version as in the image below
replace AnyLogicVersion and AlpVersion with your required values, e.g. something like AnyLogicVersion="8.2.3.xxxxxxxx" and AlpVersion="8.2.3"
save the file and open with AnyLogic 8.2.3
(Note that if you want to open a model in AnyLogic 7 that was developed in AnyLogic 8, you would also need to remove the entire <RunConfiguration> section. But this is not relevant in your case.)
I think it's only possible to go back to an earlier AnyLogicVersion by hacking the .alp if the AlpVersion is the same, because it denotes the structure of the XML. I don't have an 8.4 file handy, but I have, for example, an 8.5.1 and an 8.2.4, and the AlpVersion is 8.4.9 for AnyLogicVersion 8.5.1, but 8.0.4 for AnyLogicVersion 8.2.4.
If the XML structure is different, the newer version of AnyLogic will likely be unable to load the file. Looking at the two examples of essentially the same model that I've detailed above, there are readily apparent structural differences in the ActiveObjectClass, for example. If there are not too many structural differences, you could try replicating them. I've succeeded in doing that manually at least once, that I can recall.
There are a variety of online tools that allow you to compare the XML schemas of two XML documents, from which you will be able to judge whether a manual hack is feasible.

Enterprise Architect: Change diagram type (MetaType) by script

i have to change the diagram type of a lot of diagrams within my Enterprise Architect model. The change can be made manually using following option (that works as expected):
Select diagram - Diagram - Advanced - Change Type...
As I have to change a lot of diagrams I have created a script which searches for all concerned diagrams and change the type automatically. I wrote already a lot of JScript EA scripts for changing some modeling elements. Unfortunately, this feature seems not be available over the scripting interface.
I have to change the "MetaType" of the the diagram object. But this is read-only (see http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/diagram2.html). Therefore, I got an error.
var currentDiagram as EA.Diagram
currentDiagram = theDiagram
currentDiagram.MetaType = MY_DIAGRAM_METATYPE // ERROR
In the next step I searched for appropriate functionalities in the Repository interface (http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/repository3.html) and in the project interface. But I found nothing appropiate.
I am using Enterprise Architect 12.0.1215 and I used JScript.
Has anyone already tried this by script?
Have I missed something?
Is there another approach to achieve the diagram type change by script?
Thanks in advance!
You have to do that in two steps (if you change to different MDG diagram types). E.g. to change a Class diagram to a BPMN2.0::BPEL you first change Diagram_Type from Logical to Analysis. Additionally you need to add MDGDgm=BPMN2.0::BPEL; to StyleEx. In case your old diagram is from another MDG you need to modify the existing MDGDgm attribute in StyleEx.
As Uffe noted, the diagram type in the API is r/o. So if you need to change that you would need to do something like
Repository.Execute("UPDATE t_diagram SET Diagram_Type='Analysis' WHERE Diagram_ID=<theId>")
where <theId> would be the correct diagram ID.

fUML, Papyrus and Basic Operations

We aim to execute fUML specifications written in Papyrus using the fUML reference implementation. This has not been challenging since an UML model containing a single Class diagram and one or more Activity Diagrams can be directly executed by calling the fUML constructor:
new Fuml(File);
However, it is difficult to specify complex behaviors without basic Integer operations. For example, 'equals', 'greater'...
I am aware that there is some library of such functions that can be selected using OpaqueBehaviors. Therefore, my question is: where and how can those such "basic operations" be found?
Sorry, this question was just pointed out to me recently. But, in case you haven't figured it out yet, I do have an answer for you.
The library you are looking for is the Foundational Model Library, which contains packages such as IntegerFunctions, BooleanFunctions, etc. The normative fUML specification includes a standard XMI file for this library (at http://www.omg.org/spec/FUML/20121019/fUML_Library.xmi, for fUML 1.1). However, to use the library in Papyrus, you need an Eclipse .uml version.
If you want, you can convert the normative XMI yourself: Download the file and open it in the Eclipse UML Editor (not Papyrus). Select File > Save As and save the file with a .uml extension (fUML_Library.uml). You should then be able to import this .uml file into Papyrus and reference the functions in it from your activity models. As long as you maintain the normative element IDs from the original XMI file, the reference implementation will know that these are standard library functions, for which it has built-in implementations.
However, there is actually a .uml version of this library already available for Papyrus. It is included with the additional Moka Model Execution component for Papyrus. If you install this component, then the fUML model library becomes available as a "registered library" that you can import into your model and use as above.
Note that Moka also includes an fUML execution engine that you can use to execute activity models directly within Papyrus (see https://wiki.eclipse.org/Papyrus/UserGuide/ModelExecution). However, any models created in Papyrus that can be executed with Moka can also be executed externally from Papyrus using the reference implementation, just as you have done before.