Accessing Items via FlowEnds

Hello!
I’m trying to access the ItemUsage of each end of a FlowUsage.

So far I have:

flow_ends = flow_usage.related_elements.collect()

source_action = flow_ends[0].feature_target
target_action = flow_ends[1].feature_target

source_item = flow_usage.source_output_feature
target_item = flow_usage.target_input_feature

But the source and target item does not return the item itself, but something like this instead: (anonymous FlowUsage)::source::

What am I missing? I can’t find a function or attribute in the documentation that returns the ItemUsage.

Thanks!
Tom

Hi,

flows are a bit different from other connectors that flow ends are split into related features, and input/target feature, e.g. flow from a.b to c.d; produces

Namespace [0, 0] - [1, 0]
  children: OwningMembership [0, 0] - [0, 21]
    target: FlowUsage [0, 0] - [0, 21]
      flow [0, 0] - [0, 4]
      from [0, 5] - [0, 9]
      ends: EndFeatureMembership [0, 10] - [0, 13]
        target: FlowEnd [0, 10] - [0, 13]
          heritage: ReferenceSubsetting [0, 10] - [0, 12]
            target: FeatureReference [0, 10] - [0, 11]
              segment: NAME [0, 10] - [0, 11]
            . [0, 11] - [0, 12]
          children: FeatureMembership [0, 12] - [0, 13]
            target: ReferenceUsage [0, 12] - [0, 13]
              heritage: Redefinition [0, 12] - [0, 13]
                target: FeatureReference [0, 12] - [0, 13]
                  segment: NAME [0, 12] - [0, 13]
      to [0, 14] - [0, 16]
      ends: EndFeatureMembership [0, 17] - [0, 20]
        target: FlowEnd [0, 17] - [0, 20]
          heritage: ReferenceSubsetting [0, 17] - [0, 19]
            target: FeatureReference [0, 17] - [0, 18]
              segment: NAME [0, 17] - [0, 18]
            . [0, 18] - [0, 19]
          children: FeatureMembership [0, 19] - [0, 20]
            target: ReferenceUsage [0, 19] - [0, 20]
              heritage: Redefinition [0, 19] - [0, 20]
                target: FeatureReference [0, 19] - [0, 20]
                  segment: NAME [0, 19] - [0, 20]
      ; [0, 20] - [0, 21]

You will want to get the first redefined feature of each item instead.

How do I get access to the first redefined feature of each item? I tried all members listed in FlowEnd documentation inherited from Feature, but nothing gave me the result I was looking for..

def first_redefined_feature(feat: syside.Feature) -> syside.Feature | None:
    relation = feat.owned_redefinitions.at(0)
    if relation:
        return relation.redefined_feature
    return None