Skip to content

Add XMILE support for EXCEPT equations, element-level dimension mappings, and DataSource metadata #342

Closed

Description

@bpowers

Background

Phase 2 of the MDL full compatibility work introduced three new datamodel constructs:

  1. Equation::Arrayed with default_equation -- Represents Vensim's :EXCEPT: syntax, where a default equation applies to all dimension elements not explicitly overridden.

  2. DimensionMapping with element_map -- Element-level correspondence between subscript families, supporting mappings like "element A in dimension X corresponds to element B in dimension Y."

  3. DataSource metadata -- Stores parsed arguments from Vensim's GET DIRECT DATA/CONSTANTS/LOOKUPS/SUBSCRIPT functions for roundtrip fidelity.

Current behavior

XMILE serialization (xmile/variables.rs, xmile/dimensions.rs) returns an explicit error when encountering any of these constructs, preventing silent data loss.

XMILE schema limitations and potential extension points

The XMILE specification (v1.0) has limited native support for these constructs:

EXCEPT equations

XMILE's <eqn> element within <element> tags under an arrayed variable can represent per-element equations, but there is no standard mechanism for a "default equation with exceptions" pattern. Potential approaches:

  • Use a non-subscripted <eqn> as the default and <element> entries as overrides (closest to XMILE semantics, but may conflict with existing implementations)
  • Use a vendor-specific extension attribute (e.g., isee:default_eqn) on the variable element

Element-level dimension mappings

XMILE's <dimensions> section supports <dim> elements with <elem> children, but dimension mappings between families are not part of the core spec. Potential approaches:

  • Extend <dim> with a mapping child element (vendor extension)
  • Use Simlin-specific metadata within the model's <options> or a custom namespace

DataSource metadata

XMILE has no concept equivalent to Vensim's GET DIRECT functions, since it uses inline data. Potential approaches:

  • Store as vendor-specific metadata on the variable (e.g., simlin:data_source)
  • Inline the resolved data and store the original source reference as metadata for roundtrip purposes

Acceptance criteria

  • XMILE serialization roundtrips all three constructs without error (likely via vendor extensions)
  • Existing XMILE files without these constructs continue to parse correctly
  • The explicit error paths in xmile/variables.rs and xmile/dimensions.rs are replaced with proper serialization logic
  • Extension approach is documented so other tools can interoperate

Activity

  1. added
    enhancement
    compat
    engine
    on Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatengineenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions