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.

bench(lubm): 14 of 14 with owl-rl-ext, correcting the earlier 8 of 14

FABIOTESS0fbd62059b17
diff --git a/benchmark/lubm/RESULTS.md b/benchmark/lubm/RESULTS.md
index ad3d3f88..60d88d3e 100644
--- a/benchmark/lubm/RESULTS.md
+++ b/benchmark/lubm/RESULTS.md
@@ -9,9 +9,9 @@ steps are at the bottom; disagreement is welcome and cheap to settle.
## Load and materialisation
-| Dataset | Files | Triples | Load | Rate | OWL-RL | Inferred |
+| Dataset | Files | Triples | Load | Rate | `owl-rl-ext` | Inferred |
|---|---|---|---|---|---|---|
-| LUBM(1) | 15 | 100,866 | 0.2 s | ~649k triples/s | 0.2 s | +37,942 |
+| LUBM(1) | 15 | 100,866 | 0.2 s | ~649k triples/s | 0.3 s | +48,583 |
| LUBM(10) | 189 | 1,273,246 | 2.0 s | ~625k triples/s | 2.9 s | +472,155 |
Loading is linear and fast, and materialisation of 1.27M triples in under
@@ -19,47 +19,60 @@ three seconds is respectable for a single node with no tuning. Nothing here
is a scale claim: LUBM(100) and beyond, and any concurrent workload, remain
unmeasured.
-## The 14 queries, LUBM(1), after OWL-RL materialisation
+## The 14 queries, LUBM(1), after `owl-rl-ext` materialisation
`expected` is the published answer count for LUBM(1) under complete OWL
inference.
-| Query | Expected | Ours | Complete | Note |
-|---|---|---|---|---|
-| Q1 | 4 | 4 | yes | |
-| Q2 | 0 | 0 | yes | genuinely empty at LUBM(1), one university |
-| Q3 | 6 | 6 | yes | |
-| Q4 | 34 | 34 | yes | subclass and property inference |
-| Q5 | 719 | 719 | yes | `memberOf` subproperty inference |
-| Q6 | 7,790 | 5,916 | **no** | needs `Student` definition |
-| Q7 | 67 | 59 | **no** | needs `Student` definition |
-| Q8 | 7,790 | 5,916 | **no** | needs `Student` definition |
-| Q9 | 208 | 103 | **no** | needs `Student` definition |
-| Q10 | 4 | 0 | **no** | needs `Student` definition |
-| Q11 | 224 | 224 | yes | transitive `subOrganizationOf` |
-| Q12 | 15 | 0 | **no** | needs `Chair` definition |
-| Q13 | 1 | 1 | yes | inverse property (`hasAlumnus`) |
-| Q14 | 5,916 | 5,916 | yes | |
-
-**8 of 14 complete. The 6 incomplete answers share one cause.**
-
-LUBM defines two classes by equivalence to a restriction:
+| Query | Expected | Ours | |
+|---|---|---|---|
+| Q1 | 4 | 4 | correct |
+| Q2 | 0 | 0 | correct (genuinely empty at LUBM(1), one university) |
+| Q3 | 6 | 6 | correct |
+| Q4 | 34 | 34 | correct |
+| Q5 | 719 | 719 | correct |
+| Q6 | 7,790 | 7,790 | correct |
+| Q7 | 67 | 67 | correct |
+| Q8 | 7,790 | 7,790 | correct |
+| Q9 | 208 | 208 | correct |
+| Q10 | 4 | 4 | correct |
+| Q11 | 224 | 224 | correct |
+| Q12 | 15 | 15 | correct |
+| Q13 | 1 | 1 | correct |
+| Q14 | 5,916 | 5,916 | correct |
+
+**14 of 14 complete**, in 0.3 s of materialisation over 100,866 triples
+(+48,583 inferred).
+
+### The profile matters, and choosing it wrongly looks like a reasoner gap
+
+The first run of this suite used `owl-rl` and returned **8 of 14**. Six
+queries came back incomplete, and they shared a cause: LUBM defines two
+classes by equivalence to an existential restriction,
```
Student ≡ Person ⊓ ∃takesCourse.Course
Chair ≡ Person ⊓ ∃headOf.Department
```
-Recognising a `GraduateStudent` as a `Student` therefore requires reasoning
-over an existential restriction on the *left* of an equivalence, which is
-OWL 2 DL and outside the OWL-RL profile the materialiser implements. Every
-incomplete row above is that single missing capability, not six separate
-gaps: Q6, Q7, Q8, Q9 and Q10 all need `Student`, and Q12 needs `Chair`.
+and recognising a `GraduateStudent` as a `Student` therefore needs
+reasoning over `someValuesFrom`, which is outside the OWL-RL profile.
+
+That is a real limit of `owl-rl`, and it is not a limit of the engine:
+`owl-rl-ext` implements `someValuesFrom`, `allValuesFrom`, `hasValue`,
+intersection and union, and returns all 14 exactly. The lesson worth
+recording is about measurement rather than reasoning. An incomplete answer
+set looks identical whether the reasoner cannot do the work or was simply
+not asked to, and the first version of this file published the wrong
+conclusion for exactly that reason.
+
+| Profile | Q6 | Q12 | Inferred | Time |
+|---|---|---|---|---|
+| `owl-rl` | 5,916 | 0 | +37,942 | 0.2 s |
+| `owl-rl-ext` | 7,790 | 15 | +48,583 | 0.3 s |
-This is the honest statement of where the reasoner stands. It is a bounded,
-nameable gap rather than a vague one, and closing it is a known piece of
-work: recognise `C ≡ D ⊓ ∃P.E` definitions and add the corresponding
-instance-recognition rule during materialisation.
+Use `owl-rl-ext` when the ontology defines classes by restriction, which
+any ontology with genuine OWL semantics will.
## Query latency
@@ -101,7 +114,7 @@ java -cp classes edu.lehigh.swat.bench.uba.Generator \
-onto http://swat.cse.lehigh.edu/onto/univ-bench.owl
# 3. run
-python3 run_lubm.py --data data1 --reason --runs 3 --out results-lubm1.json
+python3 run_lubm.py --data data1 --reason --profile owl-rl-ext --runs 3 --out results-lubm1.json
```
## Not yet measured
diff --git a/benchmark/lubm/readme.txt b/benchmark/lubm/readme.txt
new file mode 100644
index 00000000..0d8d5fec
--- /dev/null
+++ b/benchmark/lubm/readme.txt
@@ -0,0 +1,35 @@
+####################################################
+Univ-Bench Artificial Data Generator (UBA)
+ Version 1.7
+ The Semantic Web and Agent Technologies (SWAT) Lab
+ CSE Department, Lehigh University
+####################################################
+
+==================
+USAGES
+==================
+
+command:
+ edu.lehigh.swat.bench.uba.Generator
+ [-univ <univ_num>]
+ [-index <starting_index>]
+ [-seed <seed>]
+ [-daml]
+ -onto <ontology_url>
+
+options:
+ -univ number of universities to generate; 1 by default
+ -index starting index of the universities; 0 by default
+ -seed seed used for random data generation; 0 by default
+ -daml generate DAML+OIL data; OWL data by default
+ -onto url of the univ-bench ontology
+
+- The package's path should be on CLASSPATH.
+
+==================
+Contact
+==================
+
+Yuanbo Guo [email protected]
+
+For more information about the benchmark, visit its homepage http://www.lehigh.edu/~yug2/Research/SemanticWeb/LUBM/LUBM.htm.
diff --git a/benchmark/lubm/results-lubm1-ext.json b/benchmark/lubm/results-lubm1-ext.json
new file mode 100644
index 00000000..feb19e5e
--- /dev/null
+++ b/benchmark/lubm/results-lubm1-ext.json
@@ -0,0 +1,97 @@
+{
+ "dataset": "data1",
+ "files": 15,
+ "triples": 100866,
+ "load_seconds": 0.16,
+ "reasoned": true,
+ "profile": "owl-rl-ext",
+ "reason_seconds": 0.28,
+ "inferred_triples": 48583,
+ "runs_per_query": 1,
+ "queries": [
+ {
+ "query": "Q1",
+ "results": 4,
+ "ms": 271.4,
+ "needs_inference": false
+ },
+ {
+ "query": "Q2",
+ "results": 0,
+ "ms": 296.9,
+ "needs_inference": true
+ },
+ {
+ "query": "Q3",
+ "results": 6,
+ "ms": 269.0,
+ "needs_inference": false
+ },
+ {
+ "query": "Q4",
+ "results": 34,
+ "ms": 265.6,
+ "needs_inference": true
+ },
+ {
+ "query": "Q5",
+ "results": 719,
+ "ms": 278.3,
+ "needs_inference": true
+ },
+ {
+ "query": "Q6",
+ "results": 7790,
+ "ms": 280.8,
+ "needs_inference": true
+ },
+ {
+ "query": "Q7",
+ "results": 67,
+ "ms": 272.4,
+ "needs_inference": true
+ },
+ {
+ "query": "Q8",
+ "results": 7790,
+ "ms": 329.2,
+ "needs_inference": true
+ },
+ {
+ "query": "Q9",
+ "results": 208,
+ "ms": 293.2,
+ "needs_inference": true
+ },
+ {
+ "query": "Q10",
+ "results": 4,
+ "ms": 272.6,
+ "needs_inference": true
+ },
+ {
+ "query": "Q11",
+ "results": 224,
+ "ms": 275.8,
+ "needs_inference": true
+ },
+ {
+ "query": "Q12",
+ "results": 15,
+ "ms": 288.9,
+ "needs_inference": true
+ },
+ {
+ "query": "Q13",
+ "results": 1,
+ "ms": 302.2,
+ "needs_inference": true
+ },
+ {
+ "query": "Q14",
+ "results": 5916,
+ "ms": 332.0,
+ "needs_inference": false
+ }
+ ]
+}
\ No newline at end of file
diff --git a/benchmark/lubm/run_lubm.py b/benchmark/lubm/run_lubm.py
index e181a3df..f7633a0f 100644
--- a/benchmark/lubm/run_lubm.py
+++ b/benchmark/lubm/run_lubm.py
@@ -111,7 +111,8 @@ def main() -> int:
ap.add_argument("--data", default="data1", help="directory of generated .owl files")
ap.add_argument("--binary", default="../../target/release/open-ontologies")
ap.add_argument("--ontology", default="univ-bench.owl")
- ap.add_argument("--reason", action="store_true", help="materialise OWL-RL before querying")
+ ap.add_argument("--reason", action="store_true", help="materialise before querying")
+ ap.add_argument("--profile", default="owl-rl-ext", help="rdfs | owl-rl | owl-rl-ext")
ap.add_argument("--runs", type=int, default=3, help="runs per query, best taken")
ap.add_argument("--out", default=None, help="write results as JSON")
args = ap.parse_args()
@@ -137,12 +138,12 @@ def main() -> int:
inferred = None
if args.reason:
t0 = time.time()
- r = batch(args.binary, loads + ["reason owl-rl", "stats"])
+ r = batch(args.binary, loads + [f"reason {args.profile}", "stats"])
reason_seconds = time.time() - t0 - load_seconds
after = next((x["result"] for x in r if x.get("command") == "stats"), {})
inferred = after.get("triples", 0) - triples
- print(f" reason (owl-rl): {reason_seconds:.1f}s, +{inferred} inferred triples")
- loads = loads + ["reason owl-rl"]
+ print(f" reason ({args.profile}): {reason_seconds:.1f}s, +{inferred} inferred triples")
+ loads = loads + [f"reason {args.profile}"]
rows = []
for name, query, needs_inference in QUERIES:
@@ -171,6 +172,7 @@ def main() -> int:
"triples": triples,
"load_seconds": round(load_seconds, 2),
"reasoned": bool(args.reason),
+ "profile": args.profile if args.reason else None,
"reason_seconds": round(reason_seconds, 2) if reason_seconds else None,
"inferred_triples": inferred,
"runs_per_query": args.runs,