From c87839776a15689c57a0b37098880e16f21aa234 Mon Sep 17 00:00:00 2001 From: Luke Friedrichs Date: Sun, 22 Feb 2026 18:52:49 +0100 Subject: [PATCH 1/2] fix for all case --- ddp_reasoning.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ddp_reasoning.py b/ddp_reasoning.py index a44fbf64..b5238c0a 100644 --- a/ddp_reasoning.py +++ b/ddp_reasoning.py @@ -947,6 +947,38 @@ def _cross_shard_instances(self, ce: OWLClassExpression, direct: bool = False) - for shard_res in shard_results: if ce_str in shard_res: combined[ce_str] |= shard_res[ce_str] + elif isinstance(ce_obj, OWLObjectAllValuesFrom): + # 1. Keep what shards could prove locally (e.g., TBox closure, same-shard fillers) + local_results = set() + for shard_res in shard_results: + if ce_str in shard_res: + local_results |= shard_res[ce_str] + + # 2. Bridge the cross-shard gap using Nominal Injection + filler_str = str(ce_obj.get_filler()) + filler_iris = combined.get(filler_str, set()) + + cross_results = set() + if filler_iris: + # Package globally known C instances into a closed OWA set: {i_1, i_2, ...} + # (Ensure OWLNamedIndividual is imported from owlapy.owl_individual) + nominal_filler = OWLObjectOneOf([OWLNamedIndividual(iri) for iri in filler_iris]) + + # Create a new query: ∀ r.{i_1, i_2, ...} + cross_ce = OWLObjectAllValuesFrom( + property=ce_obj.get_property(), + filler=nominal_filler + ) + + # Dispatch this targeted cross-shard query + futures = [shard.query_instances.remote(cross_ce) for shard in self.shards] + shard_cross_results = ray.get(futures) + + if shard_cross_results: + cross_results = set().union(*shard_cross_results) + + # The final OWA-sound result is the union of local and cross-shard deductions + combined[ce_str] = local_results | cross_results else: # For other CEs (atomic classes, unions, intersections): union across # shards is correct because the ABox is partitioned — each individual From bf56abf558a7089f6c8827055c6f6ec7901d392e Mon Sep 17 00:00:00 2001 From: Luke Friedrichs Date: Sun, 22 Feb 2026 19:04:07 +0100 Subject: [PATCH 2/2] Update ddp_reasoning.py --- ddp_reasoning.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ddp_reasoning.py b/ddp_reasoning.py index b5238c0a..5f97d5e2 100644 --- a/ddp_reasoning.py +++ b/ddp_reasoning.py @@ -961,7 +961,6 @@ def _cross_shard_instances(self, ce: OWLClassExpression, direct: bool = False) - cross_results = set() if filler_iris: # Package globally known C instances into a closed OWA set: {i_1, i_2, ...} - # (Ensure OWLNamedIndividual is imported from owlapy.owl_individual) nominal_filler = OWLObjectOneOf([OWLNamedIndividual(iri) for iri in filler_iris]) # Create a new query: ∀ r.{i_1, i_2, ...}