Model
Concepts
The ontology is the matching semantics of a query over a fixed graph, so editing it changes answers without touching a fact.
Querying a graph with an ontology
An ontology O = (C, R) has classes and triples, including subClassOf. A knowledge graph G has entities, edges, and asserted types. A query is a pattern whose nodes carry classes and whose edges carry properties. Under O, an entity matches a pattern node when one of its types falls under the node's class, and an edge matches when its property is the pattern's property or a subproperty of it. The answer Q_O(G) is the set of matches.
The graph stays fixed; only the ontology changes. The same pattern on the same graph has different answers under different ontologies. Ontology-based entity matching (Ma et al., PVLDB 2019) relaxes class membership further, to ontological closeness above a threshold.
Quality and harm
A workload is a set of queries with gold answers. P_q(O) is the answer F1 of query q. The harm of moving from O to O' is the mean F1 drop over the workload:
H(O, O') = mean over q of P_q(O) − P_q(O')
It is measured over the workload, so an edit that breaks one answer while repairing another does not look harmless. In code: workload_harm and harm_over.
Affected area
After incremental graph pattern matching (Fan et al., SIGMOD 2011), the affected area of an ontology update is the set of matches it adds or removes: AFF_q = Q_O(G) △ Q_O'(G). forensics.affected_area computes it per query, and forensics.attribute splits a chain's affected area across its actions.
A ⊑ B can change the classes under a pattern node only when that node's class is a superclass of B (or B itself), and then only by classes under A. The detector uses this to re-score only the queries an edit can reach.Impact
The counterfactual impact of a class is Δ_c = P(O) − P(O \ c), and Δ_r likewise for a triple: concept_impact, relation_impact. Group testing over subtrees (group_impact) gives the same values with fewer evaluations when few classes matter. An impact ranking is a defender's diagnostic and an attacker's map at once.
Amplification
Removing one asserted A ⊑ B can remove every inferred X ⊑ Y with X under A and Y above B. forensics.closure_delta reports the asserted and inferred triples a change touches and their ratio; on mouse anatomy, two removals change almost six inferred triples for each asserted one.