Ejemplo n.º 1
0
 def _convert_kg1_edge_to_swagger_edge(
         self, neo4j_edge: Dict[str, any],
         node_uuid_to_curie_dict: Dict[str, str]) -> Tuple[str, Edge]:
     swagger_edge = Edge()
     swagger_edge_key = f"KG1:{neo4j_edge.get('id')}"
     swagger_edge.predicate = neo4j_edge.get("predicate")
     swagger_edge.subject = node_uuid_to_curie_dict[neo4j_edge.get(
         "source_node_uuid")]
     swagger_edge.object = node_uuid_to_curie_dict[neo4j_edge.get(
         "target_node_uuid")]
     swagger_edge.relation = neo4j_edge.get("relation")
     other_properties = ["provided_by", "probability"]
     swagger_edge.attributes = self._create_swagger_attributes(
         other_properties, neo4j_edge)
     is_defined_by_attribute = Attribute(
         name="is_defined_by",
         value="ARAX/KG1",
         type=eu.get_attribute_type("is_defined_by"))
     swagger_edge.attributes.append(is_defined_by_attribute)
     return swagger_edge_key, swagger_edge
Ejemplo n.º 2
0
 def _convert_kg2_edge_to_swagger_edge(self, neo4j_edge: Dict[str,
                                                              any]) -> Edge:
     swagger_edge = Edge()
     swagger_edge_key = f"KG2:{neo4j_edge.get('id')}"
     swagger_edge.predicate = neo4j_edge.get("simplified_edge_label")
     swagger_edge.subject = neo4j_edge.get("subject")
     swagger_edge.object = neo4j_edge.get("object")
     swagger_edge.relation = neo4j_edge.get("relation")
     # Add additional properties on KG2 edges as swagger Attribute objects
     other_properties = [
         "provided_by", "publications", "negated", "relation_curie",
         "simplified_relation_curie", "simplified_relation", "edge_label"
     ]
     swagger_edge.attributes = self._create_swagger_attributes(
         other_properties, neo4j_edge)
     is_defined_by_attribute = Attribute(
         name="is_defined_by",
         value="ARAX/KG2",
         type=eu.get_attribute_type("is_defined_by"))
     swagger_edge.attributes.append(is_defined_by_attribute)
     return swagger_edge_key, swagger_edge
Ejemplo n.º 3
0
    def _convert_to_swagger_edge(self, subject: str, object: str, name: str,
                                 value: float) -> Tuple[str, Edge]:
        swagger_edge = Edge()
        swagger_edge.predicate = f"biolink:{name}"
        swagger_edge.subject = subject
        swagger_edge.object = object
        swagger_edge_key = f"CHP:{subject}-{name}-{object}"
        swagger_edge.relation = None

        type = "EDAM:data_0951"
        url = "https://github.com/di2ag/chp_client"

        swagger_edge.attributes = [
            Attribute(type=type, name=name, value=str(value), url=url),
            Attribute(name="provided_by",
                      value=self.kp_name,
                      type=eu.get_attribute_type("provided_by")),
            Attribute(name="is_defined_by",
                      value="ARAX",
                      type=eu.get_attribute_type("is_defined_by"))
        ]
        return swagger_edge_key, swagger_edge