TP-ONT is an ontology designed for task planning and knowledge representation. This repository provides:
- The current ontology definition
- Tools for Knowledge Graph (KG) and ontology construction from PDDL
- Scripts to align the ontology with general knowledge ontologies
- Scripts to run a planner on PDDL files to generate plans to be added to the KG.
- 📖 Quick Start & Ontology Files
- 🛠️ Installation & Setup
- 🚀 Running the Pipeline
- 🧭 Plan Generation & Simulation
- 📄 License
If you just want to view or query the ontology:
- Ontology File: Find the TBox / ontology definitions in
tp-ont.owlorontologies/for both the dynamic and static ontologies. - KG File: Find the raw ABox / knowledge graph definitions in
knowledge_graphsfor the raw and materialised knowledge graphs. - Sample SPARQL Queries: the
examplesfolder contains sample SPARQL queries to explore the ontology and knowledge graph. They can be run with therun_queries.pyscript and a Jena Fuseki server. - Compatibility: Compatible with Protégé,
rdflib, or any standard OWL/RDF reasoner.
Clone the repository with its submodules:
git clone --recursive git@github.com:maayan25/tp-ont.git
cd tp-ontEnvironment Note: Tested on Ubuntu 24.04 with Python 3.12.3. We recommend using Python 3.12 for best compatibility.
Choose either venv or Conda to set up your environment:
- Using
venv:
python3 -m venv .venv
source .venv/bin/activate- Using
Conda(Recommended if on another Python version):
conda create -n tp-ont python=3.12
conda activate tp-ontInstall the required packages
python3 -m pip install -r requirements.txtInstall the libxcb-cursor-dev package for visualisation support:
sudo apt update && sudo apt install libxcb-cursor-devDownload nltk required data:
python3 -m pip install nltk
python3 -c "import nltk; nltk.download('averaged_perceptron_tagger_eng')"- Single domain KG construction: You can run the PDDLKGConstructor.py script to create a knowledge graph for a single domain. The script takes the path to the PDDL domain and problem files as input, and outputs the corresponding knowledge graph in RDF format.
cd scripts/kg_construction
python3 PDDLKGConstructor.py --domain <path_to_domain_file> --problem <path_to_problem_file>- Batch KG construction: You can use create_kg.sh to run multiple domains at once. The script takes a list of PDDL domain names as input, and outputs the corresponding knowledge graphs in RDF format. It uses the instance-1 problem file as the default problem file for each domain as the input, which can be changed in the script if needed. The output knowledge graphs are saved in the
knowledge_graphsdirectory.
cd scripts/kg_construction
./create_kg.shOnce you have created the KG, you can extraact the ontology schema (TBox) with extract_tbox_from_kg.py:
cd scripts/kg_construction
python3 extract_tbox_from_kg.pySample plan instances can be found in results/planner_outputs.
To generate new plans and state simulations, make sure you have installed the following:
- Run the planner on a single problem file: You can run the RunFDPlanner.py script to generate a plan for a single problem file. The script takes the path to the PDDL domain and problem files as input, and outputs the corresponding plan in text format.
- Run the planner on multiple problem files: You can use run_planner.sh to run the planner on multiple problem files at once.
Both scripts will output the generated plans and a corresponding state simulation of the plan execution. The files are saved in the
results/planner_outputsdirectory.
This project is licensed under the Creative Commons Attribution 4.0 International License.