Knowledge bases that mix ontologies with rules face an awkward engineering choice. An ontology here is a set of class and role definitions reasoned about under the open-world assumption, where anything not proven is unknown. Rules are logic programs that reason under the closed-world assumption, where anything not proven is false. One way to combine them keeps the ontology reasoner and the rule engine as separate programs that query each other at runtime. This is modular and easy to maintain, but it is slow. The other way compiles everything into a single answer set program, a declarative program whose solutions a solver such as clingo enumerates. This is fast, but it gives up modularity: any change to any ontology forces the whole theory to be rebuilt. We propose a third option borrowed from ordinary programming languages, separate compilation. Each ontology module is compiled on its own into an answer set program fragment with a declared interface. Its private helper symbols are projected away, and the fragments are linked at solve time. The goal is that editing one module costs a recompile of that module only, while solving keeps the speed of the monolithic translation.
The question matters because the strongest existing result is a monolithic one. Combining Rules and Ontologies into Clopen Knowledge Bases defines clopen knowledge bases: a disjunctive Datalog program, a first-order or description logic theory, and a declared set of "open" predicates. It compiles the separable ones into plain disjunctive answer set programs. On Vienna OpenStreetMap data it reports handling "over 1 million facts in under 100 seconds", while the loosely coupled dlvhex "often failed due to memory exhaustion on even small datasets". The file's gap analysis identifies what nobody has shown: that compilation-level speed can coexist with the ability to swap or edit ontology components independently. This note makes that the central question and treats modular system design as the lens for the engineering constraint, not as a second co-equal topic.
Core Claim
Our claim has two parts. First, there is a checkable condition on how ontology modules share vocabulary under which linking separately compiled fragments gives exactly the same answers as compiling their union. Second, when that condition holds, the time from an ontology edit to a new answer grows with the size of the edited module rather than with the whole knowledge base, and solve time stays within a small constant factor of the monolithic translation. When the condition fails, the compiler should detect this and fall back to recompiling only the affected group of modules.
The first part is not automatic. The clopen translation guesses extensions for open predicates and adds constraints derived from the ontology axioms. If two ontology modules both constrain a shared open predicate, or if one module's existential axioms create consequences that another module's axioms depend on, then compiling each module alone can lose answers or admit wrong ones. Our working conjecture is that correctness follows when modules interact only through closed predicates, or through open predicates on which each module's translation is a conservative extension relative to the declared interface. Proving or refuting this conjecture is the theoretical core of the project.
Relation to Prior Work
Three lines of work motivate the proposal. The loose-coupling systems treat the ontology reasoner as an oracle called from rule bodies. Hybrid Reasoning with Rules and Ontologies does this under three-valued well-founded semantics with constraint-driven resolution, and Position Paper: Ontological Logic Programming calls an external OWL reasoner at runtime. Both keep modularity, but they pay for repeated calls across the boundary between engines, which the clopen paper identifies as the cause of the dlvhex failures. The clopen compilation fixes the speed problem by abandoning runtime modularity. We keep its translation as the per-module method and change only its unit of compilation.
Two papers constrain the design. A Faithful Integration of Description Logics with Logic Programming shows that decidability of hybrid MKNF depends on DL-safety, which lets rules range only over individuals named in the data. Any interface we define must respect a similar restriction, or linking could reintroduce undecidable interactions through anonymous individuals. Effective Query Rewriting with Ontologies over DBoxes shows that closing predicates changes data complexity. Moving a predicate across an interface boundary from open to closed is therefore not a harmless engineering choice, and our interface declarations must state it explicitly.
One paper supplies a key technique. Forgetting in Modular Answer Set Programming studies how to eliminate the private vocabulary of an answer set program module while preserving its input/output behavior under composition. We apply that operation to the auxiliary atoms produced by the clopen translation, which that paper does not consider because it has no ontology or open-world component.
The design-pattern literature supplies vocabulary but no executable content. Modular design patterns for hybrid learning and reasoning systems is a descriptive taxonomy of 15 patterns, and The RAIL Principles for Neurosymbolic AI is a qualitative rubric. We do not claim to operationalize either. Our contribution is narrower: a correctness condition and a compiler for one concrete kind of module boundary.
Research Program
The theoretical component defines a modular clopen knowledge base as a shared rule program together with ontology modules. Each ontology module comes with an interface: the predicates it reads, the predicates it constrains, and for each whether it is open or closed. We will state and try to prove the linking theorem, that the answers of the linked program equal the answers of the monolithic clopen translation, under the interface condition sketched above. We will also construct counterexamples showing which parts of the condition are necessary. The expressive range is the description logics treated by the clopen paper, from $\mathcal{ALC}$ and $\mathcal{ALCH}$ up to $\mathcal{ALCHOI}$. Inverse roles and nominals are the cases where cross-module existential interactions are most likely to break the condition.
The engineering component is a compiler with three stages. The first stage checks interfaces syntactically and groups interacting modules into "compilation units". The second stage translates each unit with the clopen procedure and then applies modular forgetting to its private helper atoms. The third stage links the resulting fragments by loading them as named program parts in clingo, so that an edited unit can be replaced without touching the others. A small interface description language keeps module contracts explicit, in the spirit of the abstract-interface benchmarking designs of Universal Causal Evaluation Engine and VeriBench. Here the contract is semantic rather than a function signature.
Baselines
The strongest competitor is monolithic clopen compilation as described in Combining Rules and Ontologies into Clopen Knowledge Bases. After every edit it recompiles the full theory and re-solves it from scratch in clingo. It is strongest because it is the only method in the file with reported large-scale performance: over one million facts in under 100 seconds, with near-linear scaling in the number of facts. We will run it on the same machine, clingo version, data, and edit sequence as our system, and apply the same solver configuration search to both. Beating it means strictly lower edit-to-answer latency over a realistic edit stream, identical answer sets on every query, and solve time no worse than 1.5 times monolithic.
The naive reference point is loose coupling through dlvhex with external ontology calls. It represents what modularity costs today. We expect it to fail at scale, as reported, and we will record the fact size at which it runs out of memory rather than tune it heavily.
Two ablations isolate our ingredients. The first compiles each module independently and links the fragments without the interface check. On the counterexample suite it should produce wrong or missing answers, which would show that the correctness condition does real work. The second skips forgetting. It measures how much of the grounding-size and solve-time parity comes from projecting away private atoms.
Why not just…?
Why not just recompile monolithically after every edit? This is the most serious threat. If translation is cheap compared with solving, separate compilation saves little. The clopen paper reports end-to-end time but, in the material available, does not separate translation time from grounding and solving. So there is no reported result on Lacuna that breaks down compile versus solve cost for clopen knowledge bases. Our first experiment measures exactly this breakdown. If ontology translation plus regrounding is under roughly ten percent of total time on realistic inputs, we will narrow the claim. The contribution would then be the linking theorem and the ability to swap modules, not speed.
Why not just make loose coupling smarter, for example with batched and cached oracle calls to the ontology reasoner? Caching reduces the number of calls across the boundary but does not give the rule solver's search access to ontology constraints, so pruning still happens outside the solver. That lack of shared pruning is the failure mode diagnosed for dlvhex in the clopen paper. We will include a cached-oracle variant as a secondary baseline to test whether caching alone closes the gap.
Why not just hand-split the compiled program into clingo program parts? A skilled user can do this. Without an interface condition, however, nothing says the split preserves answers, and the non-interface ablation is designed to show how often it silently does not. The honest framing is that the mechanism for replacing program parts already exists in the solver. What we add is knowing when using it is sound, and automating the split.
Proposed Experiments
The primary benchmark is the Vienna OpenStreetMap (MyITS) dataset with its $\mathcal{ALCH}$ ontology, used at 145,000 to over 1,000,000 facts as in the clopen paper. We split the ontology into modules for tourism, transit, and geography. We then generate edit streams that add or remove axioms in one module, which reflects the maintenance setting that monolithic compilation handles badly. To probe expressiveness, we add a synthetic generator that varies the description logic fragment from $\mathcal{ALC}$ to $\mathcal{ALCHOI}$, the number of modules, and the fraction of shared open predicates. The generator also produces the counterexample suite for the theory.
The metrics are edit-to-answer latency, split into compile, ground, and solve time; grounding size; peak memory; and exact agreement of answer sets with the monolithic translation. Three results would settle the question. The compile-versus-solve breakdown tells us whether separate compilation can matter at all. Agreement on every query under the interface condition, together with disagreement on the counterexamples for the ablation without the check, shows that the theorem does real work. A latency curve that stays flat as untouched modules grow, while monolithic latency grows linearly, confirms the core efficiency claim. If agreement fails under the condition, the conjecture is wrong and the program becomes a search for the right condition.
References
- Combining Rules and Ontologies into Clopen Knowledge Bases
- Hybrid Reasoning with Rules and Ontologies
- Position Paper: Ontological Logic Programming
- A Faithful Integration of Description Logics with Logic Programming
- Effective Query Rewriting with Ontologies over DBoxes
- Forgetting in Modular Answer Set Programming
- Modular design patterns for hybrid learning and reasoning systems
- The RAIL Principles for Neurosymbolic AI: Reasoning, Assurances, Interfacing and Learning
- Universal Causal Evaluation Engine: An API for empirically evaluating causal inference models
- VeriBench: Analyzing the Performance of Database Systems with Verifiability