Skip to content

Implement expression_to_expression_mappings in transformer runtime #127

@amc-corey-cox

Description

@amc-corey-cox

Summary

The expression_to_expression_mappings field is defined in the linkml-map schema (SlotDerivation class) but is not implemented in the transformer runtime. Files that use this field pass schema validation but the mappings are silently ignored during transformation.

Current behavior

When a SlotDerivation includes expression_to_expression_mappings, the transformer does not process them — the mappings have no effect on the output.

Expected behavior

The transformer should evaluate expression_to_expression_mappings entries, applying the source-to-target expression mapping during transformation.

Use case

We're writing transformation specs for the BioData Catalyst harmonized variables project where visit identifiers need to be mapped through expressions. Currently we use case() expressions as a workaround:

associated_visit:
  expr: 'uuid5("https://w3id.org/bdchm/Visit", str({phv00177237}) + ":" + case(({phv00177238} == ''2'', ''FHS NEW OFFSPRING SPOUSE EXAM 2''), ({phv00177238} == ''3'', ''FHS GENERATION 3 EXAM 2'')))'

With expression_to_expression_mappings support, this could be expressed more cleanly:

associated_visit:
  populated_from: phv00177238
  expression_to_expression_mappings:
    '{phv00177238} == 2': 'uuid5("https://w3id.org/bdchm/Visit", str({phv00177237}) + ":FHS NEW OFFSPRING SPOUSE EXAM 2")'
    '{phv00177238} == 3': 'uuid5("https://w3id.org/bdchm/Visit", str({phv00177237}) + ":FHS GENERATION 3 EXAM 2")'

Environment

  • linkml-map version: 0.3.9
  • The schema field exists in transformer_model.py as part of SlotDerivation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions