Darius Šilingas Principal MagicDraw UML No Magic EuropeĢ About MagicDraw UML A visual UML modeling editor Domain-specific language (DSL) engine Roundtrip code engineering g for Java, C++, C#, Modeling teamwork control system Model documentation and report generation tool A modeling environment and model repository for Enterprise Architecture and Model-Driven Architecture paradigm Model validation engine using Dresden OCL Toolkit Developed since 1998 second oldest UML tool in the market! Sold in >70 countries, used in different business domains Widely regarded as the most standard-compliant UML tool 2ģ Disclaimer I use term model validation because it is used in MagicDraw user interface and documentation manuals In precise computer science terminology, I will discuss model verification since it is based on precisely defined rules Validate Verify 3Ĥ Model Validation: Correctness and Completeness Modeling like programming is an error-prone process A user model can be either incorrect (it breaks some rules) orincomplete (it lacks some required information) Rules defined in UML specification are automated in MagicDraw However, a specific modeling method typically implies additional rules Restriction to single generalization for classes Compulsory role names on navigable association ends Each use case must be documented with owned comment MagicDraw provides a way to define validation rules and validate models Validation rules can be specified on OCL 2.0 or Java 4ĥ MagicDraw Validation Profile > Validation Profile A special validation suite that is always active in the background Provides grouping for related validation rules so that they can be invoked together > validationsuite > validationrule abbreviation : String errormessage : String severity : SeverityKind = error implementation : String > activevalidationsuite > SeverityKind debug info warning error fatal Provides rule specification, against which model must to be checked Defines validation error significance levels 5Ħ Validation Rule Properties > Constraint constrainedelement : Element specification : ValueSpecification Defines meta-class, class or stereotype for which rule is applied Defines invariant specification in OCL 2 > validationrule abbreviation : String errormessage : String severity : SeverityKind = error implementation : String Attributes for displaying and filtering validation errors A special attribute for indicating operation or class in case the rule is specified in Java 6ħ Validation Suite vs. Override the method DefaultValidationRuleImpl.1 Applying OCL for Model Validation in MagicDraw UML Dr.Create a Java class that extends the .DefaultValidationRuleImpl class.Enter the OCL2.0 expression as a body of the specification.Specify the specification language OCL2.0.Set the severity level, error message, and abbreviation.Set the stereotype «UML Standard Profile::Validation Profile::validationRule» for the validation rule.How we can fix this problem and inform the modeling tool to execute the validation rule only on the class property name change: The problem is that such validation rule actually is interested in a class property name value change but it will be executed on every property value of a class change. This can be done by creating the OCL2.0 validation rule and specifying the OLC2.0 expression: name ‘’ For example, we want to check whether all classes have names. In order to avoid degradation of the performance you can create a binary validation rule that uses the OCL2.0 expression to validate model elements but also provides additional information for the modeling tool that allows to optimize triggering of executing after model elements change. Executing of the validation rule might be triggered even if no properties important to the validation rule actually changed and this can slow down the active validating speed. In this case the validation rule will be executed on any change of constrained elements that are from the validation scope. The OCL2.0 validation rule can be used in an active validation suite.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |