Metadata-Version: 2.4
Name: kroma-om
Version: 0.3.0
Summary: Ontology matching with knowledge retrieval and large language models
Author: Lam Nguyen, Erika Barcelos, Roger French, Yinghui Wu
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/cwru-sdle/kroma
Project-URL: Documentation, https://kroma.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/cwru-sdle/kroma
Project-URL: Issues, https://github.com/cwru-sdle/kroma/issues
Project-URL: Paper, https://doi.org/10.1007/978-3-032-09527-5_34
Project-URL: arXiv, https://arxiv.org/abs/2507.14032
Keywords: ontology matching,ontology alignment,knowledge graphs,large language models,retrieval-augmented generation,semantic web
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: python-dotenv
Requires-Dist: rdflib
Requires-Dist: requests
Requires-Dist: scipy
Provides-Extra: models
Requires-Dist: nltk; extra == "models"
Requires-Dist: networkx; extra == "models"
Requires-Dist: node2vec; extra == "models"
Requires-Dist: setuptools<82; extra == "models"
Requires-Dist: openai; extra == "models"
Requires-Dist: scikit-learn; extra == "models"
Requires-Dist: scipy; extra == "models"
Requires-Dist: sentence-transformers; extra == "models"
Requires-Dist: SPARQLWrapper; extra == "models"
Requires-Dist: together; extra == "models"
Requires-Dist: torch; extra == "models"
Requires-Dist: transformers; extra == "models"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2; extra == "docs"
Dynamic: license-file

<div align="center">

# KROMA

**Ontology matching with knowledge retrieval and large language models**

[![PyPI](https://img.shields.io/pypi/v/kroma-om?color=3b82f6)](https://pypi.org/project/kroma-om/)
[![Python](https://img.shields.io/pypi/pyversions/kroma-om)](https://pypi.org/project/kroma-om/)
[![Tests](https://github.com/cwru-sdle/kroma/actions/workflows/tests.yml/badge.svg)](https://github.com/cwru-sdle/kroma/actions/workflows/tests.yml)
[![Docs](https://readthedocs.org/projects/kroma/badge/?version=latest)](https://kroma.readthedocs.io/en/latest/)
[![ISWC 2025](https://img.shields.io/badge/ISWC-2025-b31b1b)](https://doi.org/10.1007/978-3-032-09527-5_34)
[![License](https://img.shields.io/badge/license-BSD--3--Clause-green.svg)](https://github.com/cwru-sdle/kroma/blob/main/LICENSE)

Lam Nguyen · Erika Barcelos · Roger French · Yinghui Wu

[Docs](https://kroma.readthedocs.io/en/latest/) ·
[Quick start](#quick-start) ·
[Results](#results) ·
[Paper](https://link.springer.com/chapter/10.1007/978-3-032-09527-5_34) ·
[Citation](#citation)

</div>

KROMA finds the concepts that two ontologies share. It retrieves likely matches
for each concept, accepts identical names directly, and asks a large language
model about the rest, showing it each concept's labels, synonyms, parents and
children.

## Quick start

```bash
pip install kroma-om openai
export OPENAI_API_KEY=sk-...

kroma match mouse.owl human.owl -o alignments.csv
```

Or from Python:

```python
import kroma

result = kroma.match("mouse.owl", "human.owl", model="gpt-4o-mini")
result.save("alignments.csv")    # .csv, .tsv, or .rdf (OAEI format)
```

KROMA reads any RDF format (`.owl`, `.ttl`, `.rdf`, …) and works with OpenAI,
Together AI, or any function that takes a prompt and returns text.

## Run it locally

No API key needed, only [Ollama](https://ollama.com) and a small model:

```bash
git clone https://github.com/cwru-sdle/kroma.git && cd kroma/examples
pip install kroma-om
ollama pull llama3.2:1b
python match_ollama.py --model llama3.2:1b
```

| Source | Target | Confidence (0-10) |
|:--|:--|:--:|
| heart | cardiac organ | 10 |
| lung | lungs | 8 |
| organ | body organ | 8 |

See the [example](https://github.com/cwru-sdle/kroma/tree/main/examples) for details.

## Results

F1 (%) on six OAEI tracks, from the [paper](https://link.springer.com/chapter/10.1007/978-3-032-09527-5_34):

| Track | KROMA | Best baseline |
|:--|:--:|:--:|
| Mouse–Human | **94.94** | 92.20 |
| NCIT–DOID | **98.63** | 94.80 |
| Nell–DBpedia | **97.08** | 96.00 |
| YAGO–Wikidata | **95.54** | 92.19 |
| ENVO–SWEET | **93.18** | 83.70 |
| MI–MatOnto | **61.25** | 32.97 |

Ablations, other models and cost are in the
[full paper](https://github.com/cwru-sdle/kroma/blob/main/full.pdf).

## Reproduce the paper

```bash
git clone https://github.com/cwru-sdle/kroma.git && cd kroma
./setup.sh && source .venv/bin/activate
uv pip install ".[models]"

kroma run --method_config kroma_scibert_envo_sweet \
          --llm meta-llama/Llama-3.3-70B-Instruct-Turbo-Free
```

Datasets, configs and flags are described in
[Benchmark experiments](https://kroma.readthedocs.io/en/latest/usage.html).

## Citation

```bibtex
@inproceedings{nguyen_2025_kroma,
  title     = {KROMA: Ontology Matching with Knowledge Retrieval and Large Language Models},
  author    = {Lam Nguyen and Erika Barcelos and Roger French and Yinghui Wu},
  booktitle = {The Semantic Web -- ISWC 2025: 24th International Semantic Web Conference, Proceedings, Part I},
  series    = {Lecture Notes in Computer Science},
  publisher = {Springer},
  pages     = {629--649},
  year      = {2025},
  doi       = {10.1007/978-3-032-09527-5_34}
}
```

## License

[BSD 3-Clause](https://github.com/cwru-sdle/kroma/blob/main/LICENSE) ·
Developed at the [SDLE Research Center](https://github.com/cwru-sdle),
Case Western Reserve University.
