Key Takeaways from This Article
– Learn how to analyze Astah models using AI
– Export models to XML or PlantUML for AI integration
– See a real-world example of AI-driven class diagram analysis
Introduction
Hello everyone!
As AI technologies continue to evolve rapidly, software modeling practices are also entering a new era. In this blog series, we’ll explore the exciting potential of integrating Astah – our modeling tool – with AI.
In this first article, we’ll focus on class diagram analysis. You’ll learn how to provide Astah models to AI, what kinds of insights AI can deliver, and see an example of AI in action.
How to Provide Astah Models to AI
Option 1: Export as XML
Astah allows you to export your models in XML format, making it easier for AI to parse and analyze.
1. Steps to export
- Open your project in Astah
- Go to the menu and select: Tools → XML Input & Output → Save as XML Project

- Choose a file name and destination, then export.
Note: XML export is available only in Astah Professional.
▶ Try Astah Professional for free
Option 2: Use PlantUML Code
You can also use PlantUML code by exporting Astah diagram to PlantUML code via PlantUML Plug-in.
- Install the PlantUML Plugin in Astah
- Convert your Class Diagram to PlantUML code

2. Tips for Effective AI Interaction
When providing model data to AI tools like ChatGPT, Gemini, or Claude, consider the following:
■ Mind the file size
Large models may exceed the AI’s context limits. Consider creating a trimmed-down version of the project focused on the key components for analysis.
■ Define a clear role and task for the AI
Give the AI an explicit persona and purpose, like:
“You are a skilled UML expert specializing in XML-based models. Analyze the UML class diagram exported from Astah and identify structural flaws and improvement areas.”
■ Ask concrete questions
Avoid vague prompts like “Analyze this.” Instead, ask:
- “What design flaws can you identify in this class structure?”
- “What improvements would you recommend for these classes?”
Such specific questions yield far better insights.
Hands-On: Class Diagram Analysis by AI
Let’s walk through a real-world example.
We analyzed a simple book management system class diagram using Claude 4 Sonnet. Below is a summary of its insights and suggestions. The output was lightly edited for readability.
Prompt Given to the AI
You are a skilled UML expert specializing in UML models described in XML format. You have a deep understanding of UML XMI and can accurately interpret relationships between model elements.
Analyze the class diagram contained within the model exported from the Astah modeling tool.
Questions
Q1: What are the design issues in this class diagram?
Looking at this class diagram, there are several significant design issues that would impact both implementation and maintainability:
▶ Major Issues Identified
- Improper Association Design Between Classes
• Issue: In the current design, the User class holds a borrowHistory attribute (a List), but there is no explicit association defined between User and BorrowRecord.
Even though BorrowRecord contains a userId, no association line is shown between the User and BorrowRecord classes in the diagram.
• Suggested Fix: Explicitly define a one-to-many association between User and BorrowRecord.
⸻
- Missing Association Between Book and BorrowRecord
• Issue: Although BorrowRecord has a bookId, the association between Book and BorrowRecord is not defined. This makes it unclear which book is linked to which borrowing record.
• Suggested Fix: Define a one-to-many association between Book and BorrowRecord.
⸻
- Book Availability State Not Managed
• Issue: While there is an isAvailable() method, there is no attribute (e.g., isAvailable or status) representing the book’s loan status. It’s unclear where the current lending state of a book is managed.
• Suggested Fix: Add an attribute in the Book class to manage its lending state.
⸻
- Inappropriate Use of Data Types
• Issue: Use of primitive types for identifiers – bookId and userId are defined as String, but it is generally more appropriate to use identifier-specific types such as Long or UUID.
In the XML, these are referenced with xmi.idref=”1p-be…”, but using String here is not ideal from a design perspective.
⸻
- Incomplete Business Logic
• No validation methods: No checking for duplicate users, books, etc.
• No loan limits: Users could theoretically borrow unlimited books
• No due date management: How are due dates calculated and enforced?
• No book reservation system: Common library requirement missing
⸻
- Ambiguous Method Return Types
• Issue: Unclear meaning of boolean return values – Methods like borrowBook() and returnBook() return a boolean, but the reason for failure (if any) is not communicated.
• No exception handling or error management strategy is in place.
⸻
- Improper Aggregation/Composition Design
• Issue: The relationships between Library and Book/User should clearly be defined as aggregation or composition.
• The current one-to-many relationship allows books and users to belong to multiple libraries, which may not be appropriate.
⸻
▶ Recommended Improvements
- Explicit Association Definitions: Clearly define all class associations.
- Improved State Management: Add a loan status attribute to the Book class.
- Enhanced Error Handling: Introduce exception classes or more detailed return types.
- Refined Data Types: Use appropriate identifier types.
- Clarified Business Rules: Reflect constraints and rules in the model.
Evaluation
The AI’s analysis goes beyond surface-level observations, highlighting essential issues in UML relationships, data types, and business logic consistency. It also provides practical suggestions, making it suitable for real-world application and discussion.
Q2: How should we extend the class diagram to add a reservation feature?
To add a reservation system, AI proposed the following structured enhancements:
Key Extensions for Reservation Feature
1. New Core Classes
Reservation Class
- Tracks individual book reservations with queue position
- Manages reservation lifecycle (active → fulfilled/cancelled/expired)
- Includes expiry dates and notification triggers
- Provides methods to check fulfillment eligibility
ReservationManager Class
- Centralized reservation business logic
- Handles queue management and position updates
- Processes expired reservations automatically
- Enforces reservation limits and policies
NotificationService Class
- Manages all reservation-related communications
- Sends confirmation, availability, and expiry notifications
- Decouples notification logic from core business logic
2. New Enumerations
ReservationStatus Enum
ACTIVE: Reservation is waiting in queueFULFILLED: Book became available and was borrowedCANCELLED: User cancelled the reservationEXPIRED: Reservation expired due to timeout
BookStatus Enum
AVAILABLE: Book can be borrowed immediatelyBORROWED: Book is currently checked outRESERVED: Book is available but has pending reservationsMAINTENANCE: Book is temporarily unavailable
3. Enhanced Existing Classes
Library Class Enhancements:
- Added
reservationscollection to track all reservations - New methods for reservation processing and queue management
- Enhanced book search and availability checking
Book Class Enhancements:
- Added
statusattribute for better state management - Added
currentBorrowerreference for direct relationship - New methods to check reservation eligibility
- Better encapsulation with proper getters/setters
User Class Enhancements:
- Added
activeReservationscollection - Contact information (
email,phone) for notifications - Reservation-specific methods (
reserveBook,cancelReservation) - Validation methods (
canReserve,hasMaxReservations)
BorrowRecord Class Improvements:
- Fixed to use proper object references instead of strings
- Added proper encapsulation with getters
- Enhanced with return tracking methods
4. Key Reservation Workflows
Making a Reservation:
- User requests to reserve a book
- System checks if user can reserve (not at limit, book is reservable)
- ReservationManager creates reservation with queue position
- NotificationService sends confirmation
Processing When Book Becomes Available:
- Book is returned or becomes available
- ReservationManager checks for active reservations
- First person in queue is notified
- Reservation marked as ready for fulfillment
- If not fulfilled within expiry period, moves to next in queue
Queue Management:
- Automatic queue position updates when reservations are cancelled
- FIFO (First In, First Out) processing
- Position tracking for user transparency
4. Business Rules Implemented
- Reservation Limits: Users can’t exceed maximum reservations
- Queue Priority: First-come, first-served reservation handling
- Expiry Management: Reservations expire if not acted upon
- Book State Management: Books can’t be reserved if not reservable
- Notification System: Users informed at key points in reservation lifecycle
5. Integration Points
With Existing Borrowing System:
- When a book is returned, reservation queue is checked first
- BorrowRecord creation can be triggered by reservation fulfillment
- Book availability depends on both current loans and active reservations
With User Management:
- User profiles enhanced with reservation history
- Contact information enables notification system
- Reservation limits prevent system abuse
This design provides a comprehensive reservation system that integrates seamlessly with the existing library management functionality while maintaining proper object-oriented principles and business logic separation.
Evaluation
The AI’s proposal covers more than just structural additions – it thoughtfully integrates rule constraints, and workflows. It serves as a strong foundation for real design discussions and system planning.
Tips for Practical Use
- Trim large XML files to relevant parts before providing them to AI if you use XML files
- Use specific, well-scoped prompts
- Treat AI suggestions as support, not a replacement for design expertise – final design decisions should be made by the designer
Want to Try Astah × AI Integration?
Try Astah Professional (Free Trial) – includes XML export.
Or if you’d like to use PlantUML Plugin:
We’re releasing a new version of Astah Professional with official AI integration via plugin. Stay tuned for updates!
If your license support period has expired, consider renewing it to access the latest features.
Coming Up Next
Did you enjoy Part1 of the Astah x AI Integration Series?
Let us know your thoughts and questions in the comments!
In Part2, we’ll explore AI-powered sequence diagram analysis and improvement strategies.
Ass you in the next post!
– Astah Team

One thought on “Astah x AI Integration – Part 1: Introduction to AI-Based Model Analysis (Class Diagram)”