Create a Class
Class
To create a class:
Right-click any package on the left side of the panel, or click the
+
near the name of your project.Under
Class view
, you'll see a list of class forms as well as a diagram view of your class. You can add tags, stereotypes, properties, constraints, qualified properties, and super types to your model.Click the + icon. Make sure the correct package (i.e. demo) is selected.
Click New class.
Let's create 2 classes. One that is called
Person
and another one that is calledFirm
.Studio displays a visualization of the class and a tabbed list of the possible model enrichments.
In the basic logical modeling, Account, Product, and Trade are classes.
Property
Class properties define attributes of a business concept. To create a property:
Property - primitive data type
Select the
Person
andFirm
class respectively.Go to the Properties tab and click the + icon.
Type in the name of your property and specify the data type and cardinality.
For our
Person
class, let's create a property calledfirstName
of typeString
with cardinality of 1. Let's add the propertyid
of typeString
with the cardinality of 1 in ourFirm
class.
Property - non-primitive data type
Create a relationship between the Person and Firm classes.
- Select the
Firm
class, - Create property with the following values:
- Name: employees
- Type: Person
- Cardinality: 0..
Derived property
To create a derived property:
Select the
Person
class.Go to the Derived properties tab and click the + icon.
Type in the name of your property and specify the data type and cardinality.
Type in the expression.
Let's add a derived property called
firstNameCount
using the following expression:$this.firstName->count()
.Select a return data type of
Integer
and cardinality of 1.Press F9 to compile the expression.
Quality control for properties
Type
COMING SOON
Multiplicity
COMING SOON
Enumeration
COMING SOON
Constraint
COMING SOON
Constraint
To add a constraint:
Select the
Person
class.Go to the Constraints tab and click the + icon.
Type in a name for the constraint and the expression.
Let's add a constraint called
firstNameNotEmpty
using the following expression:$this.firstName->isNotEmpty()
.Press F9 to compile the expression.
Model constraint feedback
When typing constraints and qualified properties, you will get immediate parsing feedback. You can compile your code by pressing F9
.