/LQAC

Beyond Knowledge Graphs: Neural Logical Reasoning with Ontologies

Primary LanguageJupyter NotebookBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Neural Multi-hop Logical Query Answering with Concept-level Answers

Requirements

  • python == 3.8.5
  • torch == 1.8.1
  • numpy == 1.19.2
  • pandas == 1.0.1
  • tqdm == 4.61.0
  • groovy == 4.0.0
  • JVM == 1.8.0_333

Datasets

YAGO4

Using the pre-processed datasets

Download and unzip YAGO4.zip from here, and replace

./data/YAGO4/input/

Dataset Construction

Download the following files: T, Aee, Aec1, and Aec2

Unzip the files to:

./data/YAGO4/raw/

Run all cells in:

./code/ppc_YAGO4/raw2mid.ipynb
./code/ppc_YAGO4/ppc.ipynb

DBpedia

Using pre-processed datasets

Download and unzip DBpedia.zip from here, and replace

./data/DBpedia/input/

Dataset Construction

Download the following files: T, Aee, and Aec

Unzip the files to:

./data/DBpedia/raw/

Run all cells in:

./code/ppc_DBpedia/raw2mid.ipynb
./code/ppc_DBpedia/ppc.ipynb

Gene Ontology (GO)

Using pre-processed datasets

Download and unzip GO.zip from here, and replace

./data/GO/input/

Dataset Construction

Download the raw data here and unzip it to:

./data/GO/raw/

Generate axioms using:

groovy ./code/ppc_GO/GetOntology.groovy ./data/GO/raw/data-train/yeast-classes.owl > ./data/GO/raw/ontology.txt

Generate intermediate data using:

cd ./code/ppc_GO/ && python raw2mid.py

Run all cells in:

./code/ppc_GO/ppc.ipynb

Run

To reproduce the main results, simply run the following commands:

python TAR.py --dataset YAGO4
python TAR.py --dataset DBpedia
python TAR.py --dataset GO