A comprehensive Elixir loader for IDEF0 AI0 Neutral Text format files, converting legacy IDEF0 models to structured JSON and Elixir data structures.
This tool parses IDEF0 AI0 text files (as exported from tools like KBSI's AI0Win) and converts them into clean, structured Elixir maps and JSON output. It's designed to preserve complete model fidelity while enabling modern workflows for IDEF0 documentation and governance.
Current Status: Loader is functional and outputs JSON at this point. Unloader (reverse conversion) is planned for future phases to enable complete round-trip workflows.
The initial approach stepped right into the trap of trying to define a grammar and use parsing tools to process the files. That was a costly mistake that had been corrected now.
IDEF0, despite being deprecated as a federal standard, remains genuinely useful for hierarchical activity modeling and complex system analysis. With KBSI's tooling unmaintained and no modern alternatives, this project addresses the gap by:
- Immediate use case: Converting legacy AI0Win-exported files to JSON for documentation and governance
- Long-term vision: Foundation for a modern web-based IDEF0 modeller (leveraging HTML5 grid layout advantages over legacy Java/SVG approaches)
- Complete AI0 parsing: All IDEF0 elements (activities, concepts, diagrams, ICOM lists, hierarchies)
- IDEF0 numbering: Automatic computation of A-numbers for activities and I/C/O/M numbers for boundary concepts on decomposition diagrams
- Structured output: Pools (ID-keyed maps) and Lists (flat arrays) with preserved ordering
- JSON export: Pretty-printed JSON for integration into documentation systems
- Elixir-first: Internal representation as Elixir Nested Keywords and Lists, JSON is secondary export format reorganised for easier access.
- Unloader: Regenerate AI0 TXT format from Elixir/JSON structures
- Format validation: Ensure generated files meet AI0 specification
- Web modeller: HTML5-based IDEF0 diagram editor (long-term)
- Elixir 1.14+
- Erlang/OTP 25+
- Mix
cd ai0loader
mix deps.get
mix escript.buildThis creates an ai0loader executable.
./ai0loader input.TXT # produces output.jsonOutputs full JSON with all data to stdout.
./ai0loader --output named.json input.TXT # produces named.jsonTo load and inspect the Elixir structures interactively:
-
Start the interactive shell:
iex -S mix
-
Load and parse a file using the CLI:
./ai0loader input.TXT # output in output.json
.
├── lib/
│ ├── ai0loader/
│ │ ├── cli.ex # CLI and filtering logic
│ │ └── txtformat.ex # AI0 text format loader
├── mix.exs # Mix project definition
├── .gitignore
├── LICENSE # Placeholder (rights reserved)
└── README.md # This file
AI0 Document Root
├── Project
│ ├── Name: String
│ ├── Summary
│ │ ├── Creator: String
│ │ ├── Used At: String
│ │ ├── Project: String
│ │ ├── Date Created: Timestamp
│ │ ├── Last Modified: Timestamp
│ │ └── Description: [String]
│ ├── Properties
│ │ └── Defined System Types: [String]
│ ├── Models
│ │ └── Models: [Model]
│ │ ├── Name: String
│ │ ├── Diagram: Integer
│ │ └── Assignments: [Assignment]
│ │ ├── ID: Integer
│ │ ├── Source Type: String
│ │ ├── Source ID: String
│ │ ├── Source Name: String
│ │ ├── Source Value: Number
│ │ ├── Costdriver ID: Integer
│ │ ├── Costdriver Name: String
│ │ ├── Total Driver Quantity: Number
│ │ └── Destination List: [Destination]
│ │ ├── ID: Integer
│ │ ├── Dest Type: String
│ │ ├── Dest ID: String
│ │ ├── Dest Name: String
│ │ ├── Driver Quantity: Number
│ │ ├── Pct Driver Quantity: Number
│ │ └── Assignment Value: Number
│ ├── Pooldata
│ │ ├── Property Pool: {ID: Property}
│ │ │ ├── Name: String
│ │ │ ├── Creator: String
│ │ │ ├── Date Created: Timestamp
│ │ │ ├── Last Modified: Timestamp
│ │ │ ├── Note List: [Reference]
│ │ │ └── Definition
│ │ │ ├── Name: String
│ │ │ ├── Type: String
│ │ │ ├── Value: [String]
│ │ │ └── Description: [String]
│ │ ├── Note Pool: {ID: Note}
│ │ │ ├── Name: String
│ │ │ ├── Creator: String
│ │ │ ├── Date Created: Timestamp
│ │ │ ├── Last Modified: Timestamp
│ │ │ ├── Glossary: [String]
│ │ │ └── Note List: [Reference]
│ │ ├── Source Pool: {ID: Source}
│ │ │ ├── Name: String
│ │ │ ├── Creator: String
│ │ │ ├── Date Created: Timestamp
│ │ │ ├── Last Modified: Timestamp
│ │ │ └── Glossary: [String]
│ │ ├── Unknown Pool: {ID: Unknown}
│ │ │ ├── Name: String
│ │ │ ├── Creator: String
│ │ │ ├── Date Created: Timestamp
│ │ │ ├── Last Modified: Timestamp
│ │ │ ├── Glossary: [String]
│ │ │ ├── Note List: [Reference]
│ │ │ └── Source List: [Reference]
│ │ ├── Activity Pool: {ID: Activity}
│ │ │ ├── Name: String
│ │ │ ├── Creator: String
│ │ │ ├── Date Created: Timestamp
│ │ │ ├── Last Modified: Timestamp
│ │ │ ├── Glossary: [String]
│ │ │ ├── Note List: [Reference]
│ │ │ ├── Source List: [Reference]
│ │ │ ├── Property List: [Property]
│ │ │ ├── ABC Data
│ │ │ │ ├── Type: [String]
│ │ │ │ ├── Est Time: Number
│ │ │ │ ├── Est Cost: Number
│ │ │ │ └── Est Value: Number
│ │ │ └── Object Type: String
│ │ └── Concept Pool: {ID: Concept}
│ │ ├── Name: String
│ │ ├── Creator: String
│ │ ├── Date Created: Timestamp
│ │ ├── Last Modified: Timestamp
│ │ ├── Glossary: [String]
│ │ ├── ABC Data
│ │ │ ├── Cost Per Time: Number
│ │ │ ├── Cost Per Unit: Number
│ │ │ └── Est Value: Number
│ │ ├── Breakdown List: [Breakdown]
│ │ │ ├── ID: Integer
│ │ │ ├── Type: String (Part-Of, Type-Of)
│ │ │ └── Concept: [Reference]
│ │ └── Object Type: String
│ ├── Diagrams
│ │ └── list: [Diagram]
│ │ ├── ID: Integer
│ │ ├── Diagram ID: Integer
│ │ ├── Name: String
│ │ ├── Parent: String
│ │ ├── Creator: String
│ │ ├── Date Created: Timestamp
│ │ ├── Last Modified: Timestamp
│ │ ├── Revision Number: Integer
│ │ ├── Review Status: String
│ │ ├── Purpose: [String]
│ │ ├── Viewpoint: [String]
│ │ ├── Context: [String]
│ │ ├── Description: [String]
│ │ ├── Note List: [Reference]
│ │ ├── Source List: [Reference]
│ │ ├── Property List: [Property]
│ │ ├── Activity List: [Activity]
│ │ │ ├── ID: String (e.g., "1.1")
│ │ │ ├── Name: String
│ │ │ ├── Activity ID: Integer
│ │ │ ├── ABC Data
│ │ │ │ ├── Type, Est. Time, Est. Cost, Est. Value
│ │ │ │ ├── Calc. Time, Calc. Cost, Calc. Value
│ │ │ │ ├── Primary, Secondary
│ │ │ │ ├── Value-Adding, Non-Value-Adding
│ │ │ │ └── Discretionary, Non-Discretionary
│ │ │ ├── Input List: [Reference Pattern]
│ │ │ ├── Control List: [Reference Pattern]
│ │ │ ├── Output List: [Reference Pattern]
│ │ │ ├── Mechanism List: [Reference Pattern]
│ │ │ ├── Call Arrow Destinations: [Reference]
│ │ │ └── Property List: [Property]
│ │ ├── Concept List: [Reference Pattern]
│ │ │ └── with ABC Data and Property List per concept
│ │ └── Breakdown List: [Breakdown]
│ │ ├── ID: Integer
│ │ ├── Type: String (Part-Of, Type-Of)
│ │ ├── Single: Integer
│ │ └── Many: [Integer]
│ └── Objects in ABC: [Object]
│ ├── ID: Integer
│ ├── Object Type: String
│ ├── Object ID: Integer
│ ├── Object Name: String
│ └── Period Cost: Number
- Pools: ID-keyed maps for quick lookup and bidirectional references
- Lists: Flat arrays preserve insertion order (critical for diagram element sequencing)
- Numbering: Computed IDEF0 display numbers (A-numbers, I/C/O/M numbers) added post-parsing for diagram rendering
- No artificial nesting: Format is fundamentally flat; hierarchies are represented via parent/child ID references
- Complete field preservation: All original fields present, including ABC Data and Property Lists (can be filtered at export)
- Block structure:
Type ID #UsageTag ... End Type ID - ABC Data: Single KV pairs inline (
ABC Data: Time; 1), multiple KV pairs in block format - ICOM Lists: Control List, Input List, Output List, Mechanism List preserve item order
- Diagrams: Contain references to activities from Activity Pool, organized hierarchically via parent diagram reference
- No explicit nesting: All complexity expressed through ID references across flat pools
For more detail on the format specification AI0 Neutral Text Format, see FORMAT_SPEC.md.
mix testmix escript.build- ✅ Complete AI0 loader
- ✅ JSON export
- ✅ Output filtering (--no-abc, --no-prop)
- 🔄 Format specification documentation
- 🔄 Unloader (TXT regeneration)
- ⬜ Round-trip validation tests
- ⬜ Web-based IDEF0 modeller UI
- ⬜ Diagram rendering (SVG generation)
- ⬜ Collaborative editing capabilities
This project is currently under evaluation for IP and licensing implications. Contributions are welcome once the license is finalized.
For now, inquiries regarding participation should be directed to the maintainer.
- IDEF0 Specification
- KBSI AI0Win (legacy reference implementation)
- IDEF0 modeling theory and practice
PLACEHOLDER LICENSE - All rights reserved pending legal and commercial evaluation.
See LICENSE for details.
Maintainer: Marthin Laubscher
Last Updated: December 30, 2025