Skip to content

feat(language)!: maps give labels, relations give rows - #1015

Open
FBumann wants to merge 7 commits into
docs/times-examplesfrom
feat/maps-only
Open

FBumann wants to merge 7 commits into
docs/times-examplesfrom
feat/maps-only

Conversation

@FBumann

@FBumann FBumann commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Note

The following content was generated by AI.

What this changes

relations: states which rows exist; maps: gives each row of a subject one label, with missing: per map. The split of #1007 alone, without in: (#980). Stacked on #1021, whose TIMES examples it restates.

# before
relations:
  gen_bus: { key: generator, values: bus }
  line_ends: { key: line, values: { bus0: bus, bus1: bus }, missing: absent }
  connection: { key: [generator, bus], missing: absent }
constraints:
  balance: { expression: "sum(p, over=generator, by=gen_bus[bus]) == load" }
variables:
  flow: { dims: [line], where: line_ends }

# after
relations:
  connection: { dims: [generator, bus], missing: absent }
maps:
  generator:
    bus: { dim: bus }                     # dim: always written
  line:
    bus0: { dim: bus }
    bus1: { dim: bus, missing: absent }   # missing per map
constraints:
  balance: { expression: "sum(p, over=generator, by=generator[bus]) == load" }
variables:
  flow: { dims: [line], where: "line[bus1]" }   # true where the map gives a label
  dispatch: { dims: [generator, bus], where: connection }   # unchanged: a bare relation still stands in where:

TIMES (examples/times/trade.yaml, from #1021):

# before
relations:
  link_ends: { key: trade_link, values: { from_commodity: commodity, from_region: region, to_commodity: commodity, to_region: region } }
# after
maps:
  trade_link: { from_commodity: { dim: commodity }, from_region: { dim: region }, to_commodity: { dim: commodity }, to_region: { dim: region } }
# read as trade_link[to_commodity, to_region]

Why

Method, gate output, what moved

🤖 Generated with Claude Code

https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q

`relations:` states which combinations of its `dims:` exist. A new `maps:`
section gives each row of a subject, a dimension or a relation, one label
of the dimension its `dim:` names, with `missing:` set on each map. A map
is read as `subject[map]`, and `subject[map]` alone tests that the row has
a label. `merge` joins the maps of a subject, so a fragment declares only
the maps it reads.

The split of #1007 without `in:` (#980): a relation's bare name still
stands in any `where:`.

Co-Authored-By: Fabian Hofmann <fab.hof@gmx.de>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
@read-the-docs-community

read-the-docs-community Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
The TIMES examples of #1021 in this PR's spelling: the relations of
capacity.yaml take dims:, and trade.yaml gives trade_link its two
regions and two commodities as maps, read as trade_link[to_region].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
@FBumann
FBumann changed the base branch from main to docs/times-examples November 16, 2026 17:47
sparse.yaml in this PR's spelling: connection and active take dims:, and
the bus a port feeds is a map of connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dimensions How dimensions are stated and used area: relations How relations between dimensions are stated and used

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants