Skip to content

Daham-Mustaf/LLM4ODRL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

From Instructions to ODRL Usage Policies: An Ontology Guided Approach

VLDB2024

Paper Fraunhofer-Publica ArXiv LangChain Python 3.8+ DOI

Publication

The repository contains the implementation of the method, experimental results, and related scripts. This work was published at the LLM+KG Workshop at VLDB 2024.

Directory Structure

  • data/: Dataset used for experiments.

    • ontology/: Contains the ODRL ontology file.
      • odrl.ttl: The ODRL ontology file in Turtle format.
    • tasks/: Contains use case files used as experiments for testing the approach.
  • llm_guidance_template/: Contains PDF templates used to guide the LLM in generating ODRL knowledge graphs.

    • templates/: Subdirectory containing the PDF templates.
      • ODRL-Agreement_Generator_template.pdf: Template for generating ODRL Agreement policies.
      • ODRL-Offer_Generator_Template.pdf: Template for generating ODRL Offer policies.
      • ODRL_Rule_Generator_template.pdf: Template for generating ODRL Rule policies.
  • generated_odrl_from_ontology/: Contains the ODRL knowledge graphs generated directly from the ODRL ontology.

  • generated_odrl_policy_from_template/: Contains the ODRL knowledge graphs generated from context and self-correction mechanisms.

  • ODRL_policy_validation_shapes/: Contains shapes for validating ODRL rules, agreements, and offers.

  • config.json: Configuration file containing settings for the scripts.

  • constants.py: File containing constant variables used throughout the project.

  • correction_report.py: Script containing correction rules applied for the self-correction mechanism.

  • file_paths.py: File handling paths used by the scripts.

Scripts

  • ODRL_From_Ontology.py: Script to generate ODRL knowledge graphs solely from the ontology and apply self-correction mechanisms.
  • ODRL_Agreement_Gen.py: Script to generate agreement policies from context and apply self-correction mechanisms.
  • ODRL_Offer_Gen.py: Script to generate offer policies from context and apply self-correction mechanisms.
  • ODRL_Rule_Gen.py: Script to generate rule policies from context templates.
  • shacl_odrl_validator.py: Script for SHACL validation of ODRL policies.

Setup

Before running the scripts, ensure that you have set up an Open API key and configured the config.json file with the appropriate settings.

Running the Scripts

  1. Set up the Open API key.
  2. Configure the config.json file with the necessary settings.
  3. Run the desired script using Python, e.g., python ODRL_From_Ontology.py.
  4. Follow the prompts and provide any required inputs.

Methodology

ODRL Policy Generation Workflow

Workflow Legend

Components by Color

  • 🟡 Yellow Components (Parallelogram shape): Human-prepared inputs

    • Task Description
    • LLM Guidance Template
    • Self-Correction Rules
  • 🔵 Blue Components (Rectangle shape): Machine-generated outputs

    • ODRL KG
    • Refined ODRL Knowledge Graph
  • 🔴 Red Component (Rectangle shape): Processing

    • LLM Processing

Supporting Knowledge (in Prepared Guidance)

  • 🌸 Pink Box: ODRL Ontology

    • ODRL-OWL Ontology
  • 🌿 Green Box: OSES Insights

    • Syntax Rules
    • Semantic Insights
    • Distilled Examples

Edge Labels

  • "domain requirements": Task description to LLM
  • "guides validation": Task description to Self-Correction
  • "guides generation": LGT to LLM
  • "provides structure": Ontology to LGT
  • "enriches template": OSES to LGT
  • "generates": LLM to KG
  • "inputs for correction": KG to SCM
  • "refines": SCM to RKG

The workflow represents a novel methodology for generating ODRL policies using LLMs, combining human expertise with machine processing. It consists of three main phases: Input (human-prepared), Processing (machine), and Refinement (human-guided correction), resulting in a refined ODRL Knowledge Graph.

Citation

If you use this work in your research, please cite our paper:

@inproceedings{mustafa2024instructions,
  title={From Instructions to ODRL Usage Policies: An Ontology Guided Approach},
  author={Mustafa, Daham M. and Nadgeri, Abhishek and Collarana, Diego and Arnold, Benedikt T. and Quix, Christoph and Lange, Christoph and Decker, Stefan},
  booktitle={Proceedings of the LLM+KG Workshop at VLDB},
  year={2024},
  url={https://vldb.org/workshops/2024/proceedings/LLM+KG/LLM+KG-15.pdf}
}

Authors

  • Daham M. Mustafa - Fraunhofer FIT, Sankt Augustin, Germany
  • Abhishek Nadgeri - Fraunhofer FIT, Sankt Augustin, Germany
  • Diego Collarana - Fraunhofer FIT, Sankt Augustin, Germany & Universidad Privada Boliviana, Cochabamba, Bolivia
  • Benedikt T. Arnold - Fraunhofer FIT, Sankt Augustin, Germany & RWTH Aachen University, Aachen, Germany
  • Christoph Quix - RWTH Aachen University, Aachen, Germany
  • Christoph Lange - Fraunhofer FIT, Sankt Augustin, Germany & RWTH Aachen University, Aachen, Germany
  • Stefan Decker - Fraunhofer FIT, Sankt Augustin, Germany & RWTH Aachen University, Aachen, Germany

Related Links

About

An ontology-guided approach for converting instructions into ODRL (Open Digital Rights Language) usage policies using Large Language Models. Features self-correction mechanisms and SHACL validation. Published at VLDB 2024.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages