class_docstr:     Information Extraction based graph construction class
  
  Parameters
  ----------
  embedding_style: dict
      Specify embedding styles including ``single_token_item``,
      ``emb_strategy``, ``num_rnn_layers``, ``bert_model_name``
      and ``bert_lower_case``.
  vocab: VocabModel
      Vocabulary including all words appeared in graphs.
class_docstr_tok: ["Information","Extraction","based","graph","construction","class","Parameters","--","--","--","--","--","embedding_style",":","dict","Specify","embedding","styles","including","``","single_token_item","``",",","``","emb_strategy","``",",","``","num_rnn_layers","``",",","``","bert_model_name","``","and","``","bert_lower_case","``",".","vocab",":","VocabModel","Vocabulary","including","all","words","appeared","in","graphs","."]
docstr: Parameters
  ----------
  parsed_object: dict
      ``parsed_object`` contains all triples extracted from the raw_text_data.
  
  edge_strategy: None or str, option=[None, "as_node"]
      Strategy to process edge.
      ``None``: It will be the default option.
                Edge information will be preserved in GraphDate.edge_attributes.
      ``as_node``: We will view the edge as a graph node.
                   If there is an edge whose type is ``k`` between node ``i`` and node ``j``,
                   we will insert a node ``k`` into the graph and link node
                   (``i``, ``k``) and (``k``, ``j``).
                   The ``type`` of original nodes will be set as ``ent_node``,
                   while the ``type`` of edge nodes is ``edge_node`.`
  
  Returns
  -------
  graph: GraphData
      graph structure for single sentence
docstr_tok: ["Parameters","--","--","--","--","--","parsed_object",":","dict","``","parsed_object","``","contains","all","triples","extracted","from","the","raw_text_data",".","edge_strategy",":","None","or","str",",","option=","[","None",",","``","as_node","''","]","Strategy","to","process","edge",".","``","None","``",":","It","will","be","the","default","option",".","Edge","information","will","be","preserved","in","GraphDate.edge_attributes",".","``","as_node","``",":","We","will","view","the","edge","as","a","graph","node",".","If","there","is","an","edge","whose","type","is","``","k","``","between","node","``","i","``","and","node","``","j","``",",","we","will","insert","a","node","``","k","``","into","the","graph","and","link","node","(","``","i","``",",","``","k","``",")","and","(","``","k","``",",","``","j","``",")",".","The","``","type","``","of","original","nodes","will","be","set","as","``","ent_node","``",",","while","the","``","type","``","of","edge","nodes","is","``","edge_node","`",".","`","Returns","--","--","--","-","graph",":","GraphData","graph","structure","for","single","sentence"]
code: def _construct_static_graph(cls, parsed_object, edge_strategy=None):
      """
  
      Parameters
      ----------
      parsed_object: dict
          ``parsed_object`` contains all triples extracted from the raw_text_data.
  
      edge_strategy: None or str, option=[None, "as_node"]
          Strategy to process edge.
          ``None``: It will be the default option.
                    Edge information will be preserved in GraphDate.edge_attributes.
          ``as_node``: We will view the edge as a graph node.
                       If there is an edge whose type is ``k`` between node ``i`` and node ``j``,
                       we will insert a node ``k`` into the graph and link node
                       (``i``, ``k``) and (``k``, ``j``).
                       The ``type`` of original nodes will be set as ``ent_node``,
                       while the ``type`` of edge nodes is ``edge_node`.`
  
      Returns
      -------
      graph: GraphData
          graph structure for single sentence
      """
      ret_graph = GraphData()
      node_num = parsed_object["node_num"]
      if node_num == 0:
          raise RuntimeError(
              '"The number of nodes to be added should be greater than 0. (Got {})"'.format(
                  node_num
              )
          )
      ret_graph.add_nodes(node_num)
      for triple_info in parsed_object["graph_content"]:
          if edge_strategy is None:
              ret_graph.add_edge(
                  triple_info["src"]["id"], triple_info["tgt"]["id"]
              )
              eids = ret_graph.edge_ids(
                  triple_info["src"]["id"], triple_info["tgt"]["id"]
              )
              for eid in eids:
                  ret_graph.edge_attributes[eid]["token"] = triple_info[
                      "edge_tokens"
                  ]
          elif edge_strategy == "as_node":
              ret_graph.add_edge(
                  triple_info["src"]["id"], triple_info["tgt"]["id"]
              )
          else:
              raise NotImplementedError()
  
          ret_graph.node_attributes[triple_info["src"]["id"]][
              "token"
          ] = triple_info["src"]["tokens"]
          ret_graph.node_attributes[triple_info["tgt"]["id"]][
              "token"
          ] = triple_info["tgt"]["tokens"]
          if edge_strategy == "as_node":
              ret_graph.node_attributes[triple_info["src"]["id"]][
                  "type"
              ] = triple_info["src"]["type"]
              ret_graph.node_attributes[triple_info["tgt"]["id"]][
                  "type"
              ] = triple_info["tgt"]["type"]
  
      return ret_graph
  
file_path: graph4nlp/graph4nlp/pytorch/modules/graph_construction/ie_graph_construction.py
imports: import json
  from ...data.data import GraphData
  from .base import StaticGraphConstructionBase
label_desc: Use image node_id 5 for calling the IEBasedGraphConstruction obj's underlying member method code with example usage: obj._construct_static_graph(cls, parsed_object, edge_strategy) and returns: ret_graph