class_docstr: Creates an object used for performing lineage queries.
class_docstr_tok: ["Creates","an","object","used","for","performing","lineage","queries","."]
docstr: Collapse the duplicate vertices and edges for cross-account.
docstr_tok: ["Collapse","the","duplicate","vertices","and","edges","for","cross-account","."]
code: def _collapse_cross_account_artifacts(self, query_response):
      """Collapse the duplicate vertices and edges for cross-account."""
      for edge in query_response.edges:
          if (
              "artifact" in edge.source_arn
              and "artifact" in edge.destination_arn
              and edge.source_arn.split("/")[1]
              == edge.destination_arn.split("/")[1]
              and edge.source_arn != edge.destination_arn
          ):
              edge_source_arn = edge.source_arn
              edge_destination_arn = edge.destination_arn
              self._update_cross_account_edge(
                  edges=query_response.edges,
                  arn=edge_source_arn,
                  duplicate_arn=edge_destination_arn,
              )
              self._update_cross_account_vertex(
                  query_response=query_response,
                  duplicate_arn=edge_destination_arn,
              )
  
      # remove the duplicate edges from cross account
      new_edge = [
          e
          for e in query_response.edges
          if not e.source_arn == e.destination_arn
      ]
      query_response.edges = new_edge
  
      return query_response
  
imports: from __future__ import absolute_import
  from datetime import datetime
  from enum import Enum
  from typing import Any, Optional, Union, List, Dict
  from json import dumps
  from re import sub, search
  from sagemaker.utils import get_module
  from sagemaker.lineage._utils import get_resource_name_from_arn
label_desc: Use image node_id 5 for calling the LineageQuery obj's underlying member method code with example usage: obj._collapse_cross_account_artifacts(query_response) and returns: query_response