upload
This commit is contained in:
		
							
								
								
									
										20466
									
								
								data/FB15k-237/test.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20466
									
								
								data/FB15k-237/test.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										272115
									
								
								data/FB15k-237/train.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										272115
									
								
								data/FB15k-237/train.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										17535
									
								
								data/FB15k-237/valid.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17535
									
								
								data/FB15k-237/valid.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3134
									
								
								data/WN18RR/test.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3134
									
								
								data/WN18RR/test.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										86835
									
								
								data/WN18RR/train.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86835
									
								
								data/WN18RR/train.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										3034
									
								
								data/WN18RR/valid.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3034
									
								
								data/WN18RR/valid.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,2 +0,0 @@
 | 
			
		||||
from .data_module import KGC
 | 
			
		||||
from .processor import convert_examples_to_features, KGProcessor
 | 
			
		||||
@@ -1,63 +0,0 @@
 | 
			
		||||
# Copyright (c) Microsoft Corporation.
 | 
			
		||||
# Licensed under the MIT License.
 | 
			
		||||
 | 
			
		||||
import cython
 | 
			
		||||
from cython.parallel cimport prange, parallel
 | 
			
		||||
cimport numpy
 | 
			
		||||
import numpy
 | 
			
		||||
 | 
			
		||||
def floyd_warshall(adjacency_matrix):
 | 
			
		||||
 | 
			
		||||
    (nrows, ncols) = adjacency_matrix.shape
 | 
			
		||||
    assert nrows == ncols
 | 
			
		||||
    cdef unsigned int n = nrows
 | 
			
		||||
 | 
			
		||||
    adj_mat_copy = adjacency_matrix.astype(long, order='C', casting='safe', copy=True)
 | 
			
		||||
    assert adj_mat_copy.flags['C_CONTIGUOUS']
 | 
			
		||||
    cdef numpy.ndarray[long, ndim=2, mode='c'] M = adj_mat_copy
 | 
			
		||||
    cdef numpy.ndarray[long, ndim=2, mode='c'] path = numpy.zeros([n, n], dtype=numpy.int64)
 | 
			
		||||
 | 
			
		||||
    cdef unsigned int i, j, k
 | 
			
		||||
    cdef long M_ij, M_ik, cost_ikkj
 | 
			
		||||
    cdef long* M_ptr = &M[0,0]
 | 
			
		||||
    cdef long* M_i_ptr
 | 
			
		||||
    cdef long* M_k_ptr
 | 
			
		||||
 | 
			
		||||
    # set unreachable nodes distance to 510
 | 
			
		||||
    for i in range(n):
 | 
			
		||||
        for j in range(n):
 | 
			
		||||
            if i == j:
 | 
			
		||||
                M[i][j] = 0
 | 
			
		||||
            elif M[i][j] == 0:
 | 
			
		||||
                M[i][j] = 510
 | 
			
		||||
 | 
			
		||||
    # floyed algo
 | 
			
		||||
    for k in range(n):
 | 
			
		||||
        M_k_ptr = M_ptr + n*k
 | 
			
		||||
        for i in range(n):
 | 
			
		||||
            M_i_ptr = M_ptr + n*i
 | 
			
		||||
            M_ik = M_i_ptr[k]
 | 
			
		||||
            for j in range(n):
 | 
			
		||||
                cost_ikkj = M_ik + M_k_ptr[j]
 | 
			
		||||
                M_ij = M_i_ptr[j]
 | 
			
		||||
                if M_ij > cost_ikkj:
 | 
			
		||||
                    M_i_ptr[j] = cost_ikkj
 | 
			
		||||
                    path[i][j] = k
 | 
			
		||||
 | 
			
		||||
    # set unreachable path to 510
 | 
			
		||||
    for i in range(n):
 | 
			
		||||
        for j in range(n):
 | 
			
		||||
            if M[i][j] >= 510:
 | 
			
		||||
                path[i][j] = 510
 | 
			
		||||
                M[i][j] = 510
 | 
			
		||||
 | 
			
		||||
    return M, path
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_all_edges(path, i, j):
 | 
			
		||||
    cdef unsigned int k = path[i][j]
 | 
			
		||||
    if k == 0:
 | 
			
		||||
        return []
 | 
			
		||||
    else:
 | 
			
		||||
        return get_all_edges(path, i, k) + [k] + get_all_edges(path, k, j)
 | 
			
		||||
 | 
			
		||||
@@ -1,71 +0,0 @@
 | 
			
		||||
"""Base DataModule class."""
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
from typing import Dict
 | 
			
		||||
import argparse
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
import pytorch_lightning as pl
 | 
			
		||||
from torch.utils.data import DataLoader
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Config(dict):
 | 
			
		||||
    def __getattr__(self, name):
 | 
			
		||||
        return self.get(name)
 | 
			
		||||
 | 
			
		||||
    def __setattr__(self, name, val):
 | 
			
		||||
        self[name] = val
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BATCH_SIZE = 8
 | 
			
		||||
NUM_WORKERS = 8
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BaseDataModule(pl.LightningDataModule):
 | 
			
		||||
    """
 | 
			
		||||
    Base DataModule.
 | 
			
		||||
    Learn more at https://pytorch-lightning.readthedocs.io/en/stable/datamodules.html
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def __init__(self, args: argparse.Namespace = None) -> None:
 | 
			
		||||
        super().__init__()
 | 
			
		||||
        self.args = Config(vars(args)) if args is not None else {}
 | 
			
		||||
        self.batch_size = self.args.get("batch_size", BATCH_SIZE)
 | 
			
		||||
        self.num_workers = self.args.get("num_workers", NUM_WORKERS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def add_to_argparse(parser):
 | 
			
		||||
        parser.add_argument(
 | 
			
		||||
            "--batch_size", type=int, default=BATCH_SIZE, help="Number of examples to operate on per forward step."
 | 
			
		||||
        )
 | 
			
		||||
        parser.add_argument(
 | 
			
		||||
            "--num_workers", type=int, default=0, help="Number of additional processes to load data."
 | 
			
		||||
        )
 | 
			
		||||
        parser.add_argument(
 | 
			
		||||
            "--dataset", type=str, default="./dataset/NELL", help="Number of additional processes to load data."
 | 
			
		||||
        )
 | 
			
		||||
        return parser
 | 
			
		||||
 | 
			
		||||
    def prepare_data(self):
 | 
			
		||||
        """
 | 
			
		||||
        Use this method to do things that might write to disk or that need to be done only from a single GPU in distributed settings (so don't set state `self.x = y`).
 | 
			
		||||
        """
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
    def setup(self, stage=None):
 | 
			
		||||
        """
 | 
			
		||||
        Split into train, val, test, and set dims.
 | 
			
		||||
        Should assign `torch Dataset` objects to self.data_train, self.data_val, and optionally self.data_test.
 | 
			
		||||
        """
 | 
			
		||||
        self.data_train = None
 | 
			
		||||
        self.data_val = None
 | 
			
		||||
        self.data_test = None
 | 
			
		||||
 | 
			
		||||
    def train_dataloader(self):
 | 
			
		||||
        return DataLoader(self.data_train, shuffle=True, batch_size=self.batch_size, num_workers=self.num_workers, pin_memory=True)
 | 
			
		||||
 | 
			
		||||
    def val_dataloader(self):
 | 
			
		||||
        return DataLoader(self.data_val, shuffle=False, batch_size=self.batch_size, num_workers=self.num_workers, pin_memory=True)
 | 
			
		||||
 | 
			
		||||
    def test_dataloader(self):
 | 
			
		||||
        return DataLoader(self.data_test, shuffle=False, batch_size=self.batch_size, num_workers=self.num_workers, pin_memory=True)
 | 
			
		||||
@@ -1,195 +0,0 @@
 | 
			
		||||
from dataclasses import dataclass
 | 
			
		||||
from typing import Any, Callable, Dict, List, NewType, Optional, Tuple, Union
 | 
			
		||||
from enum import Enum
 | 
			
		||||
import torch
 | 
			
		||||
 | 
			
		||||
from torch.utils.data import DataLoader
 | 
			
		||||
from transformers import AutoTokenizer, BertTokenizer
 | 
			
		||||
# from transformers.configuration_bert import BertTokenizer, BertTokenizerFast
 | 
			
		||||
from transformers.tokenization_utils_base import (BatchEncoding,
 | 
			
		||||
                                                  PreTrainedTokenizerBase)
 | 
			
		||||
 | 
			
		||||
from .base_data_module import BaseDataModule
 | 
			
		||||
from .processor import KGProcessor, get_dataset
 | 
			
		||||
import transformers
 | 
			
		||||
transformers.logging.set_verbosity_error()
 | 
			
		||||
 | 
			
		||||
class ExplicitEnum(Enum):
 | 
			
		||||
    """
 | 
			
		||||
    Enum with more explicit error message for missing values.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _missing_(cls, value):
 | 
			
		||||
        raise ValueError(
 | 
			
		||||
            f"{value} is not a valid {cls.__name__}, please select one of {list(cls._value2member_map_.keys())}"
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
class PaddingStrategy(ExplicitEnum):
 | 
			
		||||
    """
 | 
			
		||||
    Possible values for the ``padding`` argument in :meth:`PreTrainedTokenizerBase.__call__`. Useful for tab-completion
 | 
			
		||||
    in an IDE.
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    LONGEST = "longest"
 | 
			
		||||
    MAX_LENGTH = "max_length"
 | 
			
		||||
    DO_NOT_PAD = "do_not_pad"
 | 
			
		||||
 | 
			
		||||
import numpy as np
 | 
			
		||||
 | 
			
		||||
@dataclass
 | 
			
		||||
class DataCollatorForSeq2Seq:
 | 
			
		||||
    """
 | 
			
		||||
    Data collator that will dynamically pad the inputs received, as well as the labels.
 | 
			
		||||
 | 
			
		||||
    Args:
 | 
			
		||||
        tokenizer (:class:`~transformers.PreTrainedTokenizer` or :class:`~transformers.PreTrainedTokenizerFast`):
 | 
			
		||||
            The tokenizer used for encoding the data.
 | 
			
		||||
        model (:class:`~transformers.PreTrainedModel`):
 | 
			
		||||
            The model that is being trained. If set and has the `prepare_decoder_input_ids_from_labels`, use it to
 | 
			
		||||
            prepare the `decoder_input_ids`
 | 
			
		||||
 | 
			
		||||
            This is useful when using `label_smoothing` to avoid calculating loss twice.
 | 
			
		||||
        padding (:obj:`bool`, :obj:`str` or :class:`~transformers.file_utils.PaddingStrategy`, `optional`, defaults to :obj:`True`):
 | 
			
		||||
            Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
 | 
			
		||||
            among:
 | 
			
		||||
 | 
			
		||||
            * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
 | 
			
		||||
              sequence is provided).
 | 
			
		||||
            * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the
 | 
			
		||||
              maximum acceptable input length for the model if that argument is not provided.
 | 
			
		||||
            * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of
 | 
			
		||||
              different lengths).
 | 
			
		||||
        max_length (:obj:`int`, `optional`):
 | 
			
		||||
            Maximum length of the returned list and optionally padding length (see above).
 | 
			
		||||
        pad_to_multiple_of (:obj:`int`, `optional`):
 | 
			
		||||
            If set will pad the sequence to a multiple of the provided value.
 | 
			
		||||
 | 
			
		||||
            This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >=
 | 
			
		||||
            7.5 (Volta).
 | 
			
		||||
        label_pad_token_id (:obj:`int`, `optional`, defaults to -100):
 | 
			
		||||
            The id to use when padding the labels (-100 will be automatically ignored by PyTorch loss functions).
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    tokenizer: PreTrainedTokenizerBase
 | 
			
		||||
    model: Optional[Any] = None
 | 
			
		||||
    padding: Union[bool, str, PaddingStrategy] = True
 | 
			
		||||
    max_length: Optional[int] = None
 | 
			
		||||
    pad_to_multiple_of: Optional[int] = None
 | 
			
		||||
    label_pad_token_id: int = -100
 | 
			
		||||
    return_tensors: str = "pt"
 | 
			
		||||
    num_labels: int = 0
 | 
			
		||||
 | 
			
		||||
    def __call__(self, features, return_tensors=None):
 | 
			
		||||
 | 
			
		||||
        if return_tensors is None:
 | 
			
		||||
            return_tensors = self.return_tensors
 | 
			
		||||
        labels = [feature.pop("labels") for feature in features] if "labels" in features[0].keys() else None
 | 
			
		||||
        label = [feature.pop("label") for feature in features]
 | 
			
		||||
        features_keys = {}
 | 
			
		||||
        name_keys = list(features[0].keys())
 | 
			
		||||
        for k in name_keys:
 | 
			
		||||
            # ignore the padding arguments
 | 
			
		||||
            if k in ["input_ids", "attention_mask", "token_type_ids"]: continue
 | 
			
		||||
            try:
 | 
			
		||||
                features_keys[k] = [feature.pop(k) for feature in features]
 | 
			
		||||
            except KeyError:
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
        # We have to pad the labels before calling `tokenizer.pad` as this method won't pad them and needs them of the
 | 
			
		||||
        # same length to return tensors.
 | 
			
		||||
        bsz = len(labels)
 | 
			
		||||
        with torch.no_grad():
 | 
			
		||||
            new_labels = torch.zeros(bsz, self.num_labels)
 | 
			
		||||
            for i,l in enumerate(labels):
 | 
			
		||||
                if isinstance(l, int): 
 | 
			
		||||
                    new_labels[i][l] = 1
 | 
			
		||||
                else:
 | 
			
		||||
                    for j in l:
 | 
			
		||||
                        new_labels[i][j] = 1
 | 
			
		||||
            labels = new_labels
 | 
			
		||||
 | 
			
		||||
        features = self.tokenizer.pad(
 | 
			
		||||
            features,
 | 
			
		||||
            padding=self.padding,
 | 
			
		||||
            max_length=self.max_length,
 | 
			
		||||
            pad_to_multiple_of=self.pad_to_multiple_of,
 | 
			
		||||
            return_tensors=return_tensors,
 | 
			
		||||
        )
 | 
			
		||||
        features['labels'] = labels
 | 
			
		||||
        features['label'] = torch.tensor(label)
 | 
			
		||||
        features.update(features_keys)
 | 
			
		||||
 | 
			
		||||
        return features
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class KGC(BaseDataModule):
 | 
			
		||||
    def __init__(self, args, model) -> None:
 | 
			
		||||
        super().__init__(args)
 | 
			
		||||
        self.tokenizer = AutoTokenizer.from_pretrained(self.args.model_name_or_path, use_fast=False)
 | 
			
		||||
        self.processor = KGProcessor(self.tokenizer, args)
 | 
			
		||||
        self.label_list = self.processor.get_labels(args.data_dir)
 | 
			
		||||
 | 
			
		||||
        entity_list = self.processor.get_entities(args.data_dir)
 | 
			
		||||
        
 | 
			
		||||
        num_added_tokens = self.tokenizer.add_special_tokens({'additional_special_tokens': entity_list})
 | 
			
		||||
        self.sampler = DataCollatorForSeq2Seq(self.tokenizer,
 | 
			
		||||
            model=model,
 | 
			
		||||
            label_pad_token_id=self.tokenizer.pad_token_id,
 | 
			
		||||
            pad_to_multiple_of=8 if self.args.precision == 16 else None,
 | 
			
		||||
            padding="longest",
 | 
			
		||||
            max_length=self.args.max_seq_length,
 | 
			
		||||
            num_labels = len(entity_list),
 | 
			
		||||
        )
 | 
			
		||||
        relations_tokens = self.processor.get_relations(args.data_dir)
 | 
			
		||||
        self.num_relations = len(relations_tokens)
 | 
			
		||||
        num_added_tokens = self.tokenizer.add_special_tokens({'additional_special_tokens': relations_tokens})
 | 
			
		||||
 | 
			
		||||
        vocab = self.tokenizer.get_added_vocab()
 | 
			
		||||
        self.relation_id_st = vocab[relations_tokens[0]]
 | 
			
		||||
        self.relation_id_ed = vocab[relations_tokens[-1]] + 1
 | 
			
		||||
        self.entity_id_st = vocab[entity_list[0]]
 | 
			
		||||
        self.entity_id_ed = vocab[entity_list[-1]] + 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def setup(self, stage=None):
 | 
			
		||||
        self.data_train = get_dataset(self.args, self.processor, self.label_list, self.tokenizer, "train")
 | 
			
		||||
        self.data_val = get_dataset(self.args, self.processor, self.label_list, self.tokenizer, "dev")
 | 
			
		||||
        self.data_test = get_dataset(self.args, self.processor, self.label_list, self.tokenizer, "test")
 | 
			
		||||
 | 
			
		||||
    def prepare_data(self):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
    def get_config(self):
 | 
			
		||||
        d = {}
 | 
			
		||||
        for k, v in self.__dict__.items():
 | 
			
		||||
            if "st" in k or "ed" in k:
 | 
			
		||||
                d.update({k:v})
 | 
			
		||||
        
 | 
			
		||||
        return d
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def add_to_argparse(parser):
 | 
			
		||||
        BaseDataModule.add_to_argparse(parser)
 | 
			
		||||
        parser.add_argument("--model_name_or_path", type=str, default="roberta-base", help="the name or the path to the pretrained model")
 | 
			
		||||
        parser.add_argument("--data_dir", type=str, default="roberta-base", help="the name or the path to the pretrained model")
 | 
			
		||||
        parser.add_argument("--max_seq_length", type=int, default=256, help="Number of examples to operate on per forward step.")
 | 
			
		||||
        parser.add_argument("--warm_up_radio", type=float, default=0.1, help="Number of examples to operate on per forward step.")
 | 
			
		||||
        parser.add_argument("--eval_batch_size", type=int, default=8)
 | 
			
		||||
        parser.add_argument("--overwrite_cache", action="store_true", default=False)
 | 
			
		||||
        return parser
 | 
			
		||||
 | 
			
		||||
    def get_tokenizer(self):
 | 
			
		||||
        return self.tokenizer
 | 
			
		||||
 | 
			
		||||
    def train_dataloader(self):
 | 
			
		||||
        return DataLoader(self.data_train, num_workers=self.num_workers, pin_memory=True, collate_fn=self.sampler, batch_size=self.args.batch_size, shuffle=not self.args.faiss_init)
 | 
			
		||||
 | 
			
		||||
    def val_dataloader(self):
 | 
			
		||||
        return DataLoader(self.data_val, num_workers=self.num_workers, pin_memory=True, collate_fn=self.sampler, batch_size=self.args.eval_batch_size)
 | 
			
		||||
 | 
			
		||||
    def test_dataloader(self):
 | 
			
		||||
        return DataLoader(self.data_test, num_workers=self.num_workers, pin_memory=True, collate_fn=self.sampler, batch_size=self.args.eval_batch_size)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1074
									
								
								data/kinship/test.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1074
									
								
								data/kinship/test.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										8544
									
								
								data/kinship/train.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8544
									
								
								data/kinship/train.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1068
									
								
								data/kinship/valid.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1068
									
								
								data/kinship/valid.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,954 +0,0 @@
 | 
			
		||||
from hashlib import new
 | 
			
		||||
from re import DEBUG
 | 
			
		||||
 | 
			
		||||
import contextlib
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
from collections import Counter
 | 
			
		||||
from multiprocessing import Pool
 | 
			
		||||
from torch._C import HOIST_CONV_PACKED_PARAMS
 | 
			
		||||
from torch.utils.data import Dataset, Sampler, IterableDataset
 | 
			
		||||
from collections import defaultdict
 | 
			
		||||
from functools import partial
 | 
			
		||||
from multiprocessing import Pool
 | 
			
		||||
import os
 | 
			
		||||
import random
 | 
			
		||||
import json
 | 
			
		||||
import torch
 | 
			
		||||
import copy
 | 
			
		||||
import numpy as np
 | 
			
		||||
import pickle
 | 
			
		||||
from tqdm import tqdm
 | 
			
		||||
from dataclasses import dataclass, asdict, replace
 | 
			
		||||
import inspect
 | 
			
		||||
 | 
			
		||||
from transformers.models.auto.tokenization_auto import AutoTokenizer
 | 
			
		||||
 | 
			
		||||
from models.utils import get_entity_spans_pre_processing
 | 
			
		||||
import pyximport
 | 
			
		||||
 | 
			
		||||
pyximport.install(setup_args={'include_dirs': np.get_include()})
 | 
			
		||||
import data.algos as algos
 | 
			
		||||
 | 
			
		||||
def lmap(a, b):
 | 
			
		||||
    return list(map(a,b))  # a是个函数,b是个值列表,返回函数值列表
 | 
			
		||||
 | 
			
		||||
