Diffo.Provider.Calculations.ReverseInheritedCharacteristic (Diffo v0.5.0)

Copy Markdown View Source

Backing calculation for reverse_inherited_characteristic DSL declarations.

Traverses AssignmentRelationship outward (this instance is the source; follow to assignees) filtered by alias, then reads the named typed characteristic on each assignee.

Where inherited_characteristic follows the assignee's natural view (turtles up to the assigner), this calc follows the assigner's view (turtles down to assignees). The "reverse" in the name is reverse-of-the-natural-inherited- direction. Useful when the assigner wants to compose its assignees' characteristics into its own view (e.g. a shelf surfacing the typed characteristic of every card assigned to its slot pool).

Injected automatically by TransformInheritedRefs — do not reference this module directly; use the reverse_inherited_characteristic DSL entity inside characteristics do.

Cross-world resolution

Same as Diffo.Provider.Calculations.InheritedCharacteristic — the typed characteristic module is resolved at runtime per assignee via AshNeo4j.worlds/1 on the assignee struct and Diffo.Provider.Extension.Info.provider_characteristics/1 on its outermost resource. Late-binding by design.

Result shape

A list per input record. Each entry corresponds to one assignee reached by the outgoing-assignment traversal at the declared alias. Same shape as the forward calc: a typed characteristic record (or list of records for {:array, _} declared values), or %Diffo.Unknown{}.

Reason vocabulary (local to this world)

Same atoms as InheritedCharacteristic:no_concrete_world and :role_not_declared — with :context carrying :assignee_id instead of :source_id to reflect the traversal direction.

Summary

Functions

describe(opts)

Callback implementation for Ash.Resource.Calculation.describe/1.

has_calculate?()

has_expression?()

Callback implementation for Ash.Resource.Calculation.has_expression?/0.

init(opts)

Callback implementation for Ash.Resource.Calculation.init/1.

strict_loads?()

Callback implementation for Ash.Resource.Calculation.strict_loads?/0.