Visual Paradigm set attribute to final in class diagram - class-diagram

Hello I want to draw a class diagram with Visual Paradigm and I have to set my attributes to "final".
I tried the following Syntax: -final id : UUID
When I generate a getter it looks like this: +getFinal id() : UUID
I expected +getId() : UUID

UML does not specify what 'final' means. That is a Java keyword.
Place a readOnly modifier on your property.
In order for that to show up in the diagram, you must right click the diagram, go Presentation Options, go Attribute Display Options and tick Show Property Modifiers.

Related

How do you show encapsulation in UML class diagram?

My question is pretty straightforward. How do I represent or show encapsulation when modelling a UML class diagram? Inheritance is modelled using the arrows and an abstract class is shown by having the class name in italics or between the following arrows as shown, << Animals >> but what do you do for encapsulation?
Each feature of a class can have a visibility. Private features make it possible to encapsulate the state of the instance. The notation for a private feature is a - sign in front of its name (+ for public, # for protected and ~ for package visibility).
PS: An abstract class is not shown with "arrows". Instead it is shown with the word {abstract} in curly brackets (or as you correctly state by writing the name in italics).
PPS: "Arrows" (<<...>>) are not UML notation. You probably mean guillemets: «...». They are used to annotate language elements, that don't have a distinct notation, like DataTypes. In this case the keyword «dataType» is shown above the name. They could also be the notation for a property of a language element. For example an Activity with isSingleExecution=true will show the keyword «singleExecution». Why this case is not expressed with curly brackets, as in the case of isAbstract=true is shrouded in mystery. Finally they are used for user defined language elements (=stereotypes). Please note, that such elements are one level above the model elements, i.e. on the language level (also called meta level). Therefore, they don't express anything on the level of the modeled system. A stereotype «Animals» defines a new language element, but not an animal.

Saving Entity does not update class-hierachy labels correctly

I have an abstract superclass Report and two Subclasses SimpleReport and ExtendedReport, which I want to persist in my database.
If a SimpleReport is created, it has the labels "Report" and "SimpleReport" attached to it, as expected.
A user can modify such a SimpleReport, which leads to the SimpleReport becoming an ExtendedReport.
If I now save this ExtendedReport (using the same ID as the SimpleReport, because I just want to update it) it has the labels "Report", "SimpleReport"and "ExtendedReport" attached to it.
IMHO the label "SimpleReport" should be removed on save. I`m currently deleting the wrong label using a cypher query after saving the updated report.
I´m asking if there is a better way to archive this, if may approach is wrong or if this is a bug in ogm?
The rules for labels are as follows:
any plain concrete class in the hierarchy generates a label by default
plain abstract class does not generate a label by default
plain interface does not generate a label by default
any class annotated with #NodeEntity or #NodeEntity(label="something") generates a label
empty or null labels must not be allowed
classes / hierarchies that are not to be persisted must be annotated with #Transient
Therefore if you remove abstract from your base class, or add a #NodeEntity annotation, you will see the results you expect.
Edit:
The OGM does not remove labels when a class is renamed. Any additional labels are left intact.
You can remove these manually using direct database access.
You can declare a field with the #Labels annotation to manage adding/removing additional labels from an entity.

Adding multiple domains to objectProperty in Protege 5

I have created an ontology using Protege 5-beta-17. In my ontology I have some classes:
Mountain, Lake, Location etc...
I also have an object property:
hasLocation.
For this object property I have set the range the "Location" class, and the domain
the "Mountain" and "Lake" classes.
When I try to view the ontology using the CMap tool it shows that only the
"Mountain" "hasLocation" "Location".
The "Lake" class is presented without the "hasLocation" object property.
Did I do something wrong? Ore do I have do something else in Protege?
I found out what the problem was.
When adding a domain/range to object property in protege you have to click the following buttons and select one of your classes:
If you want to add another domain/range you simply click one of the buttons again and add another class. If you are doing it like this your telling Protege that the domain/range of your object property is an INTERSECTION of two classes. This means that the individual that will take the domains/ranges place is an INSTANCE OF BOTH CLASSES and NOT EXCLUSIVELY OF ONE OF THEM.
This was my mistake. I was adding the classes to the domain in the wrong way.
So... The correct way for adding multiple distinct domains for an object property is the following:
Simply click the domain/range button again and select the "Class expression editor" tab:
And in the "Class expression editor" type in your classes like this: "ClassA or ClassB or ClassC or ...".
In my case it was "Mountain or Lake".
After that click "ok" and thats it.

IntelliJ IDEA: how to find all instance creation of a class?

abstract class Base {}
class A extends Base
class B extends Base
How do I find all places in the code that create Base? (that is, have either new A() or new B())
UPDATE
To make it clear, the above is just and example. I'm interested in a way of searching for object creation of any class, including 3rd party classes that I don't control.
Using Structural Search (Edit -> Find -> Search Structurally):
Create a template: new $Type$($P$)
Edit Type variable: type Base in the text field, check 'Apply constraint within type hierarchy', check 'This variable is target of the search'
Edit P variable: type .* in the text field, set Minimum count to 0, check Unlimited under Maximum count.
Voila!
IttayD if I have understood correctly your latest update, what I normally do (IntelliJ 9.0.4) if I have a similar need to yours is Right click on class name and do "Find Usages" and this will list results in the form of usage categories,
Variable declaration
New Instance creation, to name a few.
As far as I'm aware I do not think there is a specific option/selection choice to fulfill such a usage search check. Thanks
You can create empty default constructor of Base and press Ctrl+Alt+H (Hierarchy Callers). Then you'll see all creations of A and B in as a tree.

Reusing property editors for Blend 4

I have a custom silverlight control, which exposes a property with DataGridLength type. Now I want that property to have the same editor as a common DataGridColumn's Width property, with the combobox and everything, like this:
instead, I only get a simple TextBox, with "Auto" written in, with no way to set to SizeToCells and so on.
I assume I need a DesignTime attribute, but none of the ones I found in ComponentModel namespace even came close...
I guess you just have to create an Enum with the all the values autorized (Pixels, SizeToCells, etc ...), you that Enum as the type of your property DataGridLength and then, in the code of your control, take the corresponding action regarding the value sent.