OntoUML / ontouml-vp-plugin

A plugin for Visual Paradigm to add support for OntoUML modeling and model intelligence services
Apache License 2.0
35 stars 15 forks source link

Fix stereotypes feature #125

Open claudenirmf opened 2 years ago

claudenirmf commented 2 years ago

This PR introduces the "Fix Stereotypes" feature, which runs through the model replacing stereotypes that are incorrect due to misspelling or version of OntoUML (mapping certain stereotypes to others of the current set). This feature also corrects the direction of associations in case their inversion can fix any inconsistencies.

Ideally this feature should be implemented in the backend (see issue #89), but this process would demand too much time, specially considering the inversion of association which may not yet be possible with the current deserialization.

Other minor fixes include the cleaing of bites of code and adjusting used icons.

This PR changes the plugin version to 0.5.4 and should be part of a new release.

claudenirmf commented 2 years ago

The mapping old of stereotypes is still being updated.

claudenirmf commented 2 years ago

The following mappings were added. Notice that comparissons are made with "normalized" stereotypes, all lowercase, no hyphens and no spaces.

classStereotypesMap.put("hou",Stereotype.TYPE);
classStereotypesMap.put("highordertype",Stereotype.TYPE);
classStereotypesMap.put("higherordertype",Stereotype.TYPE);
classStereotypesMap.put("powertype",Stereotype.TYPE);
classStereotypesMap.put("universal",Stereotype.TYPE);
classStereotypesMap.put("collectivekind",Stereotype.COLLECTIVE);
classStereotypesMap.put("quantitykind",Stereotype.QUANTITY);
classStereotypesMap.put("relatorkind",Stereotype.RELATOR);
classStereotypesMap.put("qualitykind",Stereotype.QUALITY);
classStereotypesMap.put("modekind",Stereotype.MODE);
associationStereotypesMap.put("characterizes",Stereotype.CHARACTERIZATION);
associationStereotypesMap.put("externaldependenceon",Stereotype.EXTERNAL_DEPENDENCE);
associationStereotypesMap.put("externallydepends",Stereotype.EXTERNAL_DEPENDENCE);
associationStereotypesMap.put("externallydependson",Stereotype.EXTERNAL_DEPENDENCE);
associationStereotypesMap.put("mediates",Stereotype.MEDIATION);
associationStereotypesMap.put("iof",Stereotype.INSTANTIATION);
associationStereotypesMap.put("instanceof",Stereotype.INSTANTIATION);
associationStereotypesMap.put("terminates",Stereotype.TERMINATION);
associationStereotypesMap.put("participates",Stereotype.PARTICIPATION);
associationStereotypesMap.put("historicallydepends",Stereotype.HISTORICAL_DEPENDENCE);
associationStereotypesMap.put("creates",Stereotype.CREATION);
associationStereotypesMap.put("manifests",Stereotype.MANIFESTATION);
claudenirmf commented 2 years ago

To ease the testing process the "Reload Pluginn" button has a special feature temporarily attached to it. Select some class or association on the diagram and click on "Reload Plugin" to enter a custom stereotype it should have. This avoids having to use the complex menus necessary to add new stereotypes. If no stereotype is provided, the plugin is reloaded as normal.

Screen Shot 2022-01-07 at 02 28 34
pedropaulofb commented 2 years ago

The RSRO [1] and the ROoST [2] ontologies, which are part of the SEON [3] ontology, use the <<2ndOT>> stereotype. Maybe this stereotype could be also mapped to \<<type>>.

[1] https://dev.nemo.inf.ufes.br/seon/RSRO.html [2] https://dev.nemo.inf.ufes.br/seon/ROoST.html [3] https://dev.nemo.inf.ufes.br/seon/

pedropaulofb commented 2 years ago

In models with many diagrams the fix stereotypes process can take some time (e.g., the ANTT ontology took 20 seconds). Is it feasible to include a throbbed (aka "loading icon") so the user can be sure that the action is being performed?

claudenirmf commented 2 years ago

Note:

pedropaulofb commented 2 years ago

@claudenirmf , please include an additional correction:

This situation was found in the ANTT ontology.

claudenirmf commented 2 years ago

@pedropaulofb I didn't understand your request

pedropaulofb commented 2 years ago

I'm sorry, I haven't noticed that the terms were not inside the <> (the GitHub message syntax changed what I wrote).

My request was to map the term "enum" to "enumeration".

pedropaulofb commented 2 years ago

@claudenirmf, can you please include a feature for:

  1. checking if any diagram has an invalid character according to the Windows or Linux file systems, and
  2. if they have, I recommend substituting them for a "-"

This prevents the generation of files (e.g., exported images) with invalid filenames.

The characters that could be substituted are:

\< (less than) > (greater than) : (colon - sometimes works, but is actually NTFS Alternate Data Streams) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) * (asterisk)

Thank you in advance.

pedropaulofb commented 1 year ago

@claudenir, I noticed another correction to be added to this feature. Can you please check https://github.com/unibz-core/ontouml-models/issues/265?