LHRLAB / NQE

[AAAI 2023] Official resources of "NQE: N-ary Query Embedding for Complex Query Answering over Hyper-relational Knowledge Graphs".
https://doi.org/10.1609/aaai.v37i4.25576
MIT License
22 stars 1 forks source link
first-order-logic fuzzy-logic hyper-relational knowledge-graph logical-reasoning multi-hop-reasoning pytorch query-embedding transformer

NQE

Official resources of "NQE: N-ary Query Embedding for Complex Query Answering over Hyper-Relational Knowledge Graphs". Haoran Luo, Haihong E, Yuhao Yang, Gengxian Zhou, Yikai Guo, Tianyu Yao, Zichen Tang, Xueyuan Lin, Kaiyang Wan. AAAI 2023 [paper].

Overview

An example of n-ary FOL query:

16 kinds of n-ary FOL queries in WD50K-NFOL:

Setup

Default implementation environment

pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

Install Dependencies

Install dependencies:

pip install -r requirements.txt

Configure the Dataset

We tested the effectiveness of our model on two datasets, including the WD50K-QE dataset and the WD50K-NFOL dataset.

unzip wd50k_qe.zip -d data/
unzip wd50k_nfol.zip -d data/

Generate the Groundtruth

Then, we should generate the groundtruth of the chosen dataset for evaluation. If you don't change the dataset, please skip this step, because the zip files above have already got the groundtruth in "gt\" file by following operation.

Model Training

You can train query embedding model using "src/map_iter_qe.py".

Evaluation

After training, you can only run prediction using "src/map_iter_qe.py" by with argument "do_learn" False and argument "do_predict" True. In this case, you need to select the ckpts file you want to use and configure the "prediction_ckpt" argument as you want.

BibTex

If you find this work is helpful for your research, please cite:

@article{luo2023nqe, 
  title={NQE: N-ary Query Embedding for Complex Query Answering over Hyper-Relational Knowledge Graphs}, 
  volume={37}, 
  url={https://ojs.aaai.org/index.php/AAAI/article/view/25576}, 
  DOI={10.1609/aaai.v37i4.25576}, 
  author={Luo, Haoran and E, Haihong and Yang, Yuhao and Zhou, Gengxian and Guo, Yikai and Yao, Tianyu and Tang, Zichen and Lin, Xueyuan and Wan, Kaiyang}, 
  year={2023}, 
  month={Jun.}, 
  pages={4543-4551} 
}

For further questions, please contact: luohaoran@bupt.edu.cn.