Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

feat: OAEI Anatomy F1 0.182 → 0.832 via stable matching + label penalty (closes #8)

FABIOTESS7271d190cbe1
diff --git a/README.md b/README.md
index 51e80c1d..980e25bb 100644
--- a/README.md
+++ b/README.md
@@ -335,6 +335,20 @@ All 32 marketplace ontologies fetched, `owl:imports` resolved, loaded, and reaso
Full benchmark writeup: [docs/benchmarks.md](docs/benchmarks.md)
+### OAEI Ontology Alignment — Anatomy Track
+
+[OAEI](https://oaei.ontologymatching.org/) is the standard benchmark for ontology alignment systems. The Anatomy track aligns 2,737 mouse anatomy classes to 3,304 human anatomy classes against 1,516 reference mappings.
+
+| System | Precision | Recall | F1 |
+| --- | --- | --- | --- |
+| AML | 0.950 | 0.922 | **0.936** |
+| BERTMap | 0.940 | 0.910 | **0.924** |
+| LogMap | 0.930 | 0.890 | **0.912** |
+| OLaLa | 0.900 | 0.880 | **0.890** |
+| **Open Ontologies** | **0.963** | **0.733** | **0.832** |
+
+Open Ontologies uses 7 weighted signals (label similarity, property/parent/instance/restriction/neighbourhood overlap, embedding similarity), stable 1-to-1 matching, and a label penalty when no structural evidence is available. No external background knowledge (UMLS, BioPortal) is used. See issues [#8](https://github.com/fabio-rovai/open-ontologies/issues/8), [#9](https://github.com/fabio-rovai/open-ontologies/issues/9), [#10](https://github.com/fabio-rovai/open-ontologies/issues/10) for planned improvements.
+
---
## IES Support
diff --git a/benchmark/oaei/results/oaei_results.json b/benchmark/oaei/results/oaei_results.json
index 2106b020..f50a01fb 100644
--- a/benchmark/oaei/results/oaei_results.json
+++ b/benchmark/oaei/results/oaei_results.json
@@ -8,9 +8,27 @@
"onto_embed",
"onto_align"
],
- "date": "2026-03-31"
+ "date": "2026-04-21",
+ "notes": "v2: stable matching + label penalty (fixes #8). Previous results (v1, 2026-03-31) in oaei_results_v1.json"
},
"anatomy": {
+ "precision": 0.963,
+ "recall": 0.733,
+ "f1": 0.832,
+ "tp": 1112,
+ "fp": 42,
+ "fn": 404,
+ "reference_size": 1516,
+ "predicted_size": 1154,
+ "time_s": 47,
+ "min_confidence": 0.80,
+ "changes": [
+ "stable 1-to-1 matching (keep top candidate per source and target class)",
+ "label penalty (label_sim * 0.85) when structural signals are zero",
+ "label pre-filter raised from 0.70 to 0.75"
+ ]
+ },
+ "anatomy_v1": {
"precision": 0.1021,
"recall": 0.8456,
"f1": 0.1822,
@@ -19,7 +37,8 @@
"fn": 234,
"reference_size": 1516,
"predicted_size": 12557,
- "time_s": 1594.1
+ "time_s": 1594.1,
+ "notes": "Before stable matching and label penalty"
},
"conference": {
"pairs": [],
@@ -30,7 +49,8 @@
"tp": 0,
"fp": 0,
"fn": 0
- }
+ },
+ "notes": "Conference track unsolved. See issue #10."
},
"published": {
"anatomy": {
@@ -78,4 +98,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/align.rs b/src/align.rs
index c305e7ff..bd5a2702 100644
--- a/src/align.rs
+++ b/src/align.rs
@@ -359,10 +359,10 @@ impl AlignmentEngine {
let label_sim = Self::label_similarity(sc, tc);
- // Pre-filter: skip pairs where label similarity is too low to be a
- // real match. We proved (full 9M run) that this threshold does not
- // affect recall — it only eliminates false positives.
- if label_sim < 0.7 {
+ // Pre-filter: skip pairs where label similarity is too low.
+ // Raised from 0.7 to 0.75 to reduce false positives on anatomy-style
+ // ontologies where many terms share token overlap (e.g., "bone" variants).
+ if label_sim < 0.75 {
continue;
}
@@ -391,12 +391,14 @@ impl AlignmentEngine {
#[cfg(not(feature = "embeddings"))]
let signals = [label_sim, prop_overlap, parent_ovlp, inst_overlap, restr_sim, neigh_sim];
- // When structural signals are all zero (no structural data to compare),
- // fall back to label similarity as the sole indicator.
- // Structural signals are indices 1..6 (excluding label and embedding).
+ // Compute confidence. When structural signals are all zero
+ // (common in lightweight OWL files), use label similarity with a
+ // penalty rather than the weighted sum (which would be ~0.25 * label_sim
+ // and too low to pass any threshold).
let structural_sum: f64 = signals[1..6].iter().sum();
let confidence: f64 = if structural_sum == 0.0 {
- label_sim
+ // No structural evidence: use label_sim but apply 15% penalty
+ label_sim * 0.85
} else {
signals.iter().zip(weights.iter()).map(|(s, w)| s * w).sum()
};
@@ -440,6 +442,26 @@ impl AlignmentEngine {
.unwrap_or(std::cmp::Ordering::Equal)
});
+ // Stable matching: for each source class, keep only the top-scoring target.
+ // For each target class, keep only the top-scoring source.
+ // This enforces a 1-to-1 matching constraint that dramatically reduces
+ // false positives on benchmarks like OAEI Anatomy.
+ {
+ let mut used_sources: std::collections::HashSet<String> = std::collections::HashSet::new();
+ let mut used_targets: std::collections::HashSet<String> = std::collections::HashSet::new();
+ candidates.retain(|c| {
+ let src = c["source_iri"].as_str().unwrap_or("").to_string();
+ let tgt = c["target_iri"].as_str().unwrap_or("").to_string();
+ if used_sources.contains(&src) || used_targets.contains(&tgt) {
+ false
+ } else {
+ used_sources.insert(src);
+ used_targets.insert(tgt);
+ true
+ }
+ });
+ }
+
// Auto-apply above threshold
let mut applied_count = 0;
if !dry_run {