mlflow2rdf
A Python package to convert MLflow tracking data into MLSO-aligned RDF Knowledge Graphs.
Overview
mlflow2rdf transforms your MLflow experiment metadata (parameters, metrics, tags) into semantic RDF triples that conform to the MLSO (Machine Learning Sailor Ontology) standard. This enables:
- Semantic querying via SPARQL instead of imperative MLflow API loops
- Cross-platform interoperability with public ML knowledge graphs like MLSea
- FAIR principles for ML experiments: Findable, Accessible, Interoperable, Reusable
Installation
pip install mlflow2rdf
Quick Start
Command Line Interface
# Convert MLflow runs to RDF
mlflow2rdf --uri /path/to/mlruns --out output.ttl
# With SHACL validation
mlflow2rdf --uri /path/to/mlruns --out output.ttl --validate
Flags are
--uri/--out(not--mlruns/--output).
Python API
from mlflow2rdf import SemanticTracker, export_and_validate
# Convert to RDF
tracker = SemanticTracker(
mlflow_uri="/path/to/mlruns",
output_graph_uri="http://w3id.org/mlsea/mlflow/kg",
default_modality="tabular",
)
graph = tracker.export(experiment_ids=None, exclude_failed_runs=False)
# Serialize to Turtle format
graph.serialize("output.ttl", format="turtle")
# Or export + validate in one call
export_and_validate("/path/to/mlruns", "output.ttl", inference="owlrl")
The previously documented
MLflow2RDFConverterclass does not exist. The real entry points areSemanticTrackerandexport_and_validate.
Features
- Multi-modal support: Tabular, image, text, time-series, and multi-modal data
- Paradigm-aware routing: Automatic parameter routing based on learning paradigm
- Pipeline relationship inference: Detects knowledge distillation, LoRA adapters, self-supervised learning chains
- SHACL validation: Comprehensive shape validation against MLSO constraints
- Blind spot analysis: Completeness verification of metadata extraction
Supported Learning Paradigms
| Paradigm | Key Properties |
|---|---|
| Supervised Classification | Standard hyperparameters, accuracy metrics |
| Self-Supervised Learning | Pre-text/downstream run partitioning |
| Contrastive Learning | Temperature, distance metrics |
| Knowledge Distillation | Teacher-student relationships, distillation temperature |
| Parameter-Efficient Fine-tuning (LoRA) | Adapter rank, alpha, target modules |
| Multi-Modal Fusion | Fusion strategy, image/text encoders |
| Time-Series Forecasting | Forecasting horizon, lookback window |
Output Format
The package generates RDF triples in Turtle format, using MLSO/MLST vocabulary:
@prefix mls: <http://www.w3.org/ns/mls#> .
@prefix mlso: <http://w3id.org/mlso/> .
<run/abc123> a mls:Run ;
mls:hasInput <dataset/cifar10> ;
mls:hasOutput <evaluation/acc_0.95> ;
mlso:hasParadigm "Supervised Classification" .
Requirements
- Python >= 3.8
- MLflow >= 2.0.0
- RDFLib >= 6.0.0
- pySHACL >= 0.25.0
License
MIT License
Citation
If you use this package in your research, please cite:
@mastersthesis{jia2026mlflow2rdf,
author = {Jia, Sijie},
title = {Bridging ML Tracking and Semantic Interoperability: Transforming MLflow Experiment Metadata to MLSO-Aligned RDF Knowledge Graphs},
school = {KU Leuven},
year = {2026}
}
Links
Metadata
Release files for mlflow2rdf 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mlflow2rdf-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for mlflow2rdf-0.2.4-py3-none-any.whl |
Release files / mlflow2rdf-0.2.4-py3-none-any.whl
| Download URL | mlflow2rdf-0.2.4-py3-none-any.whl |
|---|---|
| Size | 64.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e0f142c78c22bb91ec23d71efdbdf23b9e927c53c80df8ec44306b5cf7427fc
|
|
BLAKE2b-256 checksum How to use checksums |
e289bb1f38e12de3b4e8e964cffd86d5e0320e0ed2825334f599dacc4673dff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for mlflow2rdf 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.