Checking Relationship Consistency and Class Redundancy in a Class Diagram under Model-Driven Engineering

Liang Huang, Yucong Duan, Honghao Gao, Hui Li, Caimao Li, Zhiyang LinInternational Journal of Hybrid Information Technology 2016 · DOI

Abstract

Methods of checking various relationship problems. We address the redundancy of a class's operations and attributes. We identify a large range of the problems for class diagram. Our research is based on the relationship abstraction rules.

Introduction

In Model-Driven Engineering (MDE), the UML class diagram serves as the primary source of truth from which code is generated. As software systems grow in scale and complexity, these diagrams become massive and difficult to manage manually. A major challenge in this environment is maintaining relationship consistency: ensuring that multiple paths between classes do not imply conflicting logical relationships. Additionally, developers often introduce class redundancy by repeating attributes and operations across similar classes, violating the "Don't Repeat Yourself" (DRY) principle. This paper introduces a formal framework to automatically detect these inconsistencies and redundancies using an abstraction-based approach.

Methodology

The proposed framework utilizes an automated workflow to analyze and refine UML models through path reduction and rule-based logic.

Workflow for Consistency Checking

The process begins with Circulation Finding, using a Depth-First Search (DFS) algorithm to identify all loops or multiple paths between any two classes. These "circulations" are the primary areas where logical conflicts occur. Once a circulation is identified, the system abstracts the paths to determine if they yield the same logical result.

Workflow for checking relationship consistency in UML diagrams.

If the results differ, the system evaluates whether the discrepancy is caused by the execution sequence or a fundamental model error. To handle long paths, the authors use an automaton to iteratively apply rules until the path is reduced to a single relationship.

Relationship Abstraction Rules

The core of the methodology is a "grammar" consisting of 49 abstraction rules. These rules define how complex paths can be reduced to a single direct relationship. For instance, a chain of two "Generalization" relationships abstracts into a single "Generalization."

The 49 relationship abstraction rules with associated reliability scores.

Of these rules, 42 focus on relationship abstraction (e.g., Generalization + Generalization = Generalization), while 7 address classifier abstraction (grouping classes into packages). To resolve ambiguities, each rule is assigned a reliability score. When multiple abstraction paths are possible, the algorithm selects the path with the highest cumulative reliability to establish the "true" relationship.

Redundancy Analysis

Beyond consistency, the framework identifies class redundancy by comparing attributes (e.g., name, id) and operations (e.g., setWidth()) across different classes. By identifying these commonalities, the system can suggest the creation of a common parent class, effectively refactoring the model. For example, identifying shared operations across classes like Ellipse and Polygon allows for the automatic abstraction of a Shape superclass, significantly simplifying the diagram.

Evaluation and Insights

The framework was evaluated using a comprehensive set of 343 synthetic "scene types" representing all possible combinations of basic UML relationships. Case studies involving an ATM System model and a partial model of Amazon Web Services (AWS) were also conducted to demonstrate real-world utility.

A key finding was the stability of the rule set. In 74% of the test scenes, the sequence of rule application did not change the final result. In the remaining 26%, sequences were simply invalid rather than producing incorrect results, proving that the abstraction grammar is robust. Furthermore, the use of reliability scores proved effective in flagging redundant relationships in the AWS case study, where a path with 50% reliability was correctly identified as inferior to a 100% reliable alternative.

Conclusion and Future Work

This research demonstrates an effective automated approach to maintaining high-quality UML models. By focusing on circulations and applying a weighted rule-based grammar, the framework identifies logical conflicts and suggests refactors to eliminate redundancy. While the current focus is on consistency within a single class diagram, future work will expand this logic to check consistency between different types of diagrams, such as ensuring a Class Diagram matches a Sequence Diagram or a State Machine.

Summary updated

Abstract

methods of checking various relationship problems. We address the redundancy of a class's operations and attributes. We identify a large range of the problems for class diagram. Our research is based on the relationship abstraction rules.
BibTeX
@article{huang2016checking,
  author = {Liang Huang and Yucong Duan and Honghao Gao and Hui Li and Caimao Li and Zhiyang Lin},
  title = {{Checking Relationship Consistency and Class Redundancy in a Class Diagram under Model-Driven Engineering}},
  journal = {International Journal of Hybrid Information Technology},
  year = {2016},
  doi = {10.14257/ijhit.2016.9.10.19},
}
Figure