docstr: Check if input mentions has the given relation between them
  
  Args:
      mention_x: MentionDataLight
      mention_y: MentionDataLight
      relation: RelationType
  
  Returns:
      RelationType: relation in case mentions has given relation or
          RelationType.NO_RELATION_FOUND otherwise
docstr_tok: ["Check","if","input","mentions","has","the","given","relation","between","them","Args",":","mention_x",":","MentionDataLight","mention_y",":","MentionDataLight","relation",":","RelationType","Returns",":","RelationType",":","relation","in","case","mentions","has","given","relation","or","RelationType.NO_RELATION_FOUND","otherwise"]
code: def extract_sub_relations(
      self,
      mention_x: MentionData,
      mention_y: MentionData,
      relation: RelationType,
  ) -> RelationType:
      """
      Check if input mentions has the given relation between them
  
      Args:
          mention_x: MentionDataLight
          mention_y: MentionDataLight
          relation: RelationType
  
      Returns:
          RelationType: relation in case mentions has given relation or
              RelationType.NO_RELATION_FOUND otherwise
      """
      if relation is not RelationType.WITHIN_DOC_COREF:
          return RelationType.NO_RELATION_FOUND
  
      if mention_x.doc_id == mention_y.doc_id:
          ment_x_coref_chain = self.extract_within_coref(mention_x)
          ment_y_coref_chain = self.extract_within_coref(mention_y)
  
          if not ment_x_coref_chain or not ment_y_coref_chain:
              return RelationType.NO_RELATION_FOUND
  
          if "-" in ment_x_coref_chain or "-" in ment_y_coref_chain:
              return RelationType.NO_RELATION_FOUND
  
          if set(ment_x_coref_chain) == set(ment_y_coref_chain):
              return RelationType.WITHIN_DOC_COREF
  
      return RelationType.NO_RELATION_FOUND
  
file_path: nlp-architect/nlp_architect/data/cdc_resources/relations/within_doc_coref_extraction.py
imports: import logging
  import os
  from typing import List, Set
  from nlp_architect.common.cdc.mention_data import MentionData
  from nlp_architect.data.cdc_resources.relations.relation_extraction import RelationExtraction
  from nlp_architect.data.cdc_resources.relations.relation_types_enums import RelationType
  from nlp_architect.utils.io import load_json_file
label_desc: Use image node_id 4 for calling the WithinDocCoref obj's underlying member method code with example usage: obj.extract_sub_relations(mention_x, mention_y, relation) and returns: RelationType, RelationType, RelationType, RelationType, RelationType