How xmi-schema/xmi-schema-python works
Project type and purpose
• This is a Python library/package (full “src/xmi” package with versioned modules) whose purpose is to parse JSON representations of structural models (XMI) and expose them as Python objects.
• There is no frontend or service layer—this is a domain‐specific parser and model manager.
File structure
• Top level: configuration and CI (.github/workflows, pyproject.toml), install scripts, license, tests folder.
• src/xmi/v1/: core library code for version 1 of the XMI spec.
• entities/: Python classes for each domain object (curve member, material, cross‐section, node, etc.)
• geometries/: basic geometry primitives (points, lines, arcs)
• relationships/: mixins or helpers that link entities to geometry or to one another
• xmi_manager.py: the façade/orchestrator that reads JSON and builds the full model
• xmi_model.py: container for the assembled entity graph
• constants.py, xmi_errors.py, xmi_utilities.py: shared utilities and error definitions
• tests/: mirror of src/ for test inputs and test scripts checking parsing correctness.
• after_install_tests/: sanity tests that run after the package is installed.
Key insights from README
• The library is under active development; most structural entities are done.
• XmiManager is the entry point and drives reading JSON → instantiating entity classes.
Components and interactions
a. Main components
• JSON Input (external files)
• XmiManager (parsing coordinator)
• XmiModel (holds all entity instances)
• Entities layer (each entity class grouped under entities/)
• Support layers:
• Enums (enums/)
• Geometries (geometries/)
• Relationships (relationships/)
• Utilities & Constants
b. Relationships & data flow
1. JSON Input → XmiManager.read( )
2. XmiManager uses utilities to validate JSON and dispatch to entity constructors
3. Each entity class may:
– Instantiate geometry primitives
– Mix in relationships to other entities/geometries
4. Entities are collected into XmiModel
5. XmiModel can be queried or exported by client code
c. Architectural patterns & design principles
• Layered modular design: separation between orchestration (manager), domain (entities), and support (enums, geometries, utilities)
• Single Responsibility: each entity class handles one concept
• Factory/Manager pattern: XmiManager is the factory that builds the object graph
• Versioning: code is namespaced under v1, making future versions easy to add
d. Key technologies/frameworks
• Python package structure (PEP 517/518 via pyproject.toml)
• pytest or unittest for tests
• JSON for data interchange
Elements
• Clear rectangular blocks for each module/package (e.g., “entities”, “geometries”, “relationships”).
• A distinct block for XmiManager and XmiModel.
• An “External JSON Input” block on the left.
• From JSON Input → XmiManager
• From XmiManager → Entities & Support modules
• From Entities → XmiModel
• Input data (e.g., gray)
• Processing components (XmiManager in blue)
• Domain model (entities in green)
• Utilities (enums/geometries in yellow)