def cache_results(_cache_fp, _refresh=False, _verbose=1):
 | 
			
		||||
    r"""
 | 
			
		||||
    cache_results是fastNLP中用于cache数据的装饰器。通过下面的例子看一下如何使用::
 | 
			
		||||
 | 
			
		||||
        import time
 | 
			
		||||
        import numpy as np
 | 
			
		||||
        from fastNLP import cache_results
 | 
			
		||||
        
 | 
			
		||||
        @cache_results('cache.pkl')
 | 
			
		||||
        def process_data():
 | 
			
		||||
            # 一些比较耗时的工作,比如读取数据,预处理数据等,这里用time.sleep()代替耗时
 | 
			
		||||
            time.sleep(1)
 | 
			
		||||
            return np.random.randint(10, size=(5,))
 | 
			
		||||
        
 | 
			
		||||
        start_time = time.time()
 | 
			
		||||
        print("res =",process_data())
 | 
			
		||||
        print(time.time() - start_time)
 | 
			
		||||
        
 | 
			
		||||
        start_time = time.time()
 | 
			
		||||
        print("res =",process_data())
 | 
			
		||||
        print(time.time() - start_time)
 | 
			
		||||
        
 | 
			
		||||
        # 输出内容如下,可以看到两次结果相同,且第二次几乎没有花费时间
 | 
			
		||||
        # Save cache to cache.pkl.
 | 
			
		||||
        # res = [5 4 9 1 8]
 | 
			
		||||
        # 1.0042750835418701
 | 
			
		||||
        # Read cache from cache.pkl.
 | 
			
		||||
        # res = [5 4 9 1 8]
 | 
			
		||||
        # 0.0040721893310546875
 | 
			
		||||
 | 
			
		||||
    可以看到第二次运行的时候,只用了0.0001s左右,是由于第二次运行将直接从cache.pkl这个文件读取数据,而不会经过再次预处理::
 | 
			
		||||
 | 
			
		||||
        # 还是以上面的例子为例,如果需要重新生成另一个cache,比如另一个数据集的内容,通过如下的方式调用即可
 | 
			
		||||
        process_data(_cache_fp='cache2.pkl')  # 完全不影响之前的‘cache.pkl'
 | 
			
		||||
 | 
			
		||||
    上面的_cache_fp是cache_results会识别的参数,它将从'cache2.pkl'这里缓存/读取数据,即这里的'cache2.pkl'覆盖默认的
 | 
			
		||||
    'cache.pkl'。如果在你的函数前面加上了@cache_results()则你的函数会增加三个参数[_cache_fp, _refresh, _verbose]。
 | 
			
		||||
    上面的例子即为使用_cache_fp的情况,这三个参数不会传入到你的函数中,当然你写的函数参数名也不可能包含这三个名称::
 | 
			
		||||
 | 
			
		||||
        process_data(_cache_fp='cache2.pkl', _refresh=True)  # 这里强制重新生成一份对预处理的cache。
 | 
			
		||||
        #  _verbose是用于控制输出信息的,如果为0,则不输出任何内容;如果为1,则会提醒当前步骤是读取的cache还是生成了新的cache
 | 
			
		||||
 | 
			
		||||
    :param str _cache_fp: 将返回结果缓存到什么位置;或从什么位置读取缓存。如果为None,cache_results没有任何效用,除非在
 | 
			
		||||
        函数调用的时候传入_cache_fp这个参数。
 | 
			
		||||
    :param bool _refresh: 是否重新生成cache。
 | 
			
		||||
    :param int _verbose: 是否打印cache的信息。
 | 
			
		||||
    :return:
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def wrapper_(func):
 | 
			
		||||
        signature = inspect.signature(func)
 | 
			
		||||
        for key, _ in signature.parameters.items():
 | 
			
		||||
            if key in ('_cache_fp', '_refresh', '_verbose'):
 | 
			
		||||
                raise RuntimeError("The function decorated by cache_results cannot have keyword `{}`.".format(key))
 | 
			
		||||
 | 
			
		||||
        def wrapper(*args, **kwargs):
 | 
			
		||||
            my_args = args[0]
 | 
			
		||||
            mode = args[-1]
 | 
			
		||||
            if '_cache_fp' in kwargs:
 | 
			
		||||
                cache_filepath = kwargs.pop('_cache_fp')
 | 
			
		||||
                assert isinstance(cache_filepath, str), "_cache_fp can only be str."
 | 
			
		||||
            else:
 | 
			
		||||
                cache_filepath = _cache_fp
 | 
			
		||||
            if '_refresh' in kwargs:
 | 
			
		||||
                refresh = kwargs.pop('_refresh')
 | 
			
		||||
                assert isinstance(refresh, bool), "_refresh can only be bool."
 | 
			
		||||
            else:
 | 
			
		||||
                refresh = _refresh
 | 
			
		||||
            if '_verbose' in kwargs:
 | 
			
		||||
                verbose = kwargs.pop('_verbose')
 | 
			
		||||
                assert isinstance(verbose, int), "_verbose can only be integer."
 | 
			
		||||
            else:
 | 
			
		||||
                verbose = _verbose
 | 
			
		||||
            refresh_flag = True
 | 
			
		||||
            
 | 
			
		||||
            model_name = my_args.model_name_or_path.split("/")[-1]
 | 
			
		||||
            is_pretrain = my_args.pretrain
 | 
			
		||||
            cache_filepath = os.path.join(my_args.data_dir, f"cached_{mode}_features{model_name}_pretrain{is_pretrain}_faiss{my_args.faiss_init}_seqlength{my_args.max_seq_length}_{my_args.litmodel_class}.pkl")
 | 
			
		||||
            refresh = my_args.overwrite_cache
 | 
			
		||||
 | 
			
		||||
            if cache_filepath is not None and refresh is False:
 | 
			
		||||
                # load data
 | 
			
		||||
                if os.path.exists(cache_filepath):
 | 
			
		||||
                    with open(cache_filepath, 'rb') as f:
 | 
			
		||||
                        results = pickle.load(f)
 | 
			
		||||
                    if verbose == 1:
 | 
			
		||||
                        logger.info("Read cache from {}.".format(cache_filepath))
 | 
			
		||||
                    refresh_flag = False
 | 
			
		||||
 | 
			
		||||
            if refresh_flag:
 | 
			
		||||
                results = func(*args, **kwargs)
 | 
			
		||||
                if cache_filepath is not None:
 | 
			
		||||
                    if results is None:
 | 
			
		||||
                        raise RuntimeError("The return value is None. Delete the decorator.")
 | 
			
		||||
                    with open(cache_filepath, 'wb') as f:
 | 
			
		||||
                        pickle.dump(results, f)
 | 
			
		||||
                    logger.info("Save cache to {}.".format(cache_filepath))
 | 
			
		||||
 | 
			
		||||
            return results
 | 
			
		||||
 | 
			
		||||
        return wrapper
 | 
			
		||||
 | 
			
		||||
    return wrapper_
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import argparse
 | 
			
		||||
import csv
 | 
			
		||||
import logging
 | 
			
		||||
import os
 | 
			
		||||
import random
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
import numpy as np
 | 
			
		||||
import torch
 | 
			
		||||
from torch.utils.data import (DataLoader, RandomSampler, SequentialSampler,
 | 
			
		||||
                              TensorDataset)
 | 
			
		||||
from torch.utils.data.distributed import DistributedSampler
 | 
			
		||||
from tqdm import tqdm, trange
 | 
			
		||||
 | 
			
		||||
# from torch.nn import CrossEntropyLoss, MSELoss
 | 
			
		||||
# from scipy.stats import pearsonr, spearmanr
 | 
			
		||||
# from sklearn.metrics import matthews_corrcoef, f1_scoreclass 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
 | 
			
		||||
class InputExample(object):
 | 
			
		||||
    """A single training/test example for simple sequence classification."""
 | 
			
		||||
 | 
			
		||||
    def __init__(self, guid, text_a, text_b=None, text_c=None, text_d=None, label=None, real_label=None, en=None, en_id=None, rel=None, text_d_id=None, graph_inf=None):
 | 
			
		||||
        """Constructs a InputExample.
 | 
			
		||||
 | 
			
		||||
        Args:
 | 
			
		||||
            guid: Unique id for the example.
 | 
			
		||||
            text_a: string. The untokenized text of the first sequence. For single
 | 
			
		||||
            sequence tasks, only this sequence must be specified.
 | 
			
		||||
            text_b: (Optional) string. The untokenized text of the second sequence.
 | 
			
		||||
            Only must be specified for sequence pair tasks.
 | 
			
		||||
            text_c: (Optional) string. The untokenized text of the third sequence.
 | 
			
		||||
            Only must be specified for sequence triple tasks.
 | 
			
		||||
            label: (Optional) string. list of entities
 | 
			
		||||
        """
 | 
			
		||||
        self.guid = guid
 | 
			
		||||
        self.text_a = text_a
 | 
			
		||||
        self.text_b = text_b
 | 
			
		||||
        self.text_c = text_c
 | 
			
		||||
        self.text_d = text_d
 | 
			
		||||
        self.label = label
 | 
			
		||||
        self.real_label = real_label
 | 
			
		||||
        self.en = en
 | 
			
		||||
        self.rel = rel # rel id
 | 
			
		||||
        self.text_d_id = text_d_id
 | 
			
		||||
        self.graph_inf = graph_inf
 | 
			
		||||
        self.en_id = en_id
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@dataclass
 | 
			
		||||
class InputFeatures:
 | 
			
		||||
    """A single set of features of data."""
 | 
			
		||||
 | 
			
		||||
    input_ids: torch.Tensor
 | 
			
		||||
    attention_mask: torch.Tensor
 | 
			
		||||
    labels: torch.Tensor = None
 | 
			
		||||
    label: torch.Tensor = None
 | 
			
		||||
    en: torch.Tensor = 0
 | 
			
		||||
    rel: torch.Tensor = 0
 | 
			
		||||
    pos: torch.Tensor = 0
 | 
			
		||||
    graph: torch.Tensor = 0
 | 
			
		||||
    distance_attention: torch.Tensor = 0
 | 
			
		||||
    # attention_bias: torch.Tensor = 0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DataProcessor(object):
 | 
			
		||||
    """Base class for data converters for sequence classification data sets."""
 | 
			
		||||
 | 
			
		||||
    def get_train_examples(self, data_dir):
 | 
			
		||||
        """Gets a collection of `InputExample`s for the train set."""
 | 
			
		||||
        raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
    def get_dev_examples(self, data_dir):
 | 
			
		||||
        """Gets a collection of `InputExample`s for the dev set."""
 | 
			
		||||
        raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
    def get_labels(self, data_dir):
 | 
			
		||||
        """Gets the list of labels for this data set."""
 | 
			
		||||
        raise NotImplementedError()
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _read_tsv(cls, input_file, quotechar=None):
 | 
			
		||||
        """Reads a tab separated value file."""
 | 
			
		||||
        with open(input_file, "r", encoding="utf-8") as f:
 | 
			
		||||
            reader = csv.reader(f, delimiter="\t", quotechar=quotechar)
 | 
			
		||||
            lines = []
 | 
			
		||||
            for line in reader:
 | 
			
		||||
                if sys.version_info[0] == 2:
 | 
			
		||||
                    line = list(unicode(cell, 'utf-8') for cell in line)
 | 
			
		||||
                lines.append(line)
 | 
			
		||||
            return lines
 | 
			
		||||
 | 
			
		||||
import copy
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def solve_get_knowledge_store(line, set_type="train", pretrain=1):
 | 
			
		||||
    """
 | 
			
		||||
    use the LM to get the entity embedding.
 | 
			
		||||
    Transductive: triples + text description
 | 
			
		||||
    Inductive: text description
 | 
			
		||||
    
 | 
			
		||||
    """
 | 
			
		||||
    examples = []
 | 
			
		||||
        
 | 
			
		||||
    head_ent_text = ent2text[line[0]]
 | 
			
		||||
    tail_ent_text = ent2text[line[2]]
 | 
			
		||||
    relation_text = rel2text[line[1]]
 | 
			
		||||
    
 | 
			
		||||
    i=0
 | 
			
		||||
    
 | 
			
		||||
    a = tail_filter_entities["\t".join([line[0],line[1]])]
 | 
			
		||||
    b = head_filter_entities["\t".join([line[2],line[1]])]
 | 
			
		||||
    
 | 
			
		||||
    guid = "%s-%s" % (set_type, i)
 | 
			
		||||
    text_a = head_ent_text
 | 
			
		||||
    text_b = relation_text
 | 
			
		||||
    text_c = tail_ent_text 
 | 
			
		||||
 | 
			
		||||
    # use the description of c to predict A
 | 
			
		||||
    examples.append(
 | 
			
		||||
        InputExample(guid=guid, text_a="[PAD]", text_b=text_b + "[PAD]", text_c = "[PAD]" + " " + text_c, label=lmap(lambda x: ent2id[x], b), real_label=ent2id[line[0]], en=[ent2id[line[0]], rel2id[line[1]], ent2id[line[2]]], rel=0)
 | 
			
		||||
    )
 | 
			
		||||
    examples.append(
 | 
			
		||||
        InputExample(guid=guid, text_a="[PAD]", text_b=text_b + "[PAD]", text_c = "[PAD]" + " " + text_a, label=lmap(lambda x: ent2id[x], b), real_label=ent2id[line[2]], en=[ent2id[line[0]], rel2id[line[1]], ent2id[line[2]]], rel=0)
 | 
			
		||||
    )
 | 
			
		||||
    return examples
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def solve(line,  set_type="train", pretrain=1, max_triplet=32):
 | 
			
		||||
    examples = []
 | 
			
		||||
        
 | 
			
		||||
    head_ent_text = ent2text[line[0]]
 | 
			
		||||
    tail_ent_text = ent2text[line[2]]
 | 
			
		||||
    relation_text = rel2text[line[1]]
 | 
			
		||||
    
 | 
			
		||||
    i=0
 | 
			
		||||
    
 | 
			
		||||
    a = tail_filter_entities["\t".join([line[0],line[1]])]
 | 
			
		||||
    b = head_filter_entities["\t".join([line[2],line[1]])]
 | 
			
		||||
    
 | 
			
		||||
    guid = "%s-%s" % (set_type, i)
 | 
			
		||||
    text_a = head_ent_text
 | 
			
		||||
    text_b = relation_text
 | 
			
		||||
    text_c = tail_ent_text
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    if pretrain:
 | 
			
		||||
        text_a_tokens = text_a.split()
 | 
			
		||||
        for i in range(10):
 | 
			
		||||
            st = random.randint(0, len(text_a_tokens))
 | 
			
		||||
            examples.append(
 | 
			
		||||
                InputExample(guid=guid, text_a="[MASK]", text_b=" ".join(text_a_tokens[st:min(st+64, len(text_a_tokens))]), text_c = "", label=ent2id[line[0]], real_label=ent2id[line[0]], en=0, rel=0)
 | 
			
		||||
            )
 | 
			
		||||
        examples.append(
 | 
			
		||||
            InputExample(guid=guid, text_a="[MASK]", text_b=text_a, text_c = "", label=ent2id[line[0]], real_label=ent2id[line[0]], en=0, rel=0)
 | 
			
		||||
        )
 | 
			
		||||
        # examples.append(
 | 
			
		||||
        #     InputExample(guid=guid, text_a="[MASK]", text_b=text_c, text_c = "", label=ent2id[line[2]], real_label=ent2id[line[2]], en=0, rel=0)
 | 
			
		||||
        # )
 | 
			
		||||
    else:
 | 
			
		||||
        # 主要是对text_c进行包装,不再是原来的文本,而是对应子图的graph(变量graph_seq)。如果mask的是尾实体,那么就让text_c在后面加入graph_seq
 | 
			
		||||
        # masked_head_seq = []
 | 
			
		||||
        # masked_tail_seq = []
 | 
			
		||||
        # masked_tail_graph_list = masked_tail_neighbor["\t".join([line[0],line[1]])]
 | 
			
		||||
        # masked_head_graph_list = masked_head_neighbor["\t".join([line[2],line[1]])]
 | 
			
		||||
        # for item in masked_head_graph_list:
 | 
			
		||||
        #     masked_head_seq.append(ent2id[item[0]])
 | 
			
		||||
        #     masked_head_seq.append(rel2id[item[1]])
 | 
			
		||||
        #     masked_head_seq.append(ent2id[item[2]])
 | 
			
		||||
 | 
			
		||||
        # for item in masked_tail_graph_list:
 | 
			
		||||
        #     masked_tail_seq.append(ent2id[item[0]])
 | 
			
		||||
        #     masked_tail_seq.append(rel2id[item[1]])
 | 
			
		||||
        #     masked_tail_seq.append(ent2id[item[2]])
 | 
			
		||||
 | 
			
		||||
        masked_head_seq = set()
 | 
			
		||||
        masked_head_seq_id = set()
 | 
			
		||||
        masked_tail_seq = set()
 | 
			
		||||
        masked_tail_seq_id = set()
 | 
			
		||||
 | 
			
		||||
        masked_tail_graph_list = masked_tail_neighbor["\t".join([line[0],line[1]])] if len(masked_tail_neighbor["\t".join([line[0],line[1]])]) < max_triplet else \
 | 
			
		||||
            random.sample(masked_tail_neighbor["\t".join([line[0],line[1]])], max_triplet)
 | 
			
		||||
        masked_head_graph_list = masked_head_neighbor["\t".join([line[2],line[1]])] if len(masked_head_neighbor["\t".join([line[2],line[1]])]) < max_triplet else \
 | 
			
		||||
            random.sample(masked_head_neighbor["\t".join([line[2],line[1]])], max_triplet)
 | 
			
		||||
        # masked_tail_graph_list = masked_tail_neighbor["\t".join([line[0],line[1]])][:16]
 | 
			
		||||
        # masked_head_graph_list = masked_head_neighbor["\t".join([line[2],line[1]])][:16]
 | 
			
		||||
        for item in masked_head_graph_list:
 | 
			
		||||
            masked_head_seq.add(item[0])
 | 
			
		||||
            masked_head_seq.add(item[1])
 | 
			
		||||
            masked_head_seq.add(item[2])
 | 
			
		||||
            masked_head_seq_id.add(ent2id[item[0]])
 | 
			
		||||
            masked_head_seq_id.add(rel2id[item[1]])
 | 
			
		||||
            masked_head_seq_id.add(ent2id[item[2]])
 | 
			
		||||
 | 
			
		||||
        for item in masked_tail_graph_list:
 | 
			
		||||
            masked_tail_seq.add(item[0])
 | 
			
		||||
            masked_tail_seq.add(item[1])
 | 
			
		||||
            masked_tail_seq.add(item[2])
 | 
			
		||||
            masked_tail_seq_id.add(ent2id[item[0]])
 | 
			
		||||
            masked_tail_seq_id.add(rel2id[item[1]])
 | 
			
		||||
            masked_tail_seq_id.add(ent2id[item[2]])
 | 
			
		||||
        # print(masked_tail_seq)
 | 
			
		||||
        masked_head_seq = masked_head_seq.difference({line[0]})
 | 
			
		||||
        masked_head_seq = masked_head_seq.difference({line[2]})
 | 
			
		||||
        masked_head_seq = masked_head_seq.difference({line[1]})
 | 
			
		||||
        masked_head_seq_id = masked_head_seq_id.difference({ent2id[line[0]]})
 | 
			
		||||
        masked_head_seq_id = masked_head_seq_id.difference({rel2id[line[1]]})
 | 
			
		||||
        masked_head_seq_id = masked_head_seq_id.difference({ent2id[line[2]]})
 | 
			
		||||
 | 
			
		||||
        masked_tail_seq = masked_tail_seq.difference({line[0]})
 | 
			
		||||
        masked_tail_seq = masked_tail_seq.difference({line[2]})
 | 
			
		||||
        masked_tail_seq = masked_tail_seq.difference({line[1]})
 | 
			
		||||
        masked_tail_seq_id = masked_tail_seq_id.difference({ent2id[line[0]]})
 | 
			
		||||
        masked_tail_seq_id = masked_tail_seq_id.difference({rel2id[line[1]]})
 | 
			
		||||
        masked_tail_seq_id = masked_tail_seq_id.difference({ent2id[line[2]]})
 | 
			
		||||
        # examples.append(
 | 
			
		||||
        #     InputExample(guid=guid, text_a="[MASK]", text_b=' '.join(text_b.split(' ')[:16]) + " [PAD]", text_c = "[PAD]" + " " + ' '.join(text_c.split(' ')[:16]), text_d = masked_head_seq, label=lmap(lambda x: ent2id[x], b), real_label=ent2id[line[0]], en=[rel2id[line[1]], ent2id[line[2]]], rel=rel2id[line[1]]))
 | 
			
		||||
        # examples.append(
 | 
			
		||||
        #     InputExample(guid=guid, text_a="[PAD] ", text_b=' '.join(text_b.split(' ')[:16]) + " [PAD]", text_c = "[MASK]" +" " + ' '.join(text_a.split(' ')[:16]), text_d = masked_tail_seq, label=lmap(lambda x: ent2id[x], a), real_label=ent2id[line[2]], en=[ent2id[line[0]], rel2id[line[1]]], rel=rel2id[line[1]]))
 | 
			
		||||
        examples.append(
 | 
			
		||||
            InputExample(guid=guid, text_a="[MASK]", text_b="[PAD]", text_c = "[PAD]", text_d = list(masked_head_seq), label=lmap(lambda x: ent2id[x], b), real_label=ent2id[line[0]], en=[line[1], line[2]], en_id = [rel2id[line[1]], ent2id[line[2]]], rel=rel2id[line[1]], text_d_id = list(masked_head_seq_id), graph_inf = masked_head_graph_list))
 | 
			
		||||
        examples.append(
 | 
			
		||||
            InputExample(guid=guid, text_a="[PAD]", text_b="[PAD]", text_c = "[MASK]", text_d = list(masked_tail_seq), label=lmap(lambda x: ent2id[x], a), real_label=ent2id[line[2]], en=[line[0], line[1]], en_id = [ent2id[line[0]], rel2id[line[1]]], rel=rel2id[line[1]], text_d_id = list(masked_tail_seq_id), graph_inf = masked_tail_graph_list))
 | 
			
		||||
    return examples
 | 
			
		||||
 | 
			
		||||
def filter_init(head, tail, t1,t2, ent2id_, ent2token_, rel2id_, masked_head_neighbor_, masked_tail_neighbor_, rel2token_):
 | 
			
		||||
    global head_filter_entities
 | 
			
		||||
    global tail_filter_entities
 | 
			
		||||
    global ent2text
 | 
			
		||||
    global rel2text
 | 
			
		||||
    global ent2id
 | 
			
		||||
    global ent2token
 | 
			
		||||
    global rel2id
 | 
			
		||||
    global masked_head_neighbor
 | 
			
		||||
    global masked_tail_neighbor
 | 
			
		||||
    global rel2token
 | 
			
		||||
 | 
			
		||||
    head_filter_entities = head
 | 
			
		||||
    tail_filter_entities = tail
 | 
			
		||||
    ent2text =t1
 | 
			
		||||
    rel2text =t2
 | 
			
		||||
    ent2id = ent2id_
 | 
			
		||||
    ent2token = ent2token_
 | 
			
		||||
    rel2id = rel2id_
 | 
			
		||||
    masked_head_neighbor = masked_head_neighbor_
 | 
			
		||||
    masked_tail_neighbor = masked_tail_neighbor_
 | 
			
		||||
    rel2token = rel2token_
 | 
			
		||||
 | 
			
		||||
def delete_init(ent2text_):
 | 
			
		||||
    global ent2text
 | 
			
		||||
    ent2text = ent2text_
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class KGProcessor(DataProcessor):
 | 
			
		||||
    """Processor for knowledge graph data set."""
 | 
			
		||||
    def __init__(self, tokenizer, args):
 | 
			
		||||
        self.labels = set()
 | 
			
		||||
        self.tokenizer = tokenizer
 | 
			
		||||
        self.args = args
 | 
			
		||||
        self.entity_path = os.path.join(args.data_dir, "entity2textlong.txt") if os.path.exists(os.path.join(args.data_dir, 'entity2textlong.txt')) \
 | 
			
		||||
        else os.path.join(args.data_dir, "entity2text.txt")
 | 
			
		||||
    
 | 
			
		||||
    def get_train_examples(self, data_dir):
 | 
			
		||||
        """See base class."""
 | 
			
		||||
        return self._create_examples(
 | 
			
		||||
            self._read_tsv(os.path.join(data_dir, "train.tsv")), "train", data_dir, self.args)
 | 
			
		||||
 | 
			
		||||
    def get_dev_examples(self, data_dir):
 | 
			
		||||
        """See base class."""
 | 
			
		||||
        return self._create_examples(
 | 
			
		||||
            self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev", data_dir, self.args)
 | 
			
		||||
 | 
			
		||||
    def get_test_examples(self, data_dir, chunk=""):
 | 
			
		||||
      """See base class."""
 | 
			
		||||
      return self._create_examples(
 | 
			
		||||
          self._read_tsv(os.path.join(data_dir, f"test{chunk}.tsv")), "test", data_dir, self.args)
 | 
			
		||||
 | 
			
		||||
    def get_relations(self, data_dir):
 | 
			
		||||
        """Gets all labels (relations) in the knowledge graph."""
 | 
			
		||||
        # return list(self.labels)
 | 
			
		||||
        with open(os.path.join(data_dir, "relations.txt"), 'r') as f:
 | 
			
		||||
            lines = f.readlines()
 | 
			
		||||
            relations = []
 | 
			
		||||
            for line in lines:
 | 
			
		||||
                relations.append(line.strip().split('\t')[0])
 | 
			
		||||
        rel2token = {ent : f"[RELATION_{i}]" for i, ent in enumerate(relations)}
 | 
			
		||||
        return list(rel2token.values())
 | 
			
		||||
 | 
			
		||||
    def get_labels(self, data_dir):
 | 
			
		||||
        """Gets all labels (0, 1) for triples in the knowledge graph."""
 | 
			
		||||
        relation = []
 | 
			
		||||
        with open(os.path.join(data_dir, "relation2text.txt"), 'r') as f:
 | 
			
		||||
            lines = f.readlines()
 | 
			
		||||
            entities = []
 | 
			
		||||
            for line in lines:
 | 
			
		||||
                relation.append(line.strip().split("\t")[-1])
 | 
			
		||||
        return relation
 | 
			
		||||
 | 
			
		||||
    def get_entities(self, data_dir):
 | 
			
		||||
        """Gets all entities in the knowledge graph."""
 | 
			
		||||
        with open(self.entity_path, 'r') as f:
 | 
			
		||||
            lines = f.readlines()
 | 
			
		||||
            entities = []
 | 
			
		||||
            for line in lines:
 | 
			
		||||
                entities.append(line.strip().split("\t")[0])
 | 
			
		||||
        
 | 
			
		||||
        ent2token = {ent : f"[ENTITY_{i}]" for i, ent in enumerate(entities)}
 | 
			
		||||
        return list(ent2token.values())
 | 
			
		||||
 | 
			
		||||
    def get_train_triples(self, data_dir):
 | 
			
		||||
        """Gets training triples."""
 | 
			
		||||
        return self._read_tsv(os.path.join(data_dir, "train.tsv"))
 | 
			
		||||
 | 
			
		||||
    def get_dev_triples(self, data_dir):
 | 
			
		||||
        """Gets validation triples."""
 | 
			
		||||
        return self._read_tsv(os.path.join(data_dir, "dev.tsv"))
 | 
			
		||||
 | 
			
		||||
    def get_test_triples(self, data_dir, chunk=""):
 | 
			
		||||
        """Gets test triples."""
 | 
			
		||||
        return self._read_tsv(os.path.join(data_dir, f"test{chunk}.tsv"))
 | 
			
		||||
 | 
			
		||||
    def _create_examples(self, lines, set_type, data_dir, args):
 | 
			
		||||
        """Creates examples for the training and dev sets."""
 | 
			
		||||
        # entity to text
 | 
			
		||||
        ent2text = {}
 | 
			
		||||
        ent2text_with_type = {}
 | 
			
		||||
        with open(self.entity_path, 'r') as f:
 | 
			
		||||
            ent_lines = f.readlines()
 | 
			
		||||
            for line in ent_lines:
 | 
			
		||||
                temp = line.strip().split('\t')
 | 
			
		||||
                try:
 | 
			
		||||
                    end = temp[1]#.find(',')
 | 
			
		||||
                    if "wiki" in data_dir:
 | 
			
		||||
                        assert "Q" in temp[0]
 | 
			
		||||
                    ent2text[temp[0]] = temp[1].replace("\\n", " ").replace("\\", "") #[:end]
 | 
			
		||||
                except IndexError:
 | 
			
		||||
                    # continue
 | 
			
		||||
                    end = " "#.find(',')
 | 
			
		||||
                    if "wiki" in data_dir:
 | 
			
		||||
                        assert "Q" in temp[0]
 | 
			
		||||
                    ent2text[temp[0]] = end #[:end]
 | 
			
		||||
  
 | 
			
		||||
        entities = list(ent2text.keys())
 | 
			
		||||
        ent2token = {ent : f"[ENTITY_{i}]" for i, ent in enumerate(entities)}
 | 
			
		||||
        ent2id = {ent : i for i, ent in enumerate(entities)}
 | 
			
		||||
        
 | 
			
		||||
        rel2text = {}
 | 
			
		||||
        with open(os.path.join(data_dir, "relation2text.txt"), 'r') as f:
 | 
			
		||||
            rel_lines = f.readlines()
 | 
			
		||||
            for line in rel_lines:
 | 
			
		||||
                temp = line.strip().split('\t')
 | 
			
		||||
                rel2text[temp[0]] = temp[1]      
 | 
			
		||||
 | 
			
		||||
        relation_names = {}
 | 
			
		||||
        with open(os.path.join(data_dir, "relations.txt"), "r") as file:
 | 
			
		||||
            for line in file.readlines():
 | 
			
		||||
                t = line.strip()
 | 
			
		||||
                relation_names[t] = rel2text[t]
 | 
			
		||||
 | 
			
		||||
        tmp_lines = []
 | 
			
		||||
        not_in_text = 0
 | 
			
		||||
        for line in tqdm(lines, desc="delete entities without text name."):
 | 
			
		||||
            if (line[0] not in ent2text) or (line[2] not in ent2text) or (line[1] not in rel2text):
 | 
			
		||||
                not_in_text += 1
 | 
			
		||||
                continue
 | 
			
		||||
            tmp_lines.append(line)
 | 
			
		||||
        lines = tmp_lines
 | 
			
		||||
        print(f"total entity not in text : {not_in_text} ")
 | 
			
		||||
 | 
			
		||||
        relations = list(rel2text.keys())
 | 
			
		||||
        rel2token = {rel : f"[RELATION_{i}]" for i, rel in enumerate(relations)}
 | 
			
		||||
        # rel id -> relation token id
 | 
			
		||||
        num_entities = len(self.get_entities(args.data_dir))
 | 
			
		||||
        rel2id = {w:i+num_entities for i,w in enumerate(relation_names.keys())}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        with open(os.path.join(data_dir, "masked_head_neighbor.txt"), 'r') as file:
 | 
			
		||||
            masked_head_neighbor = json.load(file)
 | 
			
		||||
 | 
			
		||||
        with open(os.path.join(data_dir, "masked_tail_neighbor.txt"), 'r') as file:
 | 
			
		||||
            masked_tail_neighbor = json.load(file)
 | 
			
		||||
        
 | 
			
		||||
        examples = []
 | 
			
		||||
        # head filter head entity
 | 
			
		||||
        head_filter_entities = defaultdict(list)
 | 
			
		||||
        tail_filter_entities = defaultdict(list)
 | 
			
		||||
 | 
			
		||||
        dataset_list = ["train.tsv", "dev.tsv", "test.tsv"]
 | 
			
		||||
        # in training, only use the train triples
 | 
			
		||||
        if set_type == "train" and not args.pretrain: dataset_list = dataset_list[0:1]
 | 
			
		||||
        for m in dataset_list:
 | 
			
		||||
            with open(os.path.join(data_dir, m), 'r') as file:
 | 
			
		||||
                train_lines = file.readlines()
 | 
			
		||||
                for idx in range(len(train_lines)):
 | 
			
		||||
                    train_lines[idx] = train_lines[idx].strip().split("\t")
 | 
			
		||||
 | 
			
		||||
            for line in train_lines:
 | 
			
		||||
                tail_filter_entities["\t".join([line[0], line[1]])].append(line[2])
 | 
			
		||||
                head_filter_entities["\t".join([line[2], line[1]])].append(line[0])
 | 
			
		||||
        
 | 
			
		||||
        max_head_entities = max(len(_) for _ in head_filter_entities.values())
 | 
			
		||||
        max_tail_entities = max(len(_) for _ in tail_filter_entities.values())
 | 
			
		||||
 | 
			
		||||
        # use bce loss, ignore the mlm
 | 
			
		||||
        if set_type == "train" and args.bce:
 | 
			
		||||
            lines = []
 | 
			
		||||
            for k, v in tail_filter_entities.items():
 | 
			
		||||
                h, r = k.split('\t')
 | 
			
		||||
                t = v[0]
 | 
			
		||||
                lines.append([h, r, t])
 | 
			
		||||
            for k, v in head_filter_entities.items():
 | 
			
		||||
                t, r = k.split('\t')
 | 
			
		||||
                h = v[0]
 | 
			
		||||
                lines.append([h, r, t])
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        # for training , select each entity as for get mask embedding.
 | 
			
		||||
        if args.pretrain:
 | 
			
		||||
            rel = list(rel2text.keys())[0]
 | 
			
		||||
            lines = []
 | 
			
		||||
            for k in ent2text.keys():
 | 
			
		||||
                lines.append([k, rel, k])
 | 
			
		||||
        
 | 
			
		||||
        print(f"max number of filter entities : {max_head_entities} {max_tail_entities}")
 | 
			
		||||
        # 把子图信息加入到filter_init中(初始化为文件夹,及固定子图),设置为全局变量,solve中调用
 | 
			
		||||
        from os import cpu_count
 | 
			
		||||
        threads = min(1, cpu_count())
 | 
			
		||||
        filter_init(head_filter_entities, tail_filter_entities,ent2text, rel2text, ent2id, ent2token, rel2id, masked_head_neighbor, masked_tail_neighbor, rel2token
 | 
			
		||||
            )
 | 
			
		||||
        
 | 
			
		||||
        if hasattr(args, "faiss_init") and args.faiss_init:
 | 
			
		||||
            annotate_ = partial(
 | 
			
		||||
                solve_get_knowledge_store,
 | 
			
		||||
                pretrain=self.args.pretrain
 | 
			
		||||
            )
 | 
			
		||||
        else:
 | 
			
		||||
            annotate_ = partial(
 | 
			
		||||
                solve,
 | 
			
		||||
                pretrain=self.args.pretrain,
 | 
			
		||||
                max_triplet=self.args.max_triplet
 | 
			
		||||
            )
 | 
			
		||||
        examples = list(
 | 
			
		||||
            tqdm(
 | 
			
		||||
                map(annotate_, lines),
 | 
			
		||||
                total=len(lines),
 | 
			
		||||
                desc="convert text to examples"
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        tmp_examples = []
 | 
			
		||||
        for e in examples:
 | 
			
		||||
            for ee in e:
 | 
			
		||||
                tmp_examples.append(ee)
 | 
			
		||||
        examples = tmp_examples
 | 
			
		||||
        # delete vars
 | 
			
		||||
        del head_filter_entities, tail_filter_entities, ent2text, rel2text, ent2id, ent2token, rel2id
 | 
			
		||||
        return examples
 | 
			
		||||
 | 
			
		||||
class Verbalizer(object):
 | 
			
		||||
    def __init__(self, args):
 | 
			
		||||
        if "WN18RR" in args.data_dir:
 | 
			
		||||
            self.mode = "WN18RR"
 | 
			
		||||
        elif "FB15k" in args.data_dir:
 | 
			
		||||
            self.mode = "FB15k"
 | 
			
		||||
        elif "umls" in args.data_dir:
 | 
			
		||||
            self.mode = "umls"
 | 
			
		||||
        elif "codexs" in args.data_dir:
 | 
			
		||||
            self.mode = "codexs"
 | 
			
		||||
        elif "FB13" in args.data_dir:
 | 
			
		||||
            self.mode = "FB13"
 | 
			
		||||
        elif "WN11" in args.data_dir:
 | 
			
		||||
            self.mode = "WN11"
 | 
			
		||||
        
 | 
			
		||||
    
 | 
			
		||||
    def _convert(self, head, relation, tail):
 | 
			
		||||
        if self.mode == "umls":
 | 
			
		||||
            return f"The {relation} {head} is "
 | 
			
		||||
        
 | 
			
		||||
        return f"{head} {relation}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class KGCDataset(Dataset):
 | 
			
		||||
    def __init__(self, features):
 | 
			
		||||
        self.features = features
 | 
			
		||||
 | 
			
		||||
    def __getitem__(self, index):
 | 
			
		||||
        return self.features[index]
 | 
			
		||||
    
 | 
			
		||||
    def __len__(self):
 | 
			
		||||
        return len(self.features)
 | 
			
		||||
 | 
			
		||||
def convert_examples_to_features_init(tokenizer_for_convert):
 | 
			
		||||
    global tokenizer
 | 
			
		||||
    tokenizer = tokenizer_for_convert
 | 
			
		||||
 | 
			
		||||
def convert_examples_to_features(example, max_seq_length, mode, pretrain=1):
 | 
			
		||||
    """Loads a data file into a list of `InputBatch`s."""
 | 
			
		||||
    text_a = " ".join(example.text_a.split()[:128])
 | 
			
		||||
    text_b = " ".join(example.text_b.split()[:128])
 | 
			
		||||
    text_c = " ".join(example.text_c.split()[:128])
 | 
			
		||||
    
 | 
			
		||||
    if pretrain:
 | 
			
		||||
        input_text_a = text_a
 | 
			
		||||
        input_text_b = text_b
 | 
			
		||||
    else:
 | 
			
		||||
        input_text_a = " ".join([text_a, text_b])
 | 
			
		||||
        input_text_b = text_c
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    inputs = tokenizer(
 | 
			
		||||
        input_text_a,
 | 
			
		||||
        input_text_b,
 | 
			
		||||
        truncation="longest_first",
 | 
			
		||||
        max_length=max_seq_length,
 | 
			
		||||
        padding="longest",
 | 
			
		||||
        add_special_tokens=True,
 | 
			
		||||
    )
 | 
			
		||||
    # assert tokenizer.mask_token_id in inputs.input_ids, "mask token must in input"
 | 
			
		||||
 | 
			
		||||
    features = asdict(InputFeatures(input_ids=inputs["input_ids"],
 | 
			
		||||
                            attention_mask=inputs['attention_mask'],
 | 
			
		||||
                            labels=torch.tensor(example.label),
 | 
			
		||||
                            label=torch.tensor(example.real_label)
 | 
			
		||||
        )
 | 
			
		||||
    )
 | 
			
		||||
    return features
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def _truncate_seq_pair(tokens_a, tokens_b, max_length):
 | 
			
		||||
    """Truncates a sequence pair in place to the maximum length."""
 | 
			
		||||
 | 
			
		||||
    # This is a simple heuristic which will always truncate the longer sequence
 | 
			
		||||
    # one token at a time. This makes more sense than truncating an equal percent
 | 
			
		||||
    # of tokens from each, since if one sequence is very short then each token
 | 
			
		||||
    # that's truncated likely contains more information than a longer sequence.
 | 
			
		||||
    while True:
 | 
			
		||||
        total_length = len(tokens_a) + len(tokens_b)
 | 
			
		||||
        if total_length <= max_length:
 | 
			
		||||
            break
 | 
			
		||||
        if len(tokens_a) > len(tokens_b):
 | 
			
		||||
            tokens_a.pop()
 | 
			
		||||
        else:
 | 
			
		||||
            tokens_b.pop()
 | 
			
		||||
 | 
			
		||||
def _truncate_seq_triple(tokens_a, tokens_b, tokens_c, max_length):
 | 
			
		||||
    """Truncates a sequence triple in place to the maximum length."""
 | 
			
		||||
 | 
			
		||||
    # This is a simple heuristic which will always truncate the longer sequence
 | 
			
		||||
    # one token at a time. This makes more sense than truncating an equal percent
 | 
			
		||||
    # of tokens from each, since if one sequence is very short then each token
 | 
			
		||||
    # that's truncated likely contains more information than a longer sequence.
 | 
			
		||||
    while True:
 | 
			
		||||
        total_length = len(tokens_a) + len(tokens_b) + len(tokens_c)
 | 
			
		||||
        if total_length <= max_length:
 | 
			
		||||
            break
 | 
			
		||||
        if len(tokens_a) > len(tokens_b) and len(tokens_a) > len(tokens_c):
 | 
			
		||||
            tokens_a.pop()
 | 
			
		||||
        elif len(tokens_b) > len(tokens_a) and len(tokens_b) > len(tokens_c):
 | 
			
		||||
            tokens_b.pop()
 | 
			
		||||
        elif len(tokens_c) > len(tokens_a) and len(tokens_c) > len(tokens_b):
 | 
			
		||||
            tokens_c.pop()
 | 
			
		||||
        else:
 | 
			
		||||
            tokens_c.pop()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@cache_results(_cache_fp="./dataset")
 | 
			
		||||
def get_dataset(args, processor, label_list, tokenizer, mode):
 | 
			
		||||
 | 
			
		||||
    assert mode in ["train", "dev", "test"], "mode must be in train dev test!"
 | 
			
		||||
 | 
			
		||||
    # use training data to construct the entity embedding
 | 
			
		||||
    combine_train_and_test = False
 | 
			
		||||
    if args.faiss_init and mode == "test" and not args.pretrain:
 | 
			
		||||
        mode = "train"
 | 
			
		||||
        if "ind" in args.data_dir: combine_train_and_test = True
 | 
			
		||||
    else:
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
    if mode == "train":
 | 
			
		||||
        train_examples = processor.get_train_examples(args.data_dir)
 | 
			
		||||
    elif mode == "dev":
 | 
			
		||||
        train_examples = processor.get_dev_examples(args.data_dir)
 | 
			
		||||
    else:
 | 
			
		||||
        train_examples = processor.get_test_examples(args.data_dir)
 | 
			
		||||
    
 | 
			
		||||
    if combine_train_and_test:
 | 
			
		||||
        logger.info("use all the dataset for getting the entity mask embedding in pretraining pretraining")
 | 
			
		||||
        logger.info("use all the dataset for getting the entity mask embedding in pretraining pretraining")
 | 
			
		||||
        train_examples = processor.get_test_examples(args.data_dir) + processor.get_train_examples(args.data_dir) + processor.get_dev_examples(args.data_dir)
 | 
			
		||||
 | 
			
		||||
    from os import cpu_count
 | 
			
		||||
    with open(os.path.join(args.data_dir, f"examples_{mode}.txt"), 'w') as file:
 | 
			
		||||
        for line in train_examples:
 | 
			
		||||
            d = {}
 | 
			
		||||
            d.update(line.__dict__)
 | 
			
		||||
            file.write(json.dumps(d) + '\n')
 | 
			
		||||
 | 
			
		||||
    # 这里应该不需要重新from_pretrain,必须沿用加入token的
 | 
			
		||||
    tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path, use_fast=False)
 | 
			
		||||
 | 
			
		||||
    features = []
 | 
			
		||||
 | 
			
		||||
    file_inputs = [os.path.join(args.data_dir, f"examples_{mode}.txt")]
 | 
			
		||||
    file_outputs = [os.path.join(args.data_dir, f"features_{mode}.txt")]
 | 
			
		||||
 | 
			
		||||
    with contextlib.ExitStack() as stack:
 | 
			
		||||
        inputs = [
 | 
			
		||||
            stack.enter_context(open(input, "r", encoding="utf-8"))
 | 
			
		||||
            if input != "-" else sys.stdin
 | 
			
		||||
            for input in file_inputs
 | 
			
		||||
        ]
 | 
			
		||||
        outputs = [
 | 
			
		||||
            stack.enter_context(open(output, "w", encoding="utf-8"))
 | 
			
		||||
            if output != "-" else sys.stdout
 | 
			
		||||
            for output in file_outputs
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
        encoder = MultiprocessingEncoder(tokenizer, args)
 | 
			
		||||
        pool = Pool(16, initializer=encoder.initializer)
 | 
			
		||||
        encoder.initializer()
 | 
			
		||||
        encoded_lines = pool.imap(encoder.encode_lines, zip(*inputs), 1000)
 | 
			
		||||
        # encoded_lines = map(encoder.encode_lines, zip(*inputs))
 | 
			
		||||
 | 
			
		||||
        stats = Counter()
 | 
			
		||||
        for i, (filt, enc_lines) in tqdm(enumerate(encoded_lines, start=1), total=len(train_examples)):
 | 
			
		||||
            if filt == "PASS":
 | 
			
		||||
                for enc_line, output_h in zip(enc_lines, outputs):
 | 
			
		||||
                    features.append(eval(enc_line))
 | 
			
		||||
                    # features.append(enc_line)
 | 
			
		||||
                    # print(enc_line, file=output_h)
 | 
			
		||||
            else:
 | 
			
		||||
                stats["num_filtered_" + filt] += 1
 | 
			
		||||
 | 
			
		||||
        for k, v in stats.most_common():
 | 
			
		||||
            print("[{}] filtered {} lines".format(k, v), file=sys.stderr)
 | 
			
		||||
 | 
			
		||||
    for f_id, f in enumerate(features):
 | 
			
		||||
        en = features[f_id].pop("en")
 | 
			
		||||
        rel = features[f_id].pop("rel")
 | 
			
		||||
        graph = features[f_id].pop("graph")
 | 
			
		||||
        real_label = f['label']
 | 
			
		||||
        features[f_id]['distance_attention'] = torch.Tensor(features[f_id]['distance_attention'])
 | 
			
		||||
        
 | 
			
		||||
        cnt = 0
 | 
			
		||||
        cnt_2 = 0
 | 
			
		||||
        if not isinstance(en, list): break
 | 
			
		||||
 | 
			
		||||
        pos = 0
 | 
			
		||||
        for i,t in enumerate(f['input_ids']):
 | 
			
		||||
            if t == tokenizer.pad_token_id:
 | 
			
		||||
                features[f_id]['input_ids'][i] = en[cnt] + len(tokenizer)
 | 
			
		||||
                cnt += 1
 | 
			
		||||
            if t == tokenizer.unk_token_id:
 | 
			
		||||
                features[f_id]['input_ids'][i] = graph[cnt_2] + len(tokenizer)
 | 
			
		||||
                cnt_2 += 1
 | 
			
		||||
            if features[f_id]['input_ids'][i] == real_label + len(tokenizer):
 | 
			
		||||
                pos = i
 | 
			
		||||
            if cnt_2 == len(graph) and cnt == len(en): break
 | 
			
		||||
            # 如果等于UNK, pop出图节点list,然后替换
 | 
			
		||||
        assert not (args.faiss_init and pos == 0)
 | 
			
		||||
        features[f_id]['pos'] = pos
 | 
			
		||||
 | 
			
		||||
        # for i,t in enumerate(f['input_ids']):
 | 
			
		||||
        #     if t == tokenizer.pad_token_id:
 | 
			
		||||
        #         features[f_id]['input_ids'][i] = rel + len(tokenizer) + num_entities
 | 
			
		||||
        #         break
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
    features = KGCDataset(features)
 | 
			
		||||
    return features
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MultiprocessingEncoder(object):
 | 
			
		||||
    def __init__(self, tokenizer, args):
 | 
			
		||||
        self.tokenizer = tokenizer
 | 
			
		||||
        self.pretrain = args.pretrain
 | 
			
		||||
        self.max_seq_length = args.max_seq_length
 | 
			
		||||
 | 
			
		||||
    def initializer(self):
 | 
			
		||||
        global bpe
 | 
			
		||||
        bpe = self.tokenizer
 | 
			
		||||
 | 
			
		||||
    def encode(self, line):
 | 
			
		||||
        global bpe
 | 
			
		||||
        ids = bpe.encode(line)
 | 
			
		||||
        return list(map(str, ids))
 | 
			
		||||
 | 
			
		||||
    def decode(self, tokens):
 | 
			
		||||
        global bpe
 | 
			
		||||
        return bpe.decode(tokens)
 | 
			
		||||
 | 
			
		||||
    def encode_lines(self, lines):
 | 
			
		||||
        """
 | 
			
		||||
        Encode a set of lines. All lines will be encoded together.
 | 
			
		||||
        """
 | 
			
		||||
        enc_lines = []
 | 
			
		||||
        for line in lines:
 | 
			
		||||
            line = line.strip()
 | 
			
		||||
            if len(line) == 0:
 | 
			
		||||
                return ["EMPTY", None]
 | 
			
		||||
            # enc_lines.append(" ".join(tokens))
 | 
			
		||||
            enc_lines.append(json.dumps(self.convert_examples_to_features(example=eval(line))))
 | 
			
		||||
            # enc_lines.append(" ")
 | 
			
		||||
            # enc_lines.append("123")
 | 
			
		||||
        return ["PASS", enc_lines]
 | 
			
		||||
 | 
			
		||||
    def decode_lines(self, lines):
 | 
			
		||||
        dec_lines = []
 | 
			
		||||
        for line in lines:
 | 
			
		||||
            tokens = map(int, line.strip().split())
 | 
			
		||||
            dec_lines.append(self.decode(tokens))
 | 
			
		||||
        return ["PASS", dec_lines]
 | 
			
		||||
 | 
			
		||||
    def convert_examples_to_features(self, example):
 | 
			
		||||
        pretrain = self.pretrain
 | 
			
		||||
        max_seq_length = self.max_seq_length
 | 
			
		||||
        global bpe
 | 
			
		||||
        """Loads a data file into a list of `InputBatch`s."""
 | 
			
		||||
        # tokens_a = tokenizer.tokenize(example.text_a)
 | 
			
		||||
        # tokens_b = tokenizer.tokenize(example.text_b)
 | 
			
		||||
        # tokens_c = tokenizer.tokenize(example.text_c)
 | 
			
		||||
 | 
			
		||||
        # _truncate_seq_triple(tokens_a, tokens_b, tokens_c, max_length= max_seq_length)
 | 
			
		||||
        # text_a = " ".join(example['text_a'].split()[:128])
 | 
			
		||||
        # text_b = " ".join(example['text_b'].split()[:128])
 | 
			
		||||
        # text_c = " ".join(example['text_c'].split()[:128])
 | 
			
		||||
        
 | 
			
		||||
        text_a = example['text_a']
 | 
			
		||||
        text_b = example['text_b']
 | 
			
		||||
        text_c = example['text_c']
 | 
			
		||||
        text_d = example['text_d']
 | 
			
		||||
        graph_list = example['graph_inf']
 | 
			
		||||
 | 
			
		||||
        if pretrain:
 | 
			
		||||
            # the des of xxx is [MASK] .
 | 
			
		||||
            input_text = f"The description of {text_a} is that {text_b} ."
 | 
			
		||||
            inputs = bpe(
 | 
			
		||||
                input_text,
 | 
			
		||||
                truncation="longest_first",
 | 
			
		||||
                max_length=max_seq_length,
 | 
			
		||||
                padding="longest",
 | 
			
		||||
                add_special_tokens=True,
 | 
			
		||||
            )
 | 
			
		||||
        else:
 | 
			
		||||
            if text_a == "[MASK]":
 | 
			
		||||
                input_text_a = " ".join([text_a, text_b])
 | 
			
		||||
                input_text_b = text_c
 | 
			
		||||
                origin_triplet = ["MASK"] + example['en']
 | 
			
		||||
                graph_seq = ["MASK"] + example['en'] + text_d
 | 
			
		||||
            else:
 | 
			
		||||
                input_text_a = text_a
 | 
			
		||||
                input_text_b = " ".join([text_b, text_c])
 | 
			
		||||
                origin_triplet = example['en'] + ["MASK"]
 | 
			
		||||
                graph_seq = example['en'] + ["MASK"] + text_d
 | 
			
		||||
            # 加入graph信息, 拼接等量[UNK]
 | 
			
		||||
            input_text_b = " ".join(["[CLS]", input_text_a, input_text_b, bpe.unk_token * len(text_d)])
 | 
			
		||||
 | 
			
		||||
            inputs = bpe(
 | 
			
		||||
                input_text_b,
 | 
			
		||||
                truncation="longest_first",
 | 
			
		||||
                max_length=max_seq_length,
 | 
			
		||||
                padding="longest",
 | 
			
		||||
                add_special_tokens=False,
 | 
			
		||||
            )
 | 
			
		||||
        # assert bpe.mask_token_id in inputs.input_ids, "mask token must in input"
 | 
			
		||||
 | 
			
		||||
        # graph_seq = input_text_b[] 把图结构信息读取出来
 | 
			
		||||
        # [CLS] [ENTITY_13258] [RELATION_68] [MASK] [ENTITY_4] [RELATION_127] [ENTITY_8] [RELATION_9] [ENTITY_9011] [ENTITY_12477] [PAD] [PAD]
 | 
			
		||||
        # 获取图结构信息
 | 
			
		||||
        # 首先在solve中加入一个存储所有子图三元组的临时存储变量
 | 
			
		||||
        # 在这里graph_information = example['graph']
 | 
			
		||||
        new_rel = set()
 | 
			
		||||
        new_rel.add(tuple((origin_triplet[0], origin_triplet[1])))
 | 
			
		||||
        new_rel.add(tuple((origin_triplet[1], origin_triplet[0])))
 | 
			
		||||
        new_rel.add(tuple((origin_triplet[1], origin_triplet[2])))
 | 
			
		||||
        new_rel.add(tuple((origin_triplet[2], origin_triplet[1])))
 | 
			
		||||
        for triplet in graph_list:
 | 
			
		||||
            rel1, rel2, rel3, rel4 = tuple((triplet[0], triplet[1])), tuple((triplet[1], triplet[2])), tuple((triplet[1], triplet[0])), tuple((triplet[2], triplet[1]))
 | 
			
		||||
            new_rel.add(rel1)
 | 
			
		||||
            new_rel.add(rel2)
 | 
			
		||||
            new_rel.add(rel3)
 | 
			
		||||
            new_rel.add(rel4)
 | 
			
		||||
        # 这里的三元组转换为new_rel
 | 
			
		||||
        KGid2Graphid_map = defaultdict(int)
 | 
			
		||||
        for i in range(len(graph_seq)):
 | 
			
		||||
            KGid2Graphid_map[graph_seq[i]] = i
 | 
			
		||||
 | 
			
		||||
        N = len(graph_seq)
 | 
			
		||||
        adj = torch.zeros([N, N], dtype=torch.bool)
 | 
			
		||||
        for item in list(new_rel):
 | 
			
		||||
            adj[KGid2Graphid_map[item[0]], KGid2Graphid_map[item[1]]] = True
 | 
			
		||||
        shortest_path_result, _ = algos.floyd_warshall(adj.numpy())
 | 
			
		||||
        max_dist = np.amax(shortest_path_result)
 | 
			
		||||
        # [PAD]部分, [CLS]部分补全, [SEP]额外引入也当作[PAD]处理
 | 
			
		||||
        # 加上一个attention_bias, PAD部分设置为-inf,在送入model前,对其进行处理, 将其相加(让模型无法关注PAD)
 | 
			
		||||
        
 | 
			
		||||
        # 加入attention到huggingface的BertForMaskedLM(这个可能需要再去查查)
 | 
			
		||||
        # attention_bias = torch.zero(N, N, dtype=torch.float)
 | 
			
		||||
        # attention_bias[torch.tensor(shortest_path_result == )]
 | 
			
		||||
        features = asdict(InputFeatures(input_ids=inputs["input_ids"],
 | 
			
		||||
                                attention_mask=inputs['attention_mask'],
 | 
			
		||||
                                labels=example['label'],
 | 
			
		||||
                                label=example['real_label'],
 | 
			
		||||
                                en=example['en_id'],
 | 
			
		||||
                                rel=example['rel'],
 | 
			
		||||
                                graph=example['text_d_id'],
 | 
			
		||||
                                distance_attention = shortest_path_result.tolist(),
 | 
			
		||||
            )
 | 
			
		||||
        )
 | 
			
		||||
        return features
 | 
			
		||||
							
								
								
									
										661
									
								
								data/umls/test.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										661
									
								
								data/umls/test.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,661 @@
 | 
			
		||||
steroid	interacts_with	eicosanoid
 | 
			
		||||
clinical_attribute	isa	conceptual_entity
 | 
			
		||||
body_location_or_region	location_of	physiologic_function
 | 
			
		||||
neoplastic_process	isa	disease_or_syndrome
 | 
			
		||||
carbohydrate	affects	molecular_function
 | 
			
		||||
disease_or_syndrome	affects	organ_or_tissue_function
 | 
			
		||||
substance	issue_in	occupation_or_discipline
 | 
			
		||||
laboratory_or_test_result	evaluation_of	genetic_function
 | 
			
		||||
chemical_viewed_functionally	isa	entity
 | 
			
		||||
organophosphorus_compound	ingredient_of	clinical_drug
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	social_behavior
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	pathologic_function
 | 
			
		||||
amino_acid_peptide_or_protein	interacts_with	antibiotic
 | 
			
		||||
hormone	affects	experimental_model_of_disease
 | 
			
		||||
antibiotic	affects	cell_function
 | 
			
		||||
embryonic_structure	part_of	bird
 | 
			
		||||
tissue	produces	organic_chemical
 | 
			
		||||
genetic_function	process_of	organ_or_tissue_function
 | 
			
		||||
congenital_abnormality	part_of	mammal
 | 
			
		||||
inorganic_chemical	causes	cell_or_molecular_dysfunction
 | 
			
		||||
receptor	disrupts	cell
 | 
			
		||||
professional_society	location_of	laboratory_procedure
 | 
			
		||||
organism_function	co-occurs_with	cell_function
 | 
			
		||||
immunologic_factor	causes	cell_or_molecular_dysfunction
 | 
			
		||||
vitamin	affects	neoplastic_process
 | 
			
		||||
antibiotic	complicates	anatomical_abnormality
 | 
			
		||||
quantitative_concept	measurement_of	physiologic_function
 | 
			
		||||
pathologic_function	affects	biologic_function
 | 
			
		||||
congenital_abnormality	issue_in	occupation_or_discipline
 | 
			
		||||
tissue	adjacent_to	body_space_or_junction
 | 
			
		||||
vitamin	disrupts	organ_or_tissue_function
 | 
			
		||||
receptor	isa	substance
 | 
			
		||||
mental_process	isa	organism_function
 | 
			
		||||
vertebrate	exhibits	individual_behavior
 | 
			
		||||
body_location_or_region	location_of	therapeutic_or_preventive_procedure
 | 
			
		||||
physical_object	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
inorganic_chemical	affects	cell_function
 | 
			
		||||
neoplastic_process	affects	vertebrate
 | 
			
		||||
cell_function	affects	mammal
 | 
			
		||||
population_group	uses	medical_device
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	molecular_function
 | 
			
		||||
pharmacologic_substance	treats	neoplastic_process
 | 
			
		||||
embryonic_structure	location_of	cell_or_molecular_dysfunction
 | 
			
		||||
experimental_model_of_disease	result_of	laboratory_procedure
 | 
			
		||||
enzyme	disrupts	cell_function
 | 
			
		||||
pathologic_function	complicates	injury_or_poisoning
 | 
			
		||||
mental_or_behavioral_dysfunction	degree_of	disease_or_syndrome
 | 
			
		||||
plant	interacts_with	animal
 | 
			
		||||
disease_or_syndrome	process_of	pathologic_function
 | 
			
		||||
pathologic_function	result_of	diagnostic_procedure
 | 
			
		||||
anatomical_abnormality	manifestation_of	biologic_function
 | 
			
		||||
laboratory_or_test_result	manifestation_of	pathologic_function
 | 
			
		||||
fish	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
carbohydrate	affects	cell_or_molecular_dysfunction
 | 
			
		||||
biologic_function	affects	virus
 | 
			
		||||
mental_process	precedes	cell_function
 | 
			
		||||
experimental_model_of_disease	occurs_in	mental_or_behavioral_dysfunction
 | 
			
		||||
congenital_abnormality	part_of	bacterium
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	physiologic_function
 | 
			
		||||
cell	location_of	therapeutic_or_preventive_procedure
 | 
			
		||||
experimental_model_of_disease	process_of	natural_phenomenon_or_process
 | 
			
		||||
neoplastic_process	result_of	phenomenon_or_process
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	affects	organism_function
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	archaeon
 | 
			
		||||
congenital_abnormality	part_of	virus
 | 
			
		||||
pathologic_function	manifestation_of	genetic_function
 | 
			
		||||
biologically_active_substance	causes	mental_or_behavioral_dysfunction
 | 
			
		||||
pharmacologic_substance	treats	disease_or_syndrome
 | 
			
		||||
body_space_or_junction	location_of	cell_function
 | 
			
		||||
genetic_function	affects	virus
 | 
			
		||||
acquired_abnormality	result_of	diagnostic_procedure
 | 
			
		||||
physiologic_function	affects	archaeon
 | 
			
		||||
cell_component	location_of	pathologic_function
 | 
			
		||||
molecular_biology_research_technique	measures	chemical_viewed_functionally
 | 
			
		||||
molecular_function	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
professional_or_occupational_group	uses	manufactured_object
 | 
			
		||||
receptor	disrupts	molecular_function
 | 
			
		||||
organ_or_tissue_function	process_of	biologic_function
 | 
			
		||||
molecular_biology_research_technique	measures	element_ion_or_isotope
 | 
			
		||||
physiologic_function	result_of	experimental_model_of_disease
 | 
			
		||||
physiologic_function	produces	biologically_active_substance
 | 
			
		||||
fully_formed_anatomical_structure	part_of	amphibian
 | 
			
		||||
enzyme	complicates	organism_function
 | 
			
		||||
tissue	location_of	virus
 | 
			
		||||
invertebrate	isa	animal
 | 
			
		||||
mental_process	co-occurs_with	genetic_function
 | 
			
		||||
anatomical_abnormality	location_of	bacterium
 | 
			
		||||
fully_formed_anatomical_structure	location_of	cell_or_molecular_dysfunction
 | 
			
		||||
organ_or_tissue_function	co-occurs_with	genetic_function
 | 
			
		||||
physiologic_function	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
molecular_function	result_of	cell_or_molecular_dysfunction
 | 
			
		||||
diagnostic_procedure	associated_with	pathologic_function
 | 
			
		||||
physiologic_function	result_of	neoplastic_process
 | 
			
		||||
lipid	interacts_with	pharmacologic_substance
 | 
			
		||||
cell_component	produces	receptor
 | 
			
		||||
physiologic_function	result_of	congenital_abnormality
 | 
			
		||||
age_group	performs	machine_activity
 | 
			
		||||
congenital_abnormality	associated_with	organism_attribute
 | 
			
		||||
laboratory_procedure	analyzes	amino_acid_peptide_or_protein
 | 
			
		||||
vitamin	affects	mental_process
 | 
			
		||||
cell_component	part_of	organism
 | 
			
		||||
classification	isa	conceptual_entity
 | 
			
		||||
organism_function	result_of	pathologic_function
 | 
			
		||||
organism_function	produces	vitamin
 | 
			
		||||
laboratory_procedure	diagnoses	mental_or_behavioral_dysfunction
 | 
			
		||||
carbohydrate	affects	pathologic_function
 | 
			
		||||
cell_component	isa	entity
 | 
			
		||||
pathologic_function	affects	organism
 | 
			
		||||
mental_process	affects	bacterium
 | 
			
		||||
laboratory_or_test_result	indicates	organ_or_tissue_function
 | 
			
		||||
tissue	produces	body_substance
 | 
			
		||||
cell_component	part_of	body_part_organ_or_organ_component
 | 
			
		||||
molecular_function	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
carbohydrate	interacts_with	immunologic_factor
 | 
			
		||||
daily_or_recreational_activity	associated_with	acquired_abnormality
 | 
			
		||||
molecular_function	result_of	disease_or_syndrome
 | 
			
		||||
neoplastic_process	occurs_in	injury_or_poisoning
 | 
			
		||||
fully_formed_anatomical_structure	part_of	archaeon
 | 
			
		||||
carbohydrate	affects	mental_process
 | 
			
		||||
element_ion_or_isotope	interacts_with	hazardous_or_poisonous_substance
 | 
			
		||||
injury_or_poisoning	disrupts	molecular_function
 | 
			
		||||
professional_or_occupational_group	interacts_with	population_group
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	archaeon
 | 
			
		||||
organic_chemical	affects	neoplastic_process
 | 
			
		||||
substance	causes	disease_or_syndrome
 | 
			
		||||
biologically_active_substance	causes	disease_or_syndrome
 | 
			
		||||
injury_or_poisoning	disrupts	tissue
 | 
			
		||||
pathologic_function	issue_in	occupation_or_discipline
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	reptile
 | 
			
		||||
acquired_abnormality	manifestation_of	pathologic_function
 | 
			
		||||
element_ion_or_isotope	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
behavior	associated_with	age_group
 | 
			
		||||
disease_or_syndrome	complicates	cell_or_molecular_dysfunction
 | 
			
		||||
fully_formed_anatomical_structure	produces	receptor
 | 
			
		||||
chemical	causes	injury_or_poisoning
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	reptile
 | 
			
		||||
biologic_function	affects	organism_function
 | 
			
		||||
antibiotic	interacts_with	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
biologically_active_substance	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
laboratory_procedure	assesses_effect_of	genetic_function
 | 
			
		||||
research_activity	measures	amino_acid_peptide_or_protein
 | 
			
		||||
disease_or_syndrome	affects	cell_or_molecular_dysfunction
 | 
			
		||||
pathologic_function	result_of	disease_or_syndrome
 | 
			
		||||
disease_or_syndrome	occurs_in	mental_or_behavioral_dysfunction
 | 
			
		||||
social_behavior	associated_with	patient_or_disabled_group
 | 
			
		||||
antibiotic	diagnoses	mental_or_behavioral_dysfunction
 | 
			
		||||
pathologic_function	result_of	organism_function
 | 
			
		||||
plant	interacts_with	reptile
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	amphibian
 | 
			
		||||
sign_or_symptom	diagnoses	mental_or_behavioral_dysfunction
 | 
			
		||||
biologic_function	result_of	mental_or_behavioral_dysfunction
 | 
			
		||||
biologic_function	affects	cell_or_molecular_dysfunction
 | 
			
		||||
anatomical_abnormality	part_of	vertebrate
 | 
			
		||||
family_group	interacts_with	group
 | 
			
		||||
experimental_model_of_disease	process_of	fish
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	natural_phenomenon_or_process
 | 
			
		||||
organism_function	affects	alga
 | 
			
		||||
cell_component	location_of	body_space_or_junction
 | 
			
		||||
body_part_organ_or_organ_component	location_of	genetic_function
 | 
			
		||||
chemical	affects	genetic_function
 | 
			
		||||
chemical_viewed_functionally	affects	physiologic_function
 | 
			
		||||
language	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
body_part_organ_or_organ_component	location_of	organ_or_tissue_function
 | 
			
		||||
research_activity	isa	occupational_activity
 | 
			
		||||
diagnostic_procedure	analyzes	hazardous_or_poisonous_substance
 | 
			
		||||
experimental_model_of_disease	occurs_in	group
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	isa	entity
 | 
			
		||||
diagnostic_procedure	associated_with	congenital_abnormality
 | 
			
		||||
occupational_activity	associated_with	cell_or_molecular_dysfunction
 | 
			
		||||
organ_or_tissue_function	result_of	acquired_abnormality
 | 
			
		||||
molecular_function	affects	cell_function
 | 
			
		||||
chemical_viewed_structurally	ingredient_of	clinical_drug
 | 
			
		||||
mental_or_behavioral_dysfunction	result_of	behavior
 | 
			
		||||
chemical_viewed_structurally	interacts_with	carbohydrate
 | 
			
		||||
cell_function	affects	neoplastic_process
 | 
			
		||||
pathologic_function	occurs_in	mental_or_behavioral_dysfunction
 | 
			
		||||
family_group	performs	therapeutic_or_preventive_procedure
 | 
			
		||||
family_group	produces	research_device
 | 
			
		||||
amino_acid_peptide_or_protein	affects	mental_process
 | 
			
		||||
hormone	complicates	biologic_function
 | 
			
		||||
anatomical_abnormality	result_of	health_care_activity
 | 
			
		||||
organism_function	process_of	biologic_function
 | 
			
		||||
immunologic_factor	complicates	disease_or_syndrome
 | 
			
		||||
nucleotide_sequence	property_of	nucleic_acid_nucleoside_or_nucleotide
 | 
			
		||||
organization	location_of	occupational_activity
 | 
			
		||||
clinical_attribute	result_of	genetic_function
 | 
			
		||||
vitamin	causes	anatomical_abnormality
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	organ_or_tissue_function
 | 
			
		||||
neoplastic_process	result_of	mental_or_behavioral_dysfunction
 | 
			
		||||
body_part_organ_or_organ_component	produces	organic_chemical
 | 
			
		||||
virus	isa	organism
 | 
			
		||||
organ_or_tissue_function	process_of	physiologic_function
 | 
			
		||||
individual_behavior	associated_with	occupation_or_discipline
 | 
			
		||||
hazardous_or_poisonous_substance	affects	disease_or_syndrome
 | 
			
		||||
cell_or_molecular_dysfunction	affects	physiologic_function
 | 
			
		||||
hormone	disrupts	tissue
 | 
			
		||||
molecular_function	affects	animal
 | 
			
		||||
physiologic_function	affects	molecular_function
 | 
			
		||||
biologic_function	affects	physiologic_function
 | 
			
		||||
laboratory_or_test_result	indicates	mental_process
 | 
			
		||||
chemical_viewed_structurally	affects	organ_or_tissue_function
 | 
			
		||||
cell_function	result_of	disease_or_syndrome
 | 
			
		||||
amino_acid_peptide_or_protein	affects	biologic_function
 | 
			
		||||
experimental_model_of_disease	affects	biologic_function
 | 
			
		||||
biomedical_or_dental_material	affects	biologic_function
 | 
			
		||||
molecular_biology_research_technique	measures	amino_acid_peptide_or_protein
 | 
			
		||||
experimental_model_of_disease	affects	bacterium
 | 
			
		||||
antibiotic	affects	organ_or_tissue_function
 | 
			
		||||
human	isa	mammal
 | 
			
		||||
population_group	performs	daily_or_recreational_activity
 | 
			
		||||
cell_component	conceptual_part_of	body_system
 | 
			
		||||
cell	part_of	reptile
 | 
			
		||||
organ_or_tissue_function	affects	human
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	interacts_with	chemical
 | 
			
		||||
cell_or_molecular_dysfunction	result_of	organism_function
 | 
			
		||||
molecular_biology_research_technique	measures	eicosanoid
 | 
			
		||||
molecular_biology_research_technique	measures	natural_phenomenon_or_process
 | 
			
		||||
organism_attribute	result_of	disease_or_syndrome
 | 
			
		||||
pharmacologic_substance	treats	injury_or_poisoning
 | 
			
		||||
genetic_function	affects	biologic_function
 | 
			
		||||
group	exhibits	individual_behavior
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	phenomenon_or_process
 | 
			
		||||
antibiotic	affects	genetic_function
 | 
			
		||||
hormone	interacts_with	enzyme
 | 
			
		||||
pathologic_function	process_of	archaeon
 | 
			
		||||
bird	interacts_with	mammal
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	disrupts	organ_or_tissue_function
 | 
			
		||||
carbohydrate	causes	cell_or_molecular_dysfunction
 | 
			
		||||
cell_function	affects	disease_or_syndrome
 | 
			
		||||
cell	part_of	fungus
 | 
			
		||||
organism_function	process_of	human
 | 
			
		||||
receptor	complicates	mental_or_behavioral_dysfunction
 | 
			
		||||
genetic_function	isa	molecular_function
 | 
			
		||||
mental_or_behavioral_dysfunction	degree_of	cell_or_molecular_dysfunction
 | 
			
		||||
group_attribute	property_of	family_group
 | 
			
		||||
pharmacologic_substance	diagnoses	experimental_model_of_disease
 | 
			
		||||
pathologic_function	affects	alga
 | 
			
		||||
tissue	location_of	biologic_function
 | 
			
		||||
organism_function	co-occurs_with	mental_process
 | 
			
		||||
occupational_activity	associated_with	neoplastic_process
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	affects	genetic_function
 | 
			
		||||
carbohydrate	interacts_with	biomedical_or_dental_material
 | 
			
		||||
organism_function	occurs_in	temporal_concept
 | 
			
		||||
inorganic_chemical	causes	anatomical_abnormality
 | 
			
		||||
cell_or_molecular_dysfunction	affects	organism_function
 | 
			
		||||
amphibian	exhibits	social_behavior
 | 
			
		||||
anatomical_structure	part_of	alga
 | 
			
		||||
lipid	isa	entity
 | 
			
		||||
cell_or_molecular_dysfunction	result_of	disease_or_syndrome
 | 
			
		||||
social_behavior	associated_with	professional_or_occupational_group
 | 
			
		||||
cell	produces	hormone
 | 
			
		||||
invertebrate	isa	entity
 | 
			
		||||
organic_chemical	causes	cell_or_molecular_dysfunction
 | 
			
		||||
acquired_abnormality	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
pathologic_function	manifestation_of	disease_or_syndrome
 | 
			
		||||
chemical_viewed_functionally	issue_in	occupation_or_discipline
 | 
			
		||||
experimental_model_of_disease	co-occurs_with	anatomical_abnormality
 | 
			
		||||
laboratory_procedure	assesses_effect_of	element_ion_or_isotope
 | 
			
		||||
diagnostic_procedure	measures	cell_function
 | 
			
		||||
chemical_viewed_structurally	issue_in	occupation_or_discipline
 | 
			
		||||
genetic_function	affects	disease_or_syndrome
 | 
			
		||||
laboratory_or_test_result	co-occurs_with	sign_or_symptom
 | 
			
		||||
amino_acid_peptide_or_protein	interacts_with	chemical_viewed_functionally
 | 
			
		||||
cell	part_of	bacterium
 | 
			
		||||
cell_function	affects	clinical_attribute
 | 
			
		||||
fully_formed_anatomical_structure	part_of	plant
 | 
			
		||||
chemical_viewed_structurally	interacts_with	lipid
 | 
			
		||||
molecular_biology_research_technique	measures	molecular_function
 | 
			
		||||
fungus	interacts_with	organism
 | 
			
		||||
enzyme	interacts_with	vitamin
 | 
			
		||||
congenital_abnormality	manifestation_of	mental_or_behavioral_dysfunction
 | 
			
		||||
therapeutic_or_preventive_procedure	complicates	pathologic_function
 | 
			
		||||
chemical	affects	organ_or_tissue_function
 | 
			
		||||
virus	location_of	hormone
 | 
			
		||||
organ_or_tissue_function	produces	hormone
 | 
			
		||||
alga	location_of	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
laboratory_procedure	affects	organ_or_tissue_function
 | 
			
		||||
pathologic_function	process_of	invertebrate
 | 
			
		||||
manufactured_object	causes	cell_or_molecular_dysfunction
 | 
			
		||||
neoplastic_process	affects	rickettsia_or_chlamydia
 | 
			
		||||
cell_or_molecular_dysfunction	result_of	acquired_abnormality
 | 
			
		||||
genetic_function	affects	plant
 | 
			
		||||
alga	isa	physical_object
 | 
			
		||||
family_group	performs	laboratory_procedure
 | 
			
		||||
disease_or_syndrome	degree_of	cell_or_molecular_dysfunction
 | 
			
		||||
reptile	exhibits	social_behavior
 | 
			
		||||
therapeutic_or_preventive_procedure	affects	patient_or_disabled_group
 | 
			
		||||
qualitative_concept	evaluation_of	individual_behavior
 | 
			
		||||
population_group	uses	regulation_or_law
 | 
			
		||||
antibiotic	causes	cell_or_molecular_dysfunction
 | 
			
		||||
cell_or_molecular_dysfunction	occurs_in	mental_or_behavioral_dysfunction
 | 
			
		||||
acquired_abnormality	manifestation_of	genetic_function
 | 
			
		||||
bacterium	isa	entity
 | 
			
		||||
experimental_model_of_disease	occurs_in	age_group
 | 
			
		||||
immunologic_factor	causes	congenital_abnormality
 | 
			
		||||
laboratory_procedure	measures	pharmacologic_substance
 | 
			
		||||
disease_or_syndrome	affects	fish
 | 
			
		||||
biologic_function	result_of	neoplastic_process
 | 
			
		||||
therapeutic_or_preventive_procedure	associated_with	acquired_abnormality
 | 
			
		||||
cell	produces	vitamin
 | 
			
		||||
mental_process	process_of	vertebrate
 | 
			
		||||
mental_process	result_of	neoplastic_process
 | 
			
		||||
diagnostic_procedure	diagnoses	cell_or_molecular_dysfunction
 | 
			
		||||
rickettsia_or_chlamydia	location_of	vitamin
 | 
			
		||||
neoplastic_process	manifestation_of	pathologic_function
 | 
			
		||||
disease_or_syndrome	precedes	neoplastic_process
 | 
			
		||||
physiologic_function	result_of	natural_phenomenon_or_process
 | 
			
		||||
laboratory_or_test_result	measurement_of	food
 | 
			
		||||
diagnostic_procedure	assesses_effect_of	element_ion_or_isotope
 | 
			
		||||
vitamin	causes	cell_or_molecular_dysfunction
 | 
			
		||||
carbohydrate_sequence	isa	idea_or_concept
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	injury_or_poisoning
 | 
			
		||||
element_ion_or_isotope	causes	cell_or_molecular_dysfunction
 | 
			
		||||
organic_chemical	causes	congenital_abnormality
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	experimental_model_of_disease
 | 
			
		||||
experimental_model_of_disease	complicates	mental_or_behavioral_dysfunction
 | 
			
		||||
organ_or_tissue_function	isa	natural_phenomenon_or_process
 | 
			
		||||
nucleotide_sequence	isa	molecular_sequence
 | 
			
		||||
physiologic_function	affects	fungus
 | 
			
		||||
experimental_model_of_disease	isa	phenomenon_or_process
 | 
			
		||||
cell_or_molecular_dysfunction	manifestation_of	injury_or_poisoning
 | 
			
		||||
clinical_drug	causes	acquired_abnormality
 | 
			
		||||
cell_component	location_of	genetic_function
 | 
			
		||||
occupational_activity	associated_with	disease_or_syndrome
 | 
			
		||||
laboratory_or_test_result	associated_with	anatomical_abnormality
 | 
			
		||||
age_group	performs	social_behavior
 | 
			
		||||
fully_formed_anatomical_structure	location_of	physiologic_function
 | 
			
		||||
hormone	interacts_with	vitamin
 | 
			
		||||
molecular_function	precedes	organism_function
 | 
			
		||||
human_caused_phenomenon_or_process	isa	event
 | 
			
		||||
professional_or_occupational_group	performs	diagnostic_procedure
 | 
			
		||||
disease_or_syndrome	co-occurs_with	injury_or_poisoning
 | 
			
		||||
mental_process	produces	biologically_active_substance
 | 
			
		||||
molecular_function	produces	hormone
 | 
			
		||||
neoplastic_process	complicates	congenital_abnormality
 | 
			
		||||
neoplastic_process	result_of	mental_process
 | 
			
		||||
eicosanoid	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
health_care_related_organization	isa	entity
 | 
			
		||||
cell_function	isa	biologic_function
 | 
			
		||||
diagnostic_procedure	analyzes	pharmacologic_substance
 | 
			
		||||
immunologic_factor	complicates	genetic_function
 | 
			
		||||
physiologic_function	precedes	genetic_function
 | 
			
		||||
immunologic_factor	complicates	physiologic_function
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	mammal
 | 
			
		||||
immunologic_factor	indicates	neoplastic_process
 | 
			
		||||
neoplastic_process	process_of	genetic_function
 | 
			
		||||
biologic_function	affects	fish
 | 
			
		||||
organ_or_tissue_function	affects	bird
 | 
			
		||||
mental_or_behavioral_dysfunction	result_of	environmental_effect_of_humans
 | 
			
		||||
hazardous_or_poisonous_substance	complicates	neoplastic_process
 | 
			
		||||
cell_or_molecular_dysfunction	result_of	social_behavior
 | 
			
		||||
experimental_model_of_disease	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
element_ion_or_isotope	interacts_with	vitamin
 | 
			
		||||
drug_delivery_device	causes	injury_or_poisoning
 | 
			
		||||
fully_formed_anatomical_structure	location_of	fungus
 | 
			
		||||
fully_formed_anatomical_structure	location_of	bacterium
 | 
			
		||||
natural_phenomenon_or_process	result_of	disease_or_syndrome
 | 
			
		||||
enzyme	complicates	experimental_model_of_disease
 | 
			
		||||
individual_behavior	manifestation_of	mental_or_behavioral_dysfunction
 | 
			
		||||
geographic_area	isa	idea_or_concept
 | 
			
		||||
tissue	isa	fully_formed_anatomical_structure
 | 
			
		||||
sign_or_symptom	diagnoses	experimental_model_of_disease
 | 
			
		||||
educational_activity	associated_with	pathologic_function
 | 
			
		||||
receptor	affects	biologic_function
 | 
			
		||||
organ_or_tissue_function	co-occurs_with	physiologic_function
 | 
			
		||||
mental_or_behavioral_dysfunction	produces	vitamin
 | 
			
		||||
experimental_model_of_disease	result_of	physiologic_function
 | 
			
		||||
hormone	complicates	physiologic_function
 | 
			
		||||
self_help_or_relief_organization	carries_out	educational_activity
 | 
			
		||||
environmental_effect_of_humans	isa	event
 | 
			
		||||
chemical	causes	disease_or_syndrome
 | 
			
		||||
diagnostic_procedure	diagnoses	congenital_abnormality
 | 
			
		||||
cell_component	part_of	human
 | 
			
		||||
experimental_model_of_disease	result_of	health_care_activity
 | 
			
		||||
laboratory_or_test_result	manifestation_of	experimental_model_of_disease
 | 
			
		||||
organism_attribute	measurement_of	mental_process
 | 
			
		||||
cell_function	affects	genetic_function
 | 
			
		||||
anatomical_structure	part_of	plant
 | 
			
		||||
natural_phenomenon_or_process	result_of	pathologic_function
 | 
			
		||||
congenital_abnormality	result_of	experimental_model_of_disease
 | 
			
		||||
organism_function	produces	receptor
 | 
			
		||||
food	causes	neoplastic_process
 | 
			
		||||
hormone	affects	genetic_function
 | 
			
		||||
diagnostic_procedure	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
organ_or_tissue_function	process_of	mental_or_behavioral_dysfunction
 | 
			
		||||
bird	interacts_with	archaeon
 | 
			
		||||
laboratory_procedure	analyzes	organophosphorus_compound
 | 
			
		||||
animal	interacts_with	organism
 | 
			
		||||
laboratory_procedure	assesses_effect_of	disease_or_syndrome
 | 
			
		||||
plant	interacts_with	alga
 | 
			
		||||
therapeutic_or_preventive_procedure	prevents	neoplastic_process
 | 
			
		||||
congenital_abnormality	complicates	anatomical_abnormality
 | 
			
		||||
antibiotic	disrupts	organism_function
 | 
			
		||||
age_group	performs	daily_or_recreational_activity
 | 
			
		||||
gene_or_genome	part_of	plant
 | 
			
		||||
amino_acid_peptide_or_protein	interacts_with	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
pharmacologic_substance	causes	pathologic_function
 | 
			
		||||
lipid	issue_in	occupation_or_discipline
 | 
			
		||||
research_device	causes	anatomical_abnormality
 | 
			
		||||
disease_or_syndrome	process_of	alga
 | 
			
		||||
anatomical_abnormality	result_of	cell_function
 | 
			
		||||
antibiotic	treats	experimental_model_of_disease
 | 
			
		||||
antibiotic	complicates	mental_process
 | 
			
		||||
injury_or_poisoning	result_of	cell_function
 | 
			
		||||
physiologic_function	precedes	organ_or_tissue_function
 | 
			
		||||
genetic_function	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
quantitative_concept	measurement_of	mental_process
 | 
			
		||||
fungus	causes	pathologic_function
 | 
			
		||||
rickettsia_or_chlamydia	location_of	immunologic_factor
 | 
			
		||||
eicosanoid	interacts_with	element_ion_or_isotope
 | 
			
		||||
inorganic_chemical	causes	neoplastic_process
 | 
			
		||||
anatomical_structure	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
immunologic_factor	complicates	injury_or_poisoning
 | 
			
		||||
drug_delivery_device	treats	injury_or_poisoning
 | 
			
		||||
research_device	isa	entity
 | 
			
		||||
biologically_active_substance	interacts_with	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
organophosphorus_compound	interacts_with	biologically_active_substance
 | 
			
		||||
molecular_function	affects	amphibian
 | 
			
		||||
mental_or_behavioral_dysfunction	co-occurs_with	injury_or_poisoning
 | 
			
		||||
neoplastic_process	manifestation_of	experimental_model_of_disease
 | 
			
		||||
bacterium	location_of	biologically_active_substance
 | 
			
		||||
organic_chemical	interacts_with	biomedical_or_dental_material
 | 
			
		||||
physiologic_function	affects	natural_phenomenon_or_process
 | 
			
		||||
laboratory_procedure	isa	health_care_activity
 | 
			
		||||
neoplastic_process	complicates	anatomical_abnormality
 | 
			
		||||
anatomical_abnormality	affects	vertebrate
 | 
			
		||||
clinical_attribute	manifestation_of	organ_or_tissue_function
 | 
			
		||||
embryonic_structure	part_of	fungus
 | 
			
		||||
inorganic_chemical	interacts_with	enzyme
 | 
			
		||||
mental_or_behavioral_dysfunction	co-occurs_with	experimental_model_of_disease
 | 
			
		||||
enzyme	complicates	neoplastic_process
 | 
			
		||||
sign_or_symptom	manifestation_of	organ_or_tissue_function
 | 
			
		||||
organ_or_tissue_function	co-occurs_with	molecular_function
 | 
			
		||||
age_group	isa	group
 | 
			
		||||
steroid	affects	neoplastic_process
 | 
			
		||||
age_group	exhibits	behavior
 | 
			
		||||
disease_or_syndrome	manifestation_of	physiologic_function
 | 
			
		||||
diagnostic_procedure	isa	event
 | 
			
		||||
biologically_active_substance	disrupts	gene_or_genome
 | 
			
		||||
anatomical_abnormality	manifestation_of	mental_process
 | 
			
		||||
cell_function	result_of	physiologic_function
 | 
			
		||||
mental_process	process_of	human
 | 
			
		||||
chemical	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
alga	interacts_with	human
 | 
			
		||||
vitamin	affects	biologic_function
 | 
			
		||||
fully_formed_anatomical_structure	produces	carbohydrate
 | 
			
		||||
environmental_effect_of_humans	result_of	acquired_abnormality
 | 
			
		||||
disease_or_syndrome	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
organic_chemical	interacts_with	steroid
 | 
			
		||||
cell_or_molecular_dysfunction	process_of	natural_phenomenon_or_process
 | 
			
		||||
anatomical_abnormality	part_of	animal
 | 
			
		||||
diagnostic_procedure	uses	drug_delivery_device
 | 
			
		||||
molecular_biology_research_technique	method_of	diagnostic_procedure
 | 
			
		||||
biologically_active_substance	causes	injury_or_poisoning
 | 
			
		||||
anatomical_abnormality	affects	plant
 | 
			
		||||
molecular_function	process_of	invertebrate
 | 
			
		||||
diagnostic_procedure	measures	pharmacologic_substance
 | 
			
		||||
element_ion_or_isotope	affects	molecular_function
 | 
			
		||||
mental_or_behavioral_dysfunction	result_of	neoplastic_process
 | 
			
		||||
machine_activity	isa	activity
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	interacts_with	hormone
 | 
			
		||||
laboratory_procedure	affects	neoplastic_process
 | 
			
		||||
biomedical_or_dental_material	isa	chemical
 | 
			
		||||
pathologic_function	affects	animal
 | 
			
		||||
receptor	causes	pathologic_function
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	causes	anatomical_abnormality
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	affects	cell_or_molecular_dysfunction
 | 
			
		||||
cell_function	affects	rickettsia_or_chlamydia
 | 
			
		||||
embryonic_structure	location_of	virus
 | 
			
		||||
therapeutic_or_preventive_procedure	affects	cell_function
 | 
			
		||||
human	interacts_with	organism
 | 
			
		||||
fungus	causes	disease_or_syndrome
 | 
			
		||||
cell	produces	receptor
 | 
			
		||||
population_group	produces	regulation_or_law
 | 
			
		||||
family_group	performs	research_activity
 | 
			
		||||
vitamin	causes	injury_or_poisoning
 | 
			
		||||
molecular_sequence	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
steroid	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
bacterium	interacts_with	fish
 | 
			
		||||
cell_function	result_of	mental_process
 | 
			
		||||
organism_attribute	property_of	mammal
 | 
			
		||||
anatomical_abnormality	manifestation_of	disease_or_syndrome
 | 
			
		||||
cell_or_molecular_dysfunction	result_of	environmental_effect_of_humans
 | 
			
		||||
physiologic_function	affects	mammal
 | 
			
		||||
fully_formed_anatomical_structure	part_of	bird
 | 
			
		||||
organic_chemical	interacts_with	hormone
 | 
			
		||||
idea_or_concept	issue_in	occupation_or_discipline
 | 
			
		||||
patient_or_disabled_group	uses	research_device
 | 
			
		||||
receptor	causes	acquired_abnormality
 | 
			
		||||
biologic_function	result_of	disease_or_syndrome
 | 
			
		||||
biologically_active_substance	interacts_with	enzyme
 | 
			
		||||
physiologic_function	isa	biologic_function
 | 
			
		||||
antibiotic	complicates	cell_function
 | 
			
		||||
hazardous_or_poisonous_substance	disrupts	mental_process
 | 
			
		||||
pathologic_function	precedes	cell_or_molecular_dysfunction
 | 
			
		||||
organism_attribute	property_of	organism
 | 
			
		||||
organophosphorus_compound	interacts_with	carbohydrate
 | 
			
		||||
bacterium	location_of	receptor
 | 
			
		||||
organ_or_tissue_function	result_of	experimental_model_of_disease
 | 
			
		||||
fully_formed_anatomical_structure	location_of	organism_function
 | 
			
		||||
finding	isa	conceptual_entity
 | 
			
		||||
congenital_abnormality	isa	entity
 | 
			
		||||
tissue	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
natural_phenomenon_or_process	result_of	neoplastic_process
 | 
			
		||||
organism_attribute	manifestation_of	organ_or_tissue_function
 | 
			
		||||
therapeutic_or_preventive_procedure	complicates	cell_function
 | 
			
		||||
population_group	produces	medical_device
 | 
			
		||||
antibiotic	interacts_with	biologically_active_substance
 | 
			
		||||
antibiotic	causes	acquired_abnormality
 | 
			
		||||
cell_function	produces	vitamin
 | 
			
		||||
neoplastic_process	affects	physiologic_function
 | 
			
		||||
environmental_effect_of_humans	result_of	mental_or_behavioral_dysfunction
 | 
			
		||||
organ_or_tissue_function	affects	organism_function
 | 
			
		||||
lipid	affects	pathologic_function
 | 
			
		||||
laboratory_procedure	affects	mental_process
 | 
			
		||||
biologically_active_substance	disrupts	cell_component
 | 
			
		||||
finding	manifestation_of	organism_function
 | 
			
		||||
organism_function	affects	bird
 | 
			
		||||
genetic_function	affects	physiologic_function
 | 
			
		||||
cell_function	result_of	genetic_function
 | 
			
		||||
antibiotic	affects	physiologic_function
 | 
			
		||||
organophosphorus_compound	causes	pathologic_function
 | 
			
		||||
natural_phenomenon_or_process	affects	genetic_function
 | 
			
		||||
neoplastic_process	produces	receptor
 | 
			
		||||
laboratory_procedure	measures	biomedical_or_dental_material
 | 
			
		||||
organism_attribute	measurement_of	molecular_function
 | 
			
		||||
physiologic_function	affects	biologic_function
 | 
			
		||||
experimental_model_of_disease	result_of	neoplastic_process
 | 
			
		||||
alga	interacts_with	virus
 | 
			
		||||
congenital_abnormality	location_of	fungus
 | 
			
		||||
antibiotic	diagnoses	cell_or_molecular_dysfunction
 | 
			
		||||
diagnostic_procedure	measures	temporal_concept
 | 
			
		||||
mental_or_behavioral_dysfunction	result_of	biologic_function
 | 
			
		||||
pharmacologic_substance	complicates	biologic_function
 | 
			
		||||
pharmacologic_substance	disrupts	organism_function
 | 
			
		||||
anatomical_abnormality	result_of	injury_or_poisoning
 | 
			
		||||
fully_formed_anatomical_structure	location_of	molecular_function
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	interacts_with	antibiotic
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	isa	biologically_active_substance
 | 
			
		||||
experimental_model_of_disease	process_of	bacterium
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	interacts_with	chemical
 | 
			
		||||
cell_or_molecular_dysfunction	affects	bird
 | 
			
		||||
laboratory_or_test_result	isa	conceptual_entity
 | 
			
		||||
pathologic_function	associated_with	organism_attribute
 | 
			
		||||
acquired_abnormality	co-occurs_with	injury_or_poisoning
 | 
			
		||||
professional_or_occupational_group	uses	drug_delivery_device
 | 
			
		||||
professional_or_occupational_group	diagnoses	experimental_model_of_disease
 | 
			
		||||
cell_or_molecular_dysfunction	degree_of	neoplastic_process
 | 
			
		||||
neoplastic_process	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
disease_or_syndrome	result_of	mental_process
 | 
			
		||||
neoplastic_process	process_of	bird
 | 
			
		||||
pathologic_function	result_of	anatomical_abnormality
 | 
			
		||||
congenital_abnormality	manifestation_of	disease_or_syndrome
 | 
			
		||||
organism_attribute	result_of	neoplastic_process
 | 
			
		||||
injury_or_poisoning	issue_in	occupation_or_discipline
 | 
			
		||||
receptor	causes	mental_or_behavioral_dysfunction
 | 
			
		||||
clinical_attribute	property_of	bacterium
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	affects	experimental_model_of_disease
 | 
			
		||||
lipid	causes	congenital_abnormality
 | 
			
		||||
chemical_viewed_structurally	interacts_with	chemical_viewed_functionally
 | 
			
		||||
antibiotic	prevents	pathologic_function
 | 
			
		||||
eicosanoid	isa	organic_chemical
 | 
			
		||||
biologically_active_substance	disrupts	organ_or_tissue_function
 | 
			
		||||
organ_or_tissue_function	affects	genetic_function
 | 
			
		||||
antibiotic	affects	neoplastic_process
 | 
			
		||||
fully_formed_anatomical_structure	location_of	virus
 | 
			
		||||
qualitative_concept	evaluation_of	activity
 | 
			
		||||
embryonic_structure	part_of	cell
 | 
			
		||||
enzyme	disrupts	tissue
 | 
			
		||||
governmental_or_regulatory_activity	associated_with	disease_or_syndrome
 | 
			
		||||
gene_or_genome	location_of	mental_process
 | 
			
		||||
neoplastic_process	process_of	organism_function
 | 
			
		||||
pharmacologic_substance	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
receptor	complicates	disease_or_syndrome
 | 
			
		||||
disease_or_syndrome	process_of	genetic_function
 | 
			
		||||
anatomical_abnormality	location_of	virus
 | 
			
		||||
embryonic_structure	part_of	vertebrate
 | 
			
		||||
organism_function	affects	experimental_model_of_disease
 | 
			
		||||
manufactured_object	causes	mental_or_behavioral_dysfunction
 | 
			
		||||
cell	part_of	body_part_organ_or_organ_component
 | 
			
		||||
molecular_function	result_of	experimental_model_of_disease
 | 
			
		||||
medical_device	treats	acquired_abnormality
 | 
			
		||||
disease_or_syndrome	affects	human
 | 
			
		||||
body_part_organ_or_organ_component	location_of	molecular_function
 | 
			
		||||
disease_or_syndrome	occurs_in	neoplastic_process
 | 
			
		||||
vitamin	isa	chemical_viewed_functionally
 | 
			
		||||
cell_component	issue_in	occupation_or_discipline
 | 
			
		||||
cell_component	produces	nucleic_acid_nucleoside_or_nucleotide
 | 
			
		||||
bacterium	isa	organism
 | 
			
		||||
cell_or_molecular_dysfunction	occurs_in	injury_or_poisoning
 | 
			
		||||
hazardous_or_poisonous_substance	issue_in	occupation_or_discipline
 | 
			
		||||
organization	location_of	educational_activity
 | 
			
		||||
tissue	produces	biologically_active_substance
 | 
			
		||||
fungus	isa	physical_object
 | 
			
		||||
organism_function	result_of	phenomenon_or_process
 | 
			
		||||
organism_function	isa	biologic_function
 | 
			
		||||
organic_chemical	interacts_with	nucleic_acid_nucleoside_or_nucleotide
 | 
			
		||||
organic_chemical	affects	natural_phenomenon_or_process
 | 
			
		||||
diagnostic_procedure	associated_with	neoplastic_process
 | 
			
		||||
molecular_function	produces	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	bird
 | 
			
		||||
chemical_viewed_structurally	affects	biologic_function
 | 
			
		||||
experimental_model_of_disease	produces	biologically_active_substance
 | 
			
		||||
mental_or_behavioral_dysfunction	associated_with	organism_attribute
 | 
			
		||||
laboratory_procedure	analyzes	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
organic_chemical	isa	substance
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	plant
 | 
			
		||||
daily_or_recreational_activity	associated_with	experimental_model_of_disease
 | 
			
		||||
mental_process	precedes	organ_or_tissue_function
 | 
			
		||||
chemical	affects	neoplastic_process
 | 
			
		||||
hormone	ingredient_of	clinical_drug
 | 
			
		||||
hormone	isa	biologically_active_substance
 | 
			
		||||
molecular_biology_research_technique	measures	receptor
 | 
			
		||||
experimental_model_of_disease	precedes	neoplastic_process
 | 
			
		||||
pharmacologic_substance	interacts_with	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
virus	interacts_with	fish
 | 
			
		||||
acquired_abnormality	affects	virus
 | 
			
		||||
pathologic_function	result_of	molecular_function
 | 
			
		||||
embryonic_structure	location_of	fungus
 | 
			
		||||
pharmacologic_substance	affects	cell_or_molecular_dysfunction
 | 
			
		||||
biologic_function	result_of	acquired_abnormality
 | 
			
		||||
neoplastic_process	co-occurs_with	anatomical_abnormality
 | 
			
		||||
neoplastic_process	result_of	acquired_abnormality
 | 
			
		||||
body_part_organ_or_organ_component	produces	body_substance
 | 
			
		||||
cell_or_molecular_dysfunction	process_of	mental_or_behavioral_dysfunction
 | 
			
		||||
educational_activity	issue_in	occupation_or_discipline
 | 
			
		||||
pathologic_function	manifestation_of	neoplastic_process
 | 
			
		||||
virus	causes	pathologic_function
 | 
			
		||||
injury_or_poisoning	complicates	experimental_model_of_disease
 | 
			
		||||
eicosanoid	interacts_with	pharmacologic_substance
 | 
			
		||||
molecular_function	result_of	natural_phenomenon_or_process
 | 
			
		||||
neoplastic_process	produces	tissue
 | 
			
		||||
diagnostic_procedure	assesses_effect_of	vitamin
 | 
			
		||||
anatomical_abnormality	manifestation_of	organ_or_tissue_function
 | 
			
		||||
hazardous_or_poisonous_substance	ingredient_of	clinical_drug
 | 
			
		||||
organophosphorus_compound	affects	cell_or_molecular_dysfunction
 | 
			
		||||
laboratory_procedure	measures	organism_attribute
 | 
			
		||||
chemical_viewed_functionally	interacts_with	immunologic_factor
 | 
			
		||||
diagnostic_procedure	diagnoses	disease_or_syndrome
 | 
			
		||||
injury_or_poisoning	complicates	disease_or_syndrome
 | 
			
		||||
molecular_function	result_of	congenital_abnormality
 | 
			
		||||
biologic_function	affects	bacterium
 | 
			
		||||
organism_function	produces	hormone
 | 
			
		||||
individual_behavior	associated_with	neoplastic_process
 | 
			
		||||
natural_phenomenon_or_process	affects	cell_function
 | 
			
		||||
daily_or_recreational_activity	associated_with	pathologic_function
 | 
			
		||||
fully_formed_anatomical_structure	location_of	rickettsia_or_chlamydia
 | 
			
		||||
organ_or_tissue_function	affects	pathologic_function
 | 
			
		||||
neoplastic_process	affects	amphibian
 | 
			
		||||
acquired_abnormality	occurs_in	age_group
 | 
			
		||||
mental_process	affects	organism_attribute
 | 
			
		||||
molecular_biology_research_technique	measures	neoplastic_process
 | 
			
		||||
disease_or_syndrome	occurs_in	patient_or_disabled_group
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	mammal
 | 
			
		||||
environmental_effect_of_humans	isa	phenomenon_or_process
 | 
			
		||||
cell_or_molecular_dysfunction	precedes	experimental_model_of_disease
 | 
			
		||||
laboratory_or_test_result	isa	entity
 | 
			
		||||
virus	interacts_with	archaeon
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	causes	mental_or_behavioral_dysfunction
 | 
			
		||||
anatomical_structure	part_of	fungus
 | 
			
		||||
cell_or_molecular_dysfunction	process_of	bird
 | 
			
		||||
							
								
								
									
										5216
									
								
								data/umls/train.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5216
									
								
								data/umls/train.txt
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										652
									
								
								data/umls/valid.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										652
									
								
								data/umls/valid.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,652 @@
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
patient_or_disabled_group	performs	individual_behavior
 | 
			
		||||
neoplastic_process	process_of	molecular_function
 | 
			
		||||
lipid	affects	biologic_function
 | 
			
		||||
neoplastic_process	affects	alga
 | 
			
		||||
antibiotic	affects	cell_or_molecular_dysfunction
 | 
			
		||||
eicosanoid	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
fully_formed_anatomical_structure	location_of	injury_or_poisoning
 | 
			
		||||
machine_activity	method_of	laboratory_procedure
 | 
			
		||||
cell_or_molecular_dysfunction	isa	pathologic_function
 | 
			
		||||
molecular_biology_research_technique	measures	organism_function
 | 
			
		||||
organism_function	affects	animal
 | 
			
		||||
patient_or_disabled_group	performs	governmental_or_regulatory_activity
 | 
			
		||||
laboratory_procedure	measures	mental_process
 | 
			
		||||
tissue	surrounds	body_space_or_junction
 | 
			
		||||
anatomical_abnormality	affects	organism_function
 | 
			
		||||
plant	location_of	biologically_active_substance
 | 
			
		||||
pathologic_function	degree_of	mental_or_behavioral_dysfunction
 | 
			
		||||
rickettsia_or_chlamydia	location_of	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
steroid	causes	anatomical_abnormality
 | 
			
		||||
organophosphorus_compound	isa	organic_chemical
 | 
			
		||||
amino_acid_peptide_or_protein	interacts_with	eicosanoid
 | 
			
		||||
age_group	produces	research_device
 | 
			
		||||
acquired_abnormality	result_of	genetic_function
 | 
			
		||||
organic_chemical	interacts_with	chemical
 | 
			
		||||
invertebrate	interacts_with	fish
 | 
			
		||||
gene_or_genome	produces	nucleic_acid_nucleoside_or_nucleotide
 | 
			
		||||
enzyme	isa	biologically_active_substance
 | 
			
		||||
cell	location_of	body_space_or_junction
 | 
			
		||||
clinical_attribute	degree_of	organism_attribute
 | 
			
		||||
vitamin	isa	biologically_active_substance
 | 
			
		||||
animal	interacts_with	mammal
 | 
			
		||||
injury_or_poisoning	result_of	experimental_model_of_disease
 | 
			
		||||
organism_function	co-occurs_with	physiologic_function
 | 
			
		||||
amino_acid_peptide_or_protein	interacts_with	biologically_active_substance
 | 
			
		||||
pharmacologic_substance	disrupts	cell_function
 | 
			
		||||
mental_process	process_of	bird
 | 
			
		||||
acquired_abnormality	result_of	social_behavior
 | 
			
		||||
research_activity	measures	temporal_concept
 | 
			
		||||
steroid	isa	substance
 | 
			
		||||
molecular_function	process_of	cell_function
 | 
			
		||||
professional_or_occupational_group	performs	health_care_activity
 | 
			
		||||
disease_or_syndrome	result_of	physiologic_function
 | 
			
		||||
body_location_or_region	location_of	injury_or_poisoning
 | 
			
		||||
antibiotic	complicates	acquired_abnormality
 | 
			
		||||
organophosphorus_compound	interacts_with	amino_acid_peptide_or_protein
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	complicates	injury_or_poisoning
 | 
			
		||||
gene_or_genome	produces	body_substance
 | 
			
		||||
injury_or_poisoning	associated_with	clinical_attribute
 | 
			
		||||
cell_function	affects	human
 | 
			
		||||
finding	associated_with	injury_or_poisoning
 | 
			
		||||
laboratory_procedure	measures	organic_chemical
 | 
			
		||||
disease_or_syndrome	result_of	mental_or_behavioral_dysfunction
 | 
			
		||||
physiologic_function	precedes	mental_process
 | 
			
		||||
body_space_or_junction	issue_in	occupation_or_discipline
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	animal
 | 
			
		||||
acquired_abnormality	result_of	physiologic_function
 | 
			
		||||
acquired_abnormality	result_of	injury_or_poisoning
 | 
			
		||||
idea_or_concept	isa	conceptual_entity
 | 
			
		||||
molecular_function	process_of	archaeon
 | 
			
		||||
anatomical_abnormality	result_of	organism_function
 | 
			
		||||
health_care_related_organization	location_of	molecular_biology_research_technique
 | 
			
		||||
eicosanoid	causes	neoplastic_process
 | 
			
		||||
pathologic_function	precedes	neoplastic_process
 | 
			
		||||
environmental_effect_of_humans	result_of	injury_or_poisoning
 | 
			
		||||
element_ion_or_isotope	causes	neoplastic_process
 | 
			
		||||
molecular_function	affects	vertebrate
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	causes	acquired_abnormality
 | 
			
		||||
steroid	causes	congenital_abnormality
 | 
			
		||||
inorganic_chemical	interacts_with	chemical
 | 
			
		||||
tissue	produces	nucleic_acid_nucleoside_or_nucleotide
 | 
			
		||||
body_part_organ_or_organ_component	location_of	cell_function
 | 
			
		||||
organism_attribute	property_of	animal
 | 
			
		||||
eicosanoid	interacts_with	indicator_reagent_or_diagnostic_aid
 | 
			
		||||
disease_or_syndrome	affects	mental_process
 | 
			
		||||
cell_or_molecular_dysfunction	process_of	disease_or_syndrome
 | 
			
		||||
pathologic_function	result_of	biologic_function
 | 
			
		||||
finding	manifestation_of	mental_or_behavioral_dysfunction
 | 
			
		||||
congenital_abnormality	location_of	bacterium
 | 
			
		||||
biomedical_or_dental_material	causes	neoplastic_process
 | 
			
		||||
chemical_viewed_functionally	interacts_with	biomedical_or_dental_material
 | 
			
		||||
experimental_model_of_disease	process_of	disease_or_syndrome
 | 
			
		||||
pathologic_function	affects	experimental_model_of_disease
 | 
			
		||||
receptor	complicates	pathologic_function
 | 
			
		||||
chemical_viewed_structurally	affects	experimental_model_of_disease
 | 
			
		||||
fish	exhibits	individual_behavior
 | 
			
		||||
immunologic_factor	isa	entity
 | 
			
		||||
diagnostic_procedure	measures	molecular_function
 | 
			
		||||
carbohydrate	isa	entity
 | 
			
		||||
pathologic_function	process_of	plant
 | 
			
		||||
amino_acid_sequence	property_of	gene_or_genome
 | 
			
		||||
cell_or_molecular_dysfunction	affects	biologic_function
 | 
			
		||||
food	isa	entity
 | 
			
		||||
neoplastic_process	process_of	human
 | 
			
		||||
hazardous_or_poisonous_substance	complicates	anatomical_abnormality
 | 
			
		||||
body_location_or_region	location_of	disease_or_syndrome
 | 
			
		||||
cell_function	process_of	animal
 | 
			
		||||
natural_phenomenon_or_process	affects	organ_or_tissue_function
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	isa	chemical_viewed_functionally
 | 
			
		||||
organophosphorus_compound	interacts_with	element_ion_or_isotope
 | 
			
		||||
genetic_function	result_of	disease_or_syndrome
 | 
			
		||||
neoplastic_process	process_of	invertebrate
 | 
			
		||||
laboratory_procedure	assesses_effect_of	experimental_model_of_disease
 | 
			
		||||
alga	isa	organism
 | 
			
		||||
clinical_attribute	measurement_of	organ_or_tissue_function
 | 
			
		||||
human	isa	entity
 | 
			
		||||
molecular_sequence	isa	idea_or_concept
 | 
			
		||||
hazardous_or_poisonous_substance	affects	molecular_function
 | 
			
		||||
amino_acid_peptide_or_protein	isa	chemical_viewed_structurally
 | 
			
		||||
age_group	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
laboratory_or_test_result	measurement_of	element_ion_or_isotope
 | 
			
		||||
organization	location_of	laboratory_procedure
 | 
			
		||||
steroid	isa	organic_chemical
 | 
			
		||||
therapeutic_or_preventive_procedure	affects	disease_or_syndrome
 | 
			
		||||
natural_phenomenon_or_process	result_of	organ_or_tissue_function
 | 
			
		||||
chemical_viewed_functionally	causes	anatomical_abnormality
 | 
			
		||||
geographic_area	associated_with	injury_or_poisoning
 | 
			
		||||
carbohydrate_sequence	result_of	mental_process
 | 
			
		||||
genetic_function	result_of	environmental_effect_of_humans
 | 
			
		||||
biomedical_or_dental_material	affects	cell_or_molecular_dysfunction
 | 
			
		||||
chemical_viewed_functionally	affects	pathologic_function
 | 
			
		||||
molecular_function	affects	archaeon
 | 
			
		||||
neoplastic_process	manifestation_of	organ_or_tissue_function
 | 
			
		||||
tissue	produces	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	causes	cell_or_molecular_dysfunction
 | 
			
		||||
laboratory_or_test_result	evaluation_of	mental_process
 | 
			
		||||
biomedical_or_dental_material	causes	cell_or_molecular_dysfunction
 | 
			
		||||
neoplastic_process	result_of	organ_or_tissue_function
 | 
			
		||||
genetic_function	produces	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
mental_or_behavioral_dysfunction	result_of	organ_or_tissue_function
 | 
			
		||||
mental_process	affects	invertebrate
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	affects	natural_phenomenon_or_process
 | 
			
		||||
mental_or_behavioral_dysfunction	associated_with	pathologic_function
 | 
			
		||||
mental_process	affects	neoplastic_process
 | 
			
		||||
cell_function	affects	biologic_function
 | 
			
		||||
experimental_model_of_disease	manifestation_of	genetic_function
 | 
			
		||||
inorganic_chemical	causes	congenital_abnormality
 | 
			
		||||
laboratory_or_test_result	measurement_of	organic_chemical
 | 
			
		||||
physical_object	isa	entity
 | 
			
		||||
body_location_or_region	location_of	pathologic_function
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	complicates	cell_function
 | 
			
		||||
research_activity	affects	mental_process
 | 
			
		||||
laboratory_procedure	measures	pathologic_function
 | 
			
		||||
amino_acid_peptide_or_protein	causes	cell_or_molecular_dysfunction
 | 
			
		||||
acquired_abnormality	affects	human
 | 
			
		||||
diagnostic_procedure	affects	pathologic_function
 | 
			
		||||
immunologic_factor	complicates	cell_or_molecular_dysfunction
 | 
			
		||||
bacterium	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
receptor	complicates	genetic_function
 | 
			
		||||
neoplastic_process	complicates	experimental_model_of_disease
 | 
			
		||||
organ_or_tissue_function	affects	cell_function
 | 
			
		||||
therapeutic_or_preventive_procedure	isa	health_care_activity
 | 
			
		||||
experimental_model_of_disease	result_of	social_behavior
 | 
			
		||||
therapeutic_or_preventive_procedure	method_of	biomedical_occupation_or_discipline
 | 
			
		||||
eicosanoid	affects	mental_process
 | 
			
		||||
drug_delivery_device	causes	congenital_abnormality
 | 
			
		||||
organism_function	affects	rickettsia_or_chlamydia
 | 
			
		||||
mental_or_behavioral_dysfunction	produces	enzyme
 | 
			
		||||
manufactured_object	causes	neoplastic_process
 | 
			
		||||
chemical_viewed_structurally	interacts_with	immunologic_factor
 | 
			
		||||
cell_function	process_of	fungus
 | 
			
		||||
physiologic_function	process_of	invertebrate
 | 
			
		||||
natural_phenomenon_or_process	result_of	congenital_abnormality
 | 
			
		||||
vitamin	complicates	congenital_abnormality
 | 
			
		||||
gene_or_genome	part_of	body_part_organ_or_organ_component
 | 
			
		||||
disease_or_syndrome	result_of	phenomenon_or_process
 | 
			
		||||
disease_or_syndrome	affects	animal
 | 
			
		||||
patient_or_disabled_group	performs	occupational_activity
 | 
			
		||||
organism_attribute	result_of	organism_function
 | 
			
		||||
biologically_active_substance	affects	pathologic_function
 | 
			
		||||
embryonic_structure	location_of	experimental_model_of_disease
 | 
			
		||||
vitamin	affects	physiologic_function
 | 
			
		||||
medical_device	causes	cell_or_molecular_dysfunction
 | 
			
		||||
research_activity	measures	antibiotic
 | 
			
		||||
drug_delivery_device	treats	acquired_abnormality
 | 
			
		||||
organism	isa	physical_object
 | 
			
		||||
molecular_function	process_of	fungus
 | 
			
		||||
physiologic_function	result_of	organ_or_tissue_function
 | 
			
		||||
antibiotic	prevents	disease_or_syndrome
 | 
			
		||||
medical_device	causes	mental_or_behavioral_dysfunction
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	affects	mental_process
 | 
			
		||||
cell_or_molecular_dysfunction	process_of	physiologic_function
 | 
			
		||||
chemical	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	interacts_with	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
plant	interacts_with	bacterium
 | 
			
		||||
organic_chemical	interacts_with	chemical_viewed_functionally
 | 
			
		||||
experimental_model_of_disease	associated_with	clinical_attribute
 | 
			
		||||
congenital_abnormality	part_of	organism
 | 
			
		||||
gene_or_genome	location_of	experimental_model_of_disease
 | 
			
		||||
body_part_organ_or_organ_component	location_of	fungus
 | 
			
		||||
amino_acid_peptide_or_protein	affects	pathologic_function
 | 
			
		||||
genetic_function	produces	hormone
 | 
			
		||||
laboratory_procedure	associated_with	anatomical_abnormality
 | 
			
		||||
antibiotic	causes	pathologic_function
 | 
			
		||||
acquired_abnormality	affects	physiologic_function
 | 
			
		||||
professional_or_occupational_group	isa	group
 | 
			
		||||
sign_or_symptom	associated_with	acquired_abnormality
 | 
			
		||||
enzyme	causes	congenital_abnormality
 | 
			
		||||
genetic_function	process_of	cell_function
 | 
			
		||||
vitamin	complicates	physiologic_function
 | 
			
		||||
clinical_attribute	measurement_of	molecular_function
 | 
			
		||||
embryonic_structure	location_of	mental_or_behavioral_dysfunction
 | 
			
		||||
injury_or_poisoning	result_of	phenomenon_or_process
 | 
			
		||||
chemical_viewed_structurally	affects	natural_phenomenon_or_process
 | 
			
		||||
cell_function	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
mental_process	affects	social_behavior
 | 
			
		||||
biologic_function	process_of	virus
 | 
			
		||||
diagnostic_procedure	analyzes	indicator_reagent_or_diagnostic_aid
 | 
			
		||||
experimental_model_of_disease	affects	physiologic_function
 | 
			
		||||
virus	location_of	receptor
 | 
			
		||||
qualitative_concept	evaluation_of	health_care_activity
 | 
			
		||||
cell_function	affects	alga
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	biologic_function
 | 
			
		||||
mental_process	process_of	organ_or_tissue_function
 | 
			
		||||
organ_or_tissue_function	result_of	injury_or_poisoning
 | 
			
		||||
neoplastic_process	precedes	cell_or_molecular_dysfunction
 | 
			
		||||
disease_or_syndrome	degree_of	mental_or_behavioral_dysfunction
 | 
			
		||||
patient_or_disabled_group	produces	medical_device
 | 
			
		||||
antibiotic	interacts_with	chemical
 | 
			
		||||
disease_or_syndrome	manifestation_of	neoplastic_process
 | 
			
		||||
cell_function	process_of	organism_function
 | 
			
		||||
organism_attribute	manifestation_of	cell_function
 | 
			
		||||
alga	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
professional_society	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
phenomenon_or_process	result_of	organism_function
 | 
			
		||||
chemical	affects	organism_function
 | 
			
		||||
laboratory_or_test_result	manifestation_of	organism_function
 | 
			
		||||
congenital_abnormality	affects	organism_function
 | 
			
		||||
daily_or_recreational_activity	associated_with	injury_or_poisoning
 | 
			
		||||
laboratory_or_test_result	measurement_of	enzyme
 | 
			
		||||
congenital_abnormality	part_of	bird
 | 
			
		||||
neoplastic_process	manifestation_of	mental_process
 | 
			
		||||
laboratory_procedure	analyzes	chemical_viewed_structurally
 | 
			
		||||
disease_or_syndrome	result_of	biologic_function
 | 
			
		||||
hormone	disrupts	cell
 | 
			
		||||
cell_or_molecular_dysfunction	manifestation_of	molecular_function
 | 
			
		||||
age_group	produces	regulation_or_law
 | 
			
		||||
mental_process	affects	bird
 | 
			
		||||
medical_device	treats	mental_or_behavioral_dysfunction
 | 
			
		||||
phenomenon_or_process	result_of	mental_process
 | 
			
		||||
embryonic_structure	part_of	virus
 | 
			
		||||
molecular_function	affects	reptile
 | 
			
		||||
therapeutic_or_preventive_procedure	prevents	experimental_model_of_disease
 | 
			
		||||
lipid	isa	substance
 | 
			
		||||
laboratory_procedure	assesses_effect_of	physiologic_function
 | 
			
		||||
fish	interacts_with	organism
 | 
			
		||||
plant	isa	physical_object
 | 
			
		||||
gene_or_genome	isa	entity
 | 
			
		||||
clinical_attribute	property_of	invertebrate
 | 
			
		||||
diagnostic_procedure	analyzes	element_ion_or_isotope
 | 
			
		||||
antibiotic	affects	natural_phenomenon_or_process
 | 
			
		||||
gene_or_genome	produces	vitamin
 | 
			
		||||
neoplastic_process	affects	natural_phenomenon_or_process
 | 
			
		||||
neoplastic_process	result_of	health_care_activity
 | 
			
		||||
diagnostic_procedure	measures	receptor
 | 
			
		||||
bacterium	interacts_with	archaeon
 | 
			
		||||
physiologic_function	affects	organism_attribute
 | 
			
		||||
hormone	interacts_with	receptor
 | 
			
		||||
professional_society	carries_out	laboratory_procedure
 | 
			
		||||
cell	location_of	organ_or_tissue_function
 | 
			
		||||
amino_acid_peptide_or_protein	ingredient_of	clinical_drug
 | 
			
		||||
human_caused_phenomenon_or_process	result_of	natural_phenomenon_or_process
 | 
			
		||||
research_activity	issue_in	occupation_or_discipline
 | 
			
		||||
chemical_viewed_functionally	causes	acquired_abnormality
 | 
			
		||||
reptile	isa	vertebrate
 | 
			
		||||
biologic_function	affects	invertebrate
 | 
			
		||||
neoplastic_process	affects	organism
 | 
			
		||||
vitamin	affects	natural_phenomenon_or_process
 | 
			
		||||
antibiotic	diagnoses	disease_or_syndrome
 | 
			
		||||
acquired_abnormality	manifestation_of	physiologic_function
 | 
			
		||||
pharmacologic_substance	isa	chemical
 | 
			
		||||
age_group	exhibits	social_behavior
 | 
			
		||||
organism_function	process_of	animal
 | 
			
		||||
professional_or_occupational_group	performs	machine_activity
 | 
			
		||||
experimental_model_of_disease	isa	event
 | 
			
		||||
neoplastic_process	process_of	disease_or_syndrome
 | 
			
		||||
acquired_abnormality	location_of	disease_or_syndrome
 | 
			
		||||
event	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
mental_or_behavioral_dysfunction	occurs_in	professional_or_occupational_group
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	affects	experimental_model_of_disease
 | 
			
		||||
mental_or_behavioral_dysfunction	isa	biologic_function
 | 
			
		||||
health_care_activity	method_of	occupation_or_discipline
 | 
			
		||||
element_ion_or_isotope	affects	experimental_model_of_disease
 | 
			
		||||
plant	interacts_with	fungus
 | 
			
		||||
patient_or_disabled_group	issue_in	occupation_or_discipline
 | 
			
		||||
self_help_or_relief_organization	carries_out	occupational_activity
 | 
			
		||||
research_activity	measures	molecular_function
 | 
			
		||||
acquired_abnormality	part_of	amphibian
 | 
			
		||||
receptor	affects	mental_process
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	causes	injury_or_poisoning
 | 
			
		||||
cell_or_molecular_dysfunction	affects	organ_or_tissue_function
 | 
			
		||||
organism_attribute	result_of	experimental_model_of_disease
 | 
			
		||||
pathologic_function	affects	bacterium
 | 
			
		||||
professional_society	location_of	health_care_activity
 | 
			
		||||
hazardous_or_poisonous_substance	disrupts	embryonic_structure
 | 
			
		||||
animal	exhibits	social_behavior
 | 
			
		||||
biologic_function	result_of	congenital_abnormality
 | 
			
		||||
pathologic_function	affects	mental_process
 | 
			
		||||
diagnostic_procedure	measures	amino_acid_peptide_or_protein
 | 
			
		||||
molecular_function	co-occurs_with	physiologic_function
 | 
			
		||||
family_group	uses	medical_device
 | 
			
		||||
group	performs	machine_activity
 | 
			
		||||
laboratory_procedure	associated_with	pathologic_function
 | 
			
		||||
neoplastic_process	co-occurs_with	congenital_abnormality
 | 
			
		||||
laboratory_procedure	measures	indicator_reagent_or_diagnostic_aid
 | 
			
		||||
anatomical_abnormality	result_of	pathologic_function
 | 
			
		||||
body_location_or_region	location_of	cell_function
 | 
			
		||||
research_activity	measures	steroid
 | 
			
		||||
invertebrate	causes	neoplastic_process
 | 
			
		||||
laboratory_procedure	analyzes	hormone
 | 
			
		||||
disease_or_syndrome	affects	biologic_function
 | 
			
		||||
pathologic_function	affects	genetic_function
 | 
			
		||||
tissue	issue_in	occupation_or_discipline
 | 
			
		||||
biologic_function	affects	plant
 | 
			
		||||
anatomical_abnormality	affects	reptile
 | 
			
		||||
body_location_or_region	location_of	mental_or_behavioral_dysfunction
 | 
			
		||||
medical_device	treats	pathologic_function
 | 
			
		||||
organism_attribute	result_of	cell_function
 | 
			
		||||
gene_or_genome	location_of	virus
 | 
			
		||||
gene_or_genome	part_of	tissue
 | 
			
		||||
tissue	produces	hormone
 | 
			
		||||
laboratory_or_test_result	indicates	neoplastic_process
 | 
			
		||||
mental_or_behavioral_dysfunction	complicates	injury_or_poisoning
 | 
			
		||||
biologically_active_substance	causes	experimental_model_of_disease
 | 
			
		||||
therapeutic_or_preventive_procedure	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
quantitative_concept	measurement_of	body_location_or_region
 | 
			
		||||
professional_or_occupational_group	isa	entity
 | 
			
		||||
gene_or_genome	affects	organ_or_tissue_function
 | 
			
		||||
eicosanoid	affects	disease_or_syndrome
 | 
			
		||||
immunologic_factor	complicates	organism_function
 | 
			
		||||
gene_or_genome	part_of	reptile
 | 
			
		||||
laboratory_or_test_result	manifestation_of	molecular_function
 | 
			
		||||
mental_or_behavioral_dysfunction	occurs_in	family_group
 | 
			
		||||
therapeutic_or_preventive_procedure	treats	mental_or_behavioral_dysfunction
 | 
			
		||||
population_group	isa	group
 | 
			
		||||
body_location_or_region	location_of	tissue
 | 
			
		||||
quantitative_concept	measurement_of	molecular_sequence
 | 
			
		||||
laboratory_procedure	isa	activity
 | 
			
		||||
diagnostic_procedure	assesses_effect_of	organophosphorus_compound
 | 
			
		||||
gene_or_genome	issue_in	occupation_or_discipline
 | 
			
		||||
organ_or_tissue_function	process_of	reptile
 | 
			
		||||
geographic_area	isa	conceptual_entity
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
biologically_active_substance	isa	chemical
 | 
			
		||||
enzyme	disrupts	embryonic_structure
 | 
			
		||||
virus	location_of	vitamin
 | 
			
		||||
professional_or_occupational_group	uses	regulation_or_law
 | 
			
		||||
experimental_model_of_disease	result_of	therapeutic_or_preventive_procedure
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	causes	neoplastic_process
 | 
			
		||||
sign_or_symptom	evaluation_of	biologic_function
 | 
			
		||||
physiologic_function	process_of	amphibian
 | 
			
		||||
classification	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
organism_function	produces	biologically_active_substance
 | 
			
		||||
laboratory_or_test_result	measurement_of	chemical
 | 
			
		||||
immunologic_factor	disrupts	body_part_organ_or_organ_component
 | 
			
		||||
health_care_activity	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
carbohydrate	interacts_with	antibiotic
 | 
			
		||||
neoplastic_process	result_of	diagnostic_procedure
 | 
			
		||||
mental_or_behavioral_dysfunction	result_of	organism_function
 | 
			
		||||
cell_component	location_of	organ_or_tissue_function
 | 
			
		||||
organophosphorus_compound	issue_in	occupation_or_discipline
 | 
			
		||||
cell_component	location_of	experimental_model_of_disease
 | 
			
		||||
lipid	causes	acquired_abnormality
 | 
			
		||||
experimental_model_of_disease	result_of	mental_process
 | 
			
		||||
anatomical_abnormality	result_of	cell_or_molecular_dysfunction
 | 
			
		||||
cell_function	isa	physiologic_function
 | 
			
		||||
acquired_abnormality	manifestation_of	cell_function
 | 
			
		||||
laboratory_or_test_result	associated_with	disease_or_syndrome
 | 
			
		||||
mental_process	produces	hormone
 | 
			
		||||
mammal	exhibits	behavior
 | 
			
		||||
daily_or_recreational_activity	associated_with	neoplastic_process
 | 
			
		||||
clinical_drug	causes	injury_or_poisoning
 | 
			
		||||
research_activity	associated_with	pathologic_function
 | 
			
		||||
cell_or_molecular_dysfunction	process_of	human
 | 
			
		||||
body_part_organ_or_organ_component	part_of	invertebrate
 | 
			
		||||
drug_delivery_device	treats	sign_or_symptom
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	affects	disease_or_syndrome
 | 
			
		||||
vertebrate	isa	physical_object
 | 
			
		||||
experimental_model_of_disease	result_of	diagnostic_procedure
 | 
			
		||||
drug_delivery_device	isa	entity
 | 
			
		||||
therapeutic_or_preventive_procedure	uses	clinical_drug
 | 
			
		||||
enzyme	affects	cell_or_molecular_dysfunction
 | 
			
		||||
diagnostic_procedure	analyzes	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
amphibian	exhibits	individual_behavior
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	physiologic_function
 | 
			
		||||
laboratory_procedure	diagnoses	cell_or_molecular_dysfunction
 | 
			
		||||
therapeutic_or_preventive_procedure	complicates	mental_process
 | 
			
		||||
steroid	interacts_with	inorganic_chemical
 | 
			
		||||
physiologic_function	affects	plant
 | 
			
		||||
biomedical_occupation_or_discipline	isa	conceptual_entity
 | 
			
		||||
laboratory_procedure	analyzes	carbohydrate
 | 
			
		||||
eicosanoid	interacts_with	receptor
 | 
			
		||||
age_group	performs	molecular_biology_research_technique
 | 
			
		||||
element_ion_or_isotope	interacts_with	enzyme
 | 
			
		||||
hazardous_or_poisonous_substance	disrupts	cell_component
 | 
			
		||||
congenital_abnormality	result_of	physiologic_function
 | 
			
		||||
organophosphorus_compound	interacts_with	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
anatomical_abnormality	part_of	bacterium
 | 
			
		||||
clinical_drug	causes	anatomical_abnormality
 | 
			
		||||
body_space_or_junction	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
therapeutic_or_preventive_procedure	affects	mental_process
 | 
			
		||||
health_care_activity	associated_with	injury_or_poisoning
 | 
			
		||||
molecular_function	precedes	organ_or_tissue_function
 | 
			
		||||
health_care_related_organization	carries_out	research_activity
 | 
			
		||||
cell_function	process_of	molecular_function
 | 
			
		||||
neoplastic_process	affects	experimental_model_of_disease
 | 
			
		||||
diagnostic_procedure	affects	cell_or_molecular_dysfunction
 | 
			
		||||
diagnostic_procedure	issue_in	occupation_or_discipline
 | 
			
		||||
governmental_or_regulatory_activity	method_of	biomedical_occupation_or_discipline
 | 
			
		||||
laboratory_or_test_result	manifestation_of	cell_function
 | 
			
		||||
professional_or_occupational_group	produces	regulation_or_law
 | 
			
		||||
laboratory_or_test_result	measurement_of	pharmacologic_substance
 | 
			
		||||
pharmacologic_substance	affects	experimental_model_of_disease
 | 
			
		||||
receptor	affects	cell_function
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	causes	anatomical_abnormality
 | 
			
		||||
body_part_organ_or_organ_component	produces	vitamin
 | 
			
		||||
hormone	affects	biologic_function
 | 
			
		||||
fully_formed_anatomical_structure	location_of	disease_or_syndrome
 | 
			
		||||
receptor	affects	physiologic_function
 | 
			
		||||
research_activity	measures	organism_attribute
 | 
			
		||||
finding	manifestation_of	organ_or_tissue_function
 | 
			
		||||
mental_or_behavioral_dysfunction	manifestation_of	physiologic_function
 | 
			
		||||
health_care_activity	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
antibiotic	interacts_with	immunologic_factor
 | 
			
		||||
disease_or_syndrome	produces	body_substance
 | 
			
		||||
diagnostic_procedure	measures	biomedical_or_dental_material
 | 
			
		||||
chemical	affects	natural_phenomenon_or_process
 | 
			
		||||
research_activity	measures	biomedical_or_dental_material
 | 
			
		||||
body_part_organ_or_organ_component	conceptual_part_of	body_system
 | 
			
		||||
disease_or_syndrome	affects	bacterium
 | 
			
		||||
chemical	causes	anatomical_abnormality
 | 
			
		||||
organism_function	result_of	mental_process
 | 
			
		||||
cell_or_molecular_dysfunction	occurs_in	age_group
 | 
			
		||||
pathologic_function	affects	amphibian
 | 
			
		||||
molecular_function	isa	phenomenon_or_process
 | 
			
		||||
laboratory_procedure	analyzes	vitamin
 | 
			
		||||
governmental_or_regulatory_activity	associated_with	pathologic_function
 | 
			
		||||
mental_process	result_of	acquired_abnormality
 | 
			
		||||
tissue	produces	organophosphorus_compound
 | 
			
		||||
gene_or_genome	part_of	cell_component
 | 
			
		||||
mental_or_behavioral_dysfunction	affects	animal
 | 
			
		||||
immunologic_factor	causes	acquired_abnormality
 | 
			
		||||
antibiotic	treats	acquired_abnormality
 | 
			
		||||
eicosanoid	isa	lipid
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	causes	pathologic_function
 | 
			
		||||
antibiotic	treats	congenital_abnormality
 | 
			
		||||
acquired_abnormality	part_of	plant
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	mental_process
 | 
			
		||||
professional_or_occupational_group	exhibits	individual_behavior
 | 
			
		||||
cell_component	location_of	biologic_function
 | 
			
		||||
hazardous_or_poisonous_substance	isa	chemical_viewed_functionally
 | 
			
		||||
cell_function	result_of	molecular_function
 | 
			
		||||
element_ion_or_isotope	ingredient_of	clinical_drug
 | 
			
		||||
acquired_abnormality	affects	amphibian
 | 
			
		||||
group	uses	classification
 | 
			
		||||
organic_chemical	interacts_with	eicosanoid
 | 
			
		||||
receptor	isa	biologically_active_substance
 | 
			
		||||
biologically_active_substance	affects	molecular_function
 | 
			
		||||
pathologic_function	precedes	mental_or_behavioral_dysfunction
 | 
			
		||||
laboratory_procedure	assesses_effect_of	biologically_active_substance
 | 
			
		||||
cell_function	produces	hormone
 | 
			
		||||
biologically_active_substance	disrupts	embryonic_structure
 | 
			
		||||
biologic_function	produces	receptor
 | 
			
		||||
alga	location_of	hormone
 | 
			
		||||
experimental_model_of_disease	produces	receptor
 | 
			
		||||
organ_or_tissue_function	occurs_in	mental_process
 | 
			
		||||
nucleic_acid_nucleoside_or_nucleotide	affects	molecular_function
 | 
			
		||||
acquired_abnormality	part_of	rickettsia_or_chlamydia
 | 
			
		||||
medical_device	treats	experimental_model_of_disease
 | 
			
		||||
neoplastic_process	process_of	experimental_model_of_disease
 | 
			
		||||
geographic_area	associated_with	cell_or_molecular_dysfunction
 | 
			
		||||
organophosphorus_compound	interacts_with	steroid
 | 
			
		||||
cell_function	isa	natural_phenomenon_or_process
 | 
			
		||||
disease_or_syndrome	result_of	social_behavior
 | 
			
		||||
mental_or_behavioral_dysfunction	occurs_in	patient_or_disabled_group
 | 
			
		||||
injury_or_poisoning	occurs_in	professional_or_occupational_group
 | 
			
		||||
hazardous_or_poisonous_substance	complicates	congenital_abnormality
 | 
			
		||||
invertebrate	causes	pathologic_function
 | 
			
		||||
acquired_abnormality	occurs_in	professional_or_occupational_group
 | 
			
		||||
lipid	affects	mental_or_behavioral_dysfunction
 | 
			
		||||
clinical_attribute	associated_with	organism_attribute
 | 
			
		||||
lipid	affects	mental_process
 | 
			
		||||
invertebrate	interacts_with	reptile
 | 
			
		||||
gene_or_genome	part_of	vertebrate
 | 
			
		||||
organ_or_tissue_function	process_of	mammal
 | 
			
		||||
body_substance	conceptual_part_of	body_system
 | 
			
		||||
body_part_organ_or_organ_component	produces	neuroreactive_substance_or_biogenic_amine
 | 
			
		||||
carbohydrate	interacts_with	inorganic_chemical
 | 
			
		||||
anatomical_abnormality	part_of	mammal
 | 
			
		||||
natural_phenomenon_or_process	affects	molecular_function
 | 
			
		||||
substance	causes	cell_or_molecular_dysfunction
 | 
			
		||||
embryonic_structure	surrounds	cell
 | 
			
		||||
injury_or_poisoning	isa	phenomenon_or_process
 | 
			
		||||
diagnostic_procedure	diagnoses	anatomical_abnormality
 | 
			
		||||
body_space_or_junction	location_of	injury_or_poisoning
 | 
			
		||||
cell_function	result_of	experimental_model_of_disease
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	complicates	genetic_function
 | 
			
		||||
experimental_model_of_disease	result_of	environmental_effect_of_humans
 | 
			
		||||
health_care_activity	affects	cell_or_molecular_dysfunction
 | 
			
		||||
professional_society	carries_out	diagnostic_procedure
 | 
			
		||||
health_care_activity	affects	mental_process
 | 
			
		||||
group	produces	research_device
 | 
			
		||||
cell_component	location_of	congenital_abnormality
 | 
			
		||||
vertebrate	isa	animal
 | 
			
		||||
molecular_biology_research_technique	measures	biomedical_or_dental_material
 | 
			
		||||
professional_society	produces	classification
 | 
			
		||||
amino_acid_sequence	isa	idea_or_concept
 | 
			
		||||
genetic_function	co-occurs_with	physiologic_function
 | 
			
		||||
mental_or_behavioral_dysfunction	manifestation_of	genetic_function
 | 
			
		||||
biologic_function	process_of	mammal
 | 
			
		||||
individual_behavior	affects	social_behavior
 | 
			
		||||
pathologic_function	co-occurs_with	injury_or_poisoning
 | 
			
		||||
invertebrate	causes	experimental_model_of_disease
 | 
			
		||||
fish	interacts_with	archaeon
 | 
			
		||||
research_device	causes	disease_or_syndrome
 | 
			
		||||
quantitative_concept	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
professional_society	location_of	therapeutic_or_preventive_procedure
 | 
			
		||||
drug_delivery_device	prevents	disease_or_syndrome
 | 
			
		||||
fully_formed_anatomical_structure	part_of	invertebrate
 | 
			
		||||
mammal	isa	entity
 | 
			
		||||
body_part_organ_or_organ_component	produces	receptor
 | 
			
		||||
molecular_function	affects	mammal
 | 
			
		||||
laboratory_procedure	analyzes	biomedical_or_dental_material
 | 
			
		||||
human_caused_phenomenon_or_process	isa	phenomenon_or_process
 | 
			
		||||
experimental_model_of_disease	process_of	vertebrate
 | 
			
		||||
professional_society	carries_out	research_activity
 | 
			
		||||
experimental_model_of_disease	precedes	cell_or_molecular_dysfunction
 | 
			
		||||
experimental_model_of_disease	affects	amphibian
 | 
			
		||||
laboratory_procedure	assesses_effect_of	hazardous_or_poisonous_substance
 | 
			
		||||
anatomical_abnormality	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
hormone	affects	mental_process
 | 
			
		||||
laboratory_procedure	analyzes	pharmacologic_substance
 | 
			
		||||
body_location_or_region	location_of	genetic_function
 | 
			
		||||
disease_or_syndrome	result_of	injury_or_poisoning
 | 
			
		||||
laboratory_procedure	assesses_effect_of	neoplastic_process
 | 
			
		||||
congenital_abnormality	affects	animal
 | 
			
		||||
biomedical_or_dental_material	interacts_with	immunologic_factor
 | 
			
		||||
organism_function	isa	natural_phenomenon_or_process
 | 
			
		||||
classification	isa	intellectual_product
 | 
			
		||||
natural_phenomenon_or_process	result_of	anatomical_abnormality
 | 
			
		||||
chemical_viewed_functionally	affects	neoplastic_process
 | 
			
		||||
amino_acid_sequence	result_of	mental_process
 | 
			
		||||
clinical_attribute	property_of	reptile
 | 
			
		||||
mammal	exhibits	individual_behavior
 | 
			
		||||
natural_phenomenon_or_process	affects	disease_or_syndrome
 | 
			
		||||
organ_or_tissue_function	process_of	neoplastic_process
 | 
			
		||||
biologically_active_substance	complicates	mental_process
 | 
			
		||||
laboratory_procedure	assesses_effect_of	biomedical_or_dental_material
 | 
			
		||||
biomedical_or_dental_material	interacts_with	chemical
 | 
			
		||||
neoplastic_process	associated_with	cell_or_molecular_dysfunction
 | 
			
		||||
qualitative_concept	isa	idea_or_concept
 | 
			
		||||
sign_or_symptom	evaluation_of	experimental_model_of_disease
 | 
			
		||||
neuroreactive_substance_or_biogenic_amine	interacts_with	receptor
 | 
			
		||||
cell	location_of	pathologic_function
 | 
			
		||||
diagnostic_procedure	assesses_effect_of	enzyme
 | 
			
		||||
acquired_abnormality	part_of	alga
 | 
			
		||||
organophosphorus_compound	interacts_with	hazardous_or_poisonous_substance
 | 
			
		||||
diagnostic_procedure	assesses_effect_of	lipid
 | 
			
		||||
fungus	interacts_with	invertebrate
 | 
			
		||||
laboratory_or_test_result	measurement_of	physiologic_function
 | 
			
		||||
acquired_abnormality	affects	mental_process
 | 
			
		||||
disease_or_syndrome	affects	reptile
 | 
			
		||||
amino_acid_sequence	isa	entity
 | 
			
		||||
mental_process	result_of	biologic_function
 | 
			
		||||
organic_chemical	affects	biologic_function
 | 
			
		||||
steroid	interacts_with	hormone
 | 
			
		||||
pathologic_function	result_of	acquired_abnormality
 | 
			
		||||
research_activity	measures	chemical_viewed_structurally
 | 
			
		||||
therapeutic_or_preventive_procedure	associated_with	mental_or_behavioral_dysfunction
 | 
			
		||||
physiologic_function	result_of	mental_process
 | 
			
		||||
clinical_attribute	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
laboratory_procedure	measures	antibiotic
 | 
			
		||||
cell	part_of	invertebrate
 | 
			
		||||
vitamin	complicates	cell_or_molecular_dysfunction
 | 
			
		||||
clinical_attribute	manifestation_of	molecular_function
 | 
			
		||||
organism_function	result_of	acquired_abnormality
 | 
			
		||||
professional_or_occupational_group	interacts_with	age_group
 | 
			
		||||
natural_phenomenon_or_process	affects	neoplastic_process
 | 
			
		||||
organization	carries_out	research_activity
 | 
			
		||||
embryonic_structure	part_of	bacterium
 | 
			
		||||
fully_formed_anatomical_structure	produces	enzyme
 | 
			
		||||
organic_chemical	interacts_with	indicator_reagent_or_diagnostic_aid
 | 
			
		||||
natural_phenomenon_or_process	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
neoplastic_process	affects	pathologic_function
 | 
			
		||||
fully_formed_anatomical_structure	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
environmental_effect_of_humans	result_of	experimental_model_of_disease
 | 
			
		||||
experimental_model_of_disease	manifestation_of	physiologic_function
 | 
			
		||||
body_part_organ_or_organ_component	location_of	mental_process
 | 
			
		||||
receptor	causes	injury_or_poisoning
 | 
			
		||||
sign_or_symptom	diagnoses	disease_or_syndrome
 | 
			
		||||
antibiotic	disrupts	mental_process
 | 
			
		||||
mental_process	precedes	organism_function
 | 
			
		||||
chemical_viewed_structurally	affects	cell_or_molecular_dysfunction
 | 
			
		||||
vitamin	disrupts	molecular_function
 | 
			
		||||
pharmacologic_substance	causes	injury_or_poisoning
 | 
			
		||||
professional_or_occupational_group	performs	governmental_or_regulatory_activity
 | 
			
		||||
educational_activity	isa	activity
 | 
			
		||||
congenital_abnormality	location_of	disease_or_syndrome
 | 
			
		||||
neoplastic_process	co-occurs_with	pathologic_function
 | 
			
		||||
chemical_viewed_functionally	causes	mental_or_behavioral_dysfunction
 | 
			
		||||
biologic_function	process_of	human
 | 
			
		||||
hormone	complicates	mental_or_behavioral_dysfunction
 | 
			
		||||
embryonic_structure	location_of	rickettsia_or_chlamydia
 | 
			
		||||
congenital_abnormality	result_of	mental_or_behavioral_dysfunction
 | 
			
		||||
organ_or_tissue_function	produces	enzyme
 | 
			
		||||
molecular_biology_research_technique	measures	experimental_model_of_disease
 | 
			
		||||
disease_or_syndrome	process_of	organism_function
 | 
			
		||||
finding	manifestation_of	disease_or_syndrome
 | 
			
		||||
pathologic_function	process_of	mammal
 | 
			
		||||
organ_or_tissue_function	process_of	human
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	affects	physiologic_function
 | 
			
		||||
health_care_related_organization	carries_out	molecular_biology_research_technique
 | 
			
		||||
hazardous_or_poisonous_substance	disrupts	organ_or_tissue_function
 | 
			
		||||
mental_process	process_of	invertebrate
 | 
			
		||||
tissue	location_of	experimental_model_of_disease
 | 
			
		||||
antibiotic	isa	pharmacologic_substance
 | 
			
		||||
therapeutic_or_preventive_procedure	prevents	mental_or_behavioral_dysfunction
 | 
			
		||||
steroid	affects	disease_or_syndrome
 | 
			
		||||
pharmacologic_substance	prevents	disease_or_syndrome
 | 
			
		||||
behavior	result_of	mental_process
 | 
			
		||||
social_behavior	associated_with	geographic_area
 | 
			
		||||
tissue	part_of	body_part_organ_or_organ_component
 | 
			
		||||
molecular_function	affects	rickettsia_or_chlamydia
 | 
			
		||||
population_group	performs	governmental_or_regulatory_activity
 | 
			
		||||
biologically_active_substance	disrupts	organism_function
 | 
			
		||||
acquired_abnormality	isa	anatomical_abnormality
 | 
			
		||||
molecular_function	affects	alga
 | 
			
		||||
congenital_abnormality	result_of	human_caused_phenomenon_or_process
 | 
			
		||||
congenital_abnormality	result_of	environmental_effect_of_humans
 | 
			
		||||
neoplastic_process	process_of	mental_or_behavioral_dysfunction
 | 
			
		||||
functional_concept	isa	entity
 | 
			
		||||
spatial_concept	isa	conceptual_entity
 | 
			
		||||
mental_or_behavioral_dysfunction	process_of	cell_or_molecular_dysfunction
 | 
			
		||||
biomedical_or_dental_material	causes	anatomical_abnormality
 | 
			
		||||
hazardous_or_poisonous_substance	causes	congenital_abnormality
 | 
			
		||||
antibiotic	disrupts	cell
 | 
			
		||||
disease_or_syndrome	affects	alga
 | 
			
		||||
finding	manifestation_of	experimental_model_of_disease
 | 
			
		||||
element_ion_or_isotope	affects	natural_phenomenon_or_process
 | 
			
		||||
amphibian	interacts_with	archaeon
 | 
			
		||||
body_space_or_junction	location_of	mental_process
 | 
			
		||||
substance	causes	neoplastic_process
 | 
			
		||||
biologic_function	affects	genetic_function
 | 
			
		||||
indicator_reagent_or_diagnostic_aid	causes	injury_or_poisoning
 | 
			
		||||
research_activity	measures	pharmacologic_substance
 | 
			
		||||
injury_or_poisoning	result_of	environmental_effect_of_humans
 | 
			
		||||
organization	issue_in	occupation_or_discipline
 | 
			
		||||
organ_or_tissue_function	process_of	mental_process
 | 
			
		||||
research_activity	associated_with	mental_or_behavioral_dysfunction
 | 
			
		||||
human	issue_in	biomedical_occupation_or_discipline
 | 
			
		||||
molecular_function	affects	disease_or_syndrome
 | 
			
		||||
eicosanoid	affects	pathologic_function
 | 
			
		||||
		Reference in New Issue
	
	Block a user