class_docstr: Figures out what linkable specs are valid for a given metric.
  
  e.g. Can you query the metric "bookings" by "listing__country_latest"?
docstr: Get the elements that can be generated by joining other models to the given model.
docstr_tok: ["Get","the","elements","that","can","be","generated","by","joining","other","models","to","the","given","model","."]
code: def _get_joined_elements(
      self, measure_semantic_model: SemanticModel
  ) -> LinkableElementSet:
      """Get the elements that can be generated by joining other models to the given model."""
      # Create single-hop elements
      join_paths = []
      for entity in measure_semantic_model.entities:
          semantic_models = self._get_semantic_models_with_joinable_entity(
              left_semantic_model_reference=measure_semantic_model.reference,
              entity_reference=entity.reference,
          )
          for semantic_model in semantic_models:
              if semantic_model.name == measure_semantic_model.name:
                  continue
              join_paths.append(
                  SemanticModelJoinPath(
                      path_elements=(
                          SemanticModelJoinPathElement(
                              semantic_model_reference=semantic_model.reference,
                              join_on_entity=entity.reference,
                          ),
                      )
                  )
              )
      single_hop_elements = LinkableElementSet.merge_by_path_key(
          [
              join_path.create_linkable_element_set(
                  semantic_model_accessor=self._semantic_model_lookup,
                  with_properties=frozenset(
                      {LinkableElementProperties.JOINED}
                  ),
              )
              for join_path in join_paths
          ]
      )
  
      # Create multi-hop elements. At each iteration, we generate the list of valid elements based on the current join
      # path, extend all paths to include the next valid semantic model, then repeat.
      multi_hop_elements = LinkableElementSet(
          path_key_to_linkable_dimensions={},
          path_key_to_linkable_entities={},
      )
  
      for i in range(self._max_entity_links - 1):
          new_join_paths: List[SemanticModelJoinPath] = []
          for join_path in join_paths:
              new_join_paths.extend(
                  self._find_next_possible_paths(
                      measure_semantic_model=measure_semantic_model,
                      current_join_path=join_path,
                  )
              )
  
          if len(new_join_paths) == 0:
              break
  
          multi_hop_elements = LinkableElementSet.merge_by_path_key(
              (multi_hop_elements,)
              + tuple(
                  new_join_path.create_linkable_element_set(
                      semantic_model_accessor=self._semantic_model_lookup,
                      with_properties=frozenset(
                          {
                              LinkableElementProperties.JOINED,
                              LinkableElementProperties.MULTI_HOP,
                          }
                      ),
                  )
                  for new_join_path in new_join_paths
              )
          )
          join_paths = new_join_paths
  
      return LinkableElementSet.merge_by_path_key(
          (single_hop_elements, multi_hop_elements)
      )
  
imports: from __future__ import annotations
  import logging
  import time
  from collections import defaultdict
  from dataclasses import dataclass
  from typing import Dict, FrozenSet, List, Optional, Sequence, Set, Tuple
  from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
  from dbt_semantic_interfaces.pretty_print import pformat_big_objects
  from dbt_semantic_interfaces.protocols.dimension import Dimension, DimensionType
  from dbt_semantic_interfaces.protocols.semantic_manifest import SemanticManifest
  from dbt_semantic_interfaces.protocols.semantic_model import SemanticModel
  from dbt_semantic_interfaces.references import DimensionReference, MeasureReference, MetricReference, SemanticModelReference, TimeDimensionReference
  from dbt_semantic_interfaces.type_enums import MetricType
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.dataset.dataset import DataSet
  from metricflow.errors.errors import UnknownMetricLinkingError
  from metricflow.model.semantics.linkable_element_properties import LinkableElementProperties
  from metricflow.model.semantics.semantic_model_join_evaluator import SemanticModelJoinEvaluator
  from metricflow.model.semantics.semantic_model_lookup import SemanticModelLookup
  from metricflow.protocols.semantics import SemanticModelAccessor
  from metricflow.specs.specs import DEFAULT_TIME_GRANULARITY, DimensionSpec, EntityReference, EntitySpec, LinkableSpecSet, TimeDimensionSpec
label_desc: Use image node_id 7 for calling the ValidLinkableSpecResolver obj's underlying member method code with example usage: obj._get_joined_elements(measure_semantic_model) and returns: LinkableElementSet