Loreto stands for Logic Ontology Representation Tokenization Optimisation.
Loreto is a compact textual serialization for RDF/OWL datasets designed to reduce token consumption for large language models while preserving the underlying graph structure needed for ontology use, retrieval tasks, and reasoning-oriented workflows.
Standard RDF serializations such as RDF/XML, Turtle, N-Triples, TriG, and JSON-LD are useful for interoperability, but they are not optimized for LLM prompt efficiency.
Loreto focuses on:
- compact namespace planning
- compact repeated IRI representation
- low syntactic overhead
- LLM-friendly graph layout
- preservation of literal lexical forms
- preservation of named graphs and dataset contexts
Install the core converter dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtConvert an ontology to Loreto:
python3 loreto.py input.owl
python3 loreto.py input.ttl --no-ttl
python3 loreto.py input.rdf -o output.loretThe converter writes:
input.loret- optionally
input.normalized.ttl
loreto.py: main RDF/OWL to Loreto converterbenchmark/: benchmark suite covering size, model performance, and reasoningexamples/: small RDF, OWL, and SWRL examples with Loreto outputsdocs/: technical notes on the format and benchmarksrequirements.txt: core runtime dependencies
Loreto/
├── README.md
├── LICENSE
├── loreto.py
└── examples/
├── README.md
├── basic/
├── owl/
└── swrl/
Small concrete examples are available in examples/:
examples/basic/for a minimal RDF graphexamples/owl/for OWL content encoded as RDFexamples/swrl/for SWRL represented through RDF triples