Creating and Deleting Martini Data Models
Overview
Martini data models define the structure and properties of your application data, serving as blueprints for JSON, XML, and other data formats. You can create models from scratch using the Data Model wizard, generate them automatically from existing data sources like JSON or XML, or copy existing models to save time.
What You Will Learn
- How to create data models using the Data Model wizard
- How to generate models from JSON, XML, YAML, and schema sources
- How to copy existing models to new locations
- How to safely delete models while checking for active references
When To Use This
- Use data model creation when you need to define structured data for APIs, database operations, or data transformations
- Use model generation from sources when you have existing JSON, XML, or YAML data that you want to convert into reusable Martini data structures
- Use model deletion when removing unused models or refactoring your application architecture
Prerequisites
- Martini Designer installed and running
- Create a Martini Package
- Basic understanding of JSON, XML, or YAML data formats (for source-based model creation)
Creating Martini Data Models
Creating data models provides the foundation for structured data handling in your Martini applications. You can create models through direct wizard access or by copying existing models to new locations.
Getting Started with Data Model Creation
Create a basic data model using the simplest method — the Data Model wizard:
- Click the Open Wizard button in the toolbar
- Select Data Model from the dropdown menu
- Choose your target Location (must be within a
Logicdirectory - click Browse to select or create directories) - Enter a Name for your model (e.g.,
UserProfile) - Keep Source set to None for a blank model
- Click Create
Expected result: A new data model file opens in the editor, ready for you to add or modify properties using the Data Model Editor toolbar.
Data Model Creation Methods
Learn about all available approaches for creating data models in Martini, from simple copying to wizard-based generation from various data sources.
Copy and Paste
The fastest way to create a model when you have an existing template:
- Navigate to the source model in the Navigator view
- Right-click the model and select Copy
- Navigate to your target
Logicdirectory (within any Martini package exceptcore) - Right-click and select Paste
- Rename the copied model as needed
Data Model Wizard Access Points
Access the Data Model wizard through multiple entry points:
- Toolbar: Click Open Wizard → Data Model
- Keyboard Shortcut: Ctrl + Alt + N → M (Windows/Linux) or Cmd + Alt + N → M (macOS)
- Navigator View Context Menu: Right-click in blank space or on a Martini package/
Logicdirectory → New → Data Model
Data Model Wizard Configuration
Configure your data model creation through the wizard's three main input fields that control where, what, and how your model is created.
| Field | Purpose | Options |
|---|---|---|
| Location | Specify the save location within Logic directory | Click Browse to change location and create directories |
| Name | Define the model filename and identifier | Enter descriptive name following your naming conventions |
| Source | Choose data source for model structure generation | None, JSON, JSON Schema, XML, XML Schema, YAML |
Creating Models from Structured Data
Generate data models automatically from existing structured data formats such as JSON, XML, and YAML. This approach saves time and ensures accuracy when working with established data structures.
Creating Models from JSON data
Generate models from JSON data with automatic property detection:
- Select JSON as the source in the Data Model wizard
- Click Next to proceed to the JSON input step
-
Enter your JSON data in the text field
Example - Customer order from an e-commerce API:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
{ "orderId": "ORD-2024-001", "customerId": 12345, "customerInfo": { "name": "Jane Doe", "email": "jane.doe@enterprise.com", "phone": "+1-555-0123", "shippingAddress": { "street": "123 Main St", "city": "New York", "state": "NY", "zipCode": "10001", "country": "USA" } }, "orderDate": "2024-01-08T14:30:00Z", "status": "processing", "items": [ { "productId": "PROD-001", "name": "Wireless Headphones", "quantity": 2, "unitPrice": 99.99, "totalPrice": 199.98 } ], "totals": { "subtotal": 199.98, "tax": 16.00, "shipping": 5.99, "grandTotal": 221.97 }, "paymentMethod": "credit_card" } -
Review the generated property structure in the preview panel
- Click Create to generate the model
Expected Result: You'll have a complete Customer Order model with nested objects for customer info, shipping address, order items, and totals - ready for use in order processing workflows.
Import Options for JSON:
Click the Import button to choose the following options:
- From File: Browse and select a JSON file from your system
- From URL: Enter a URL pointing to JSON data for automatic import
Creating Models from XML data
Generate models from XML data with attribute and element mapping:
- Select XML as the source in the Data Model wizard
- Click Next to access the XML input step
-
Enter your XML data in the text field
Example - Employee record from HR system:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<Employee id="EMP-2024-456" status="active" department="engineering"> <PersonalInfo> <FirstName>John</FirstName> <LastName>Smith</LastName> <Email>john.smith@company.com</Email> <Phone>+1-555-0456</Phone> <HireDate>2023-03-15</HireDate> </PersonalInfo> <Position> <Title>Senior Software Engineer</Title> <Level>5</Level> <Salary currency="USD">95000</Salary> <Manager> <EmployeeId>EMP-2024-123</EmployeeId> <Name>Sarah Johnson</Name> </Manager> </Position> <Skills> <Skill level="expert">Java</Skill> <Skill level="intermediate">Python</Skill> <Skill level="beginner">Go</Skill> </Skills> </Employee> -
Review the generated property structure in the preview panel
- Click Create to generate the model
Expected Result: You'll have an Employee model with structured personal info, position details, and skills arrays - great for HR workflows and employee management systems.
Import Options for XML:
Click the Import button to choose the following options:
- From File: Browse and select a XML file from your system
- From URL: Enter a URL pointing to XML data for automatic import
Creating Models from YAML data
Generate models from YAML data with automatic property detection:
- Select YAML as the source in the Data Model wizard
- Click Next to proceed to the YAML input step
-
Enter your YAML data in the text field
Example - Application configuration for microservice deployment:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
applicationId: "user-service-v2" serviceName: "UserManagementService" version: "2.1.0" environment: "production" deployment: region: "us-east-1" replicas: 3 resources: cpu: "500m" memory: "1Gi" storage: "10Gi" database: host: "prod-db-cluster.company.com" port: 5432 name: "user_management" ssl: true connectionPool: min: 5 max: 20 timeout: 30 features: - "user_registration" - "password_reset" - "multi_factor_auth" - "audit_logging" monitoring: enabled: true endpoints: - "/health" - "/metrics" - "/status" alerting: email: "devops@company.com" threshold: 95 security: encryption: true tokenExpiry: 3600 rateLimiting: requests: 1000 window: 60 -
Review the generated property structure in the preview panel
- Click Create to generate the model
Expected Result: You'll have an Application Config model with nested deployment, database, monitoring, and security configurations - perfect for managing microservice deployments and infrastructure automation.
Import Options for YAML:
Click the Import button to choose the following options:
- From File: Browse and select a YAML file from your system
- From URL: Enter a URL pointing to YAML data for automatic import
Creating Models from a Schema
Generate data models from existing schemas to ensure your models follow predefined structures. Schema-based creation enforces data integrity and consistency, reducing errors and saving time when working with established data contracts.
Creating Models from JSON Schema
- Select JSON Schema as the source in the Data Model wizard
- In the Schema field, choose your input method:
- Drag and drop a JSON Schema file (
.json) directly into the field - Click Browse to select a JSON Schema file (
.json) from your system - Enter a URL pointing to an online JSON schema
- Drag and drop a JSON Schema file (
- Click Create to generate the model based on schema definitions
Creating Models from XML Schema
- Select XML Schema as the source in the Data Model wizard
- In the Schema field, choose your input method:
- Drag and drop an XML Schema file (
.xsd) directly into the field - Click Browse to select an XML Schema file (
.xsd) from your system - Enter a URL pointing to an online XML schema
- Drag and drop an XML Schema file (
- Click Create to generate the model based on schema definitions
How Data Model Creation Works
Understanding the model creation process helps you choose the right approach and troubleshoot issues during development.
Wizard User Experience Flow
When you open the Data Model wizard, the interface is designed to guide you through the creation process:
- Name Field Focus: The cursor automatically focuses on the Name field, requiring immediate input for your model name
- Real-time Validation: As you type the model name, Martini continuously validates:
- Character validity (ensuring proper naming conventions)
- Duplicate checking within the target directory specified in the Location field
- Cannot be left blank
- Default Location: An initial directory is pre-selected in the Location field, which you can change using Browse
- Source Selection: The Source field defaults to None, creating a blank model with no predefined properties
- Model Creation: Upon clicking Create, the data model appears in the specified directory and opens in the Data Model Editor
Source Processing and Type Detection
Different source types undergo specific processing to generate model properties:
None Source (Default)
- Creates an empty model structure ready for manual property definition
- No automatic property generation occurs
JSON and YAML Sources
- Auto-detection: Object types are automatically identified (string, number, boolean, array, object)
- Structure Mapping: Nested objects become child model properties
- Array Handling: Array elements define the structure for list properties
XML Source
- Limited Type Detection: Properties that are not objects are interpreted as strings
- Object Properties: Nested XML elements become model object properties
- Attribute Handling: XML attributes are converted to string properties
- Structure Preservation: Element hierarchy is maintained in the model structure
Schema Sources (JSON Schema/XML Schema)
- Validation Rules: Original schema constraints and validation rules are preserved
- Type Definitions: Explicit type definitions from schemas are maintained
- Structure Enforcement: Model structure strictly follows schema specifications
Data Model Creation Benefits and Use Cases
Data models form the foundation of structured data handling in Martini, enabling consistent data processing across your applications.
Common enterprise scenarios:
- API Integration Projects: Create models matching external API responses to ensure seamless data exchange
- Database Migration: Define models that represent both source and target database schemas
- Microservices Architecture: Establish consistent data contracts between services
- Data Transformation Pipelines: Create intermediate models for complex data processing workflows
Business benefits:
- Faster Development: Generate models in seconds rather than manually defining dozens of properties
- Reduced Errors: Automatic type detection eliminates manual typing mistakes
- Better Documentation: Models serve as living documentation of your data structures
- Easier Maintenance: Centralized model definitions make updates more manageable
Troubleshooting Data Model Creation Issues
| Problem | Detection | Cause | Fix |
|---|---|---|---|
| Data Model option missing from New submenu | Data Model not visible when right-clicking | Package is core or UNLOADED |
Select a loaded package (not core) |
| Desired package not listed in Browse dialog | Target package missing from directory list | Package is UNLOADED | Right-click the target package and select Load or Start before creating models |
| No property preview shown | Preview panel remains empty after data entry | Malformed source data | Fix JSON/XML/YAML syntax errors |
| Schema import fails | Error during schema parsing | Invalid schema format | Validate schema format before importing |
Deleting Martini Data Models
Safely removing data models from your Martini packages requires careful consideration of dependencies and references to prevent application errors.
Getting Started with Model Deletion
Delete one or more data models using the Navigator interface:
- In the Navigator view, select the model(s) you want to delete:
- For a single model, click to select it.
- For multiple models, hold Ctrl (Windows/Linux) or Cmd (macOS) and click each model you want to delete.
- Right-click on any selected model and choose Delete from the context menu.
- Review the confirmation dialog showing the model(s) to be deleted.
- Click Delete to confirm and remove the selected model(s).
Alternative method: With one or more models selected, press the Delete key to initiate deletion.
Expected result: The selected model(s) are permanently removed from your Martini package and no longer appear in the Navigator view.
How Model Deletion Works
Deleting a data model in Martini is permanent, so it’s important to understand the process before proceeding. Improper deletion can lead to data loss or application errors.
Once a model is deleted:
- The model file is permanently removed from the package.
- Any models or components that referenced the deleted model will instantly lose inherited properties.
- Data mappings, API responses, and workflow steps that relied on the deleted model may become invalid or produce errors.
- You may need to update or reconfigure affected models, services, or workflows to restore functionality.
Safe Model Deletion Process
Follow this process to avoid breaking existing functionality when removing data models from your applications.
Pre-Deletion Reference Check
Before deleting any model, verify it's not actively used:
- Select the target model in the Navigator view
- Right-click and select Find References
- Review the results to identify dependent services, workflows, or other components
- Resolve or update all references before proceeding with deletion
Model Deletion Benefits and Use Cases
Strategic model deletion helps maintain clean, efficient codebases and prevents accumulation of unused assets.
Use model deletion when you need to:
- Clean up unused models: Remove deprecated, redundant, or experimental models
- Refactor architecture: Simplify and optimize data definitions
- Maintain code quality: Keep models focused and relevant
Troubleshooting Model Deletion Issues
| Problem | Detection | Cause | Fix |
|---|---|---|---|
| Deletion fails with error | Error occurs after deletion confirmation and model(s) remain visible in the Navigator view | Model file(s) deleted externally | Refresh the Navigator view by collapsing and expanding the directory tree |
Helpful Resources
- Data Model Editor - Learn to edit model properties and structure after creation
- Data Model Property Types - Explore available property types and configurations
- Data Model References - Understand how to reference other models
- Community Q&A: Martini Community
Have a Question? Post or search it here.