Skip to content

populated_from dot-paths don't traverse inlined nested data (only FK joins) #247

@amc-corey-cox

Description

@amc-corey-cox

Motivation

populated_from dot-paths (#212) walk FK joins via ObjectIndex. For sources where the hierarchy is inlined (XML, JSON Schema, OWL, EML — anything tree-shaped that isn't relational), the same syntax doesn't reach: the FK-resolution path engages, finds no FK to resolve, warns Cross-class lookup requires object_index, and returns None.

Concrete driver: schema-automator's EML importer (linkml/schema-automator#208, branch eml-importer). Today it works around this by using three single-level class_derivations plus a Python loop that iterates dataset.dataTable[] and attributeList.attribute[] and invokes the transform per source instance. Future XSD / JSON-Schema importers will hit the same shape.

Proposed direction

When the source schema declares a slot with inlined: true (or inlined_as_list: true) and range: <SomeClass>, treat dot-path traversal as a structural walk through the inlined object/list rather than an FK lookup. Per-slot decision: identifier-shaped scalar → ObjectIndex (current); dict / list of dicts → walk directly (new).

With this in place, class_derivation chaining works for inlined sources symmetrically with FK ones:

class_derivations:
  SchemaDefinition:
    populated_from: EMLDocument
    slot_derivations:
      title:
        populated_from: dataset.title          # scalar, deep inline
      classes:
        populated_from: dataset.dataTable      # multivalued inline;
                                                # ClassDefinition auto-fires
                                                # per item
  ClassDefinition:
    populated_from: DataTable
    ...

No new memory cost — the source tree is already loaded; no ObjectIndex build needed for inlined paths.

Open questions

  • Detection: prefer declarative (inlined: true from source schema). Runtime shape detection is a fallback.
  • Diagnostics on missing path segments should name the failing segment, not bottom out as a silent None.

References / contrasts

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions