Diffo. Provider. Extension. InheritedCharacteristicDeclaration
(Diffo v0.5.1)
Copy Markdown
View Source
DSL entity for an inherited_characteristic declaration inside characteristics do
on an Instance resource.
Generates an Ash calculation that traverses the assignment graph inward (this
instance as target → source instances), then reads the typed characteristic value
declared at the given role on each source. The calculation is injected by
TransformInheritedRefs at compile time — no direct edge or characteristic record
is created on the consuming instance itself.
Unlike inherited_place / inherited_party (which read against universal PlaceRef /
PartyRef), the typed characteristic module varies per source resource. The
resolution happens at runtime via AshNeo4j.worlds/1 on the source struct and
Diffo.Provider.Extension.Info.provider_characteristics/1 on the source's outermost
resource module. This is late-binding by design — the source resource may not exist
at the consumer's compile time.
Fields
role— atom; the name of the generated calculation and the characteristic role to look up on each source instance (the source'scharacteristic :role, MyApp.SomeCharacteristicdeclaration). Per-source theMyApp.SomeCharacteristicmodule is found at runtime.via— optional list of alias atoms for multi-hop traversal. When nil the role name is used as the single alias step (single-hop default). When provided, each step filtersAssignmentRelationshipby that alias atom before followingsource_idto the next set of instances.
Example
characteristics do
inherited_characteristic :uni
inherited_characteristic :upstream_ntd, via: [:port, :uplink]
endResult shape
The injected calculation returns a list of entries, one per source instance reached by the traversal. Each entry is one of:
- the typed characteristic record (or list of records for
{:array, _}characteristic values), when the source carries a characteristic at the declared role. %Diffo.Unknown{}when the source can't be projected back to a loadable resource module, or its module doesn't declare a characteristic at this role. SeeDiffo.Provider.Calculations.InheritedCharacteristicfor the local reason vocabulary.