Permalink
Browse files

Merge branch 'feature/deterministic-rules' into feature/tracing-merging

Conflicts:
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/incremental/ContextInitializationFactory.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/caching/CachedIndexedObjectFactory.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/caching/DelegatingCachedIndexedObjectFactory.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/caching/UpdatingModifiableIndexedObjectFactory.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/conversion/ElkAxiomConverterImpl.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/factories/ModifiableIndexedAxiomFactory.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/factories/ModifiableIndexedDisjointClassesAxiomFactory.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/implementation/CachedIndexedDisjointClassesAxiomImpl.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/implementation/ModifiableIndexedObjectFactoryImpl.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/implementation/ModifiableIndexedSubClassOfAxiomImpl.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/implementation/ModifiableIndexedSubObjectPropertyOfAxiomImpl.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/DelegatingIndexedObjectVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/IndexedAxiomVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/NoOpIndexedAxiomVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/NoOpIndexedObjectVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/ContextImpl.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/conclusions/visitors/AbstractRuleApplicationConclusionVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/conclusions/visitors/CountingConclusionVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/conclusions/visitors/NonRedundantLocalRuleApplicationConclusionVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/conclusions/visitors/RedundantLocalRuleApplicationConclusionVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/context/ContextPremises.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/AbstractRuleVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleApplicationTimerVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleCounterVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleStatistics.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/ContradictionFromNegationRule.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/IndexedObjectComplementOfDecomposition.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/LinkedSubsumerRuleVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/ObjectIntersectionFromConjunctRule.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/SubsumerDecompositionRuleVisitor.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/SuperClassFromSubClassRule.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/stages/IncrementalAdditionInitializationStage.java
	elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/stages/IncrementalDeletionInitializationStage.java
  • Loading branch information...
ykazakov committed Sep 1, 2015
2 parents 5c9ad52 + 64d9c92 commit b330594e0351eef1770ff019af0fa6aa0d4169a2
Showing with 2,815 additions and 274 deletions.
  1. +3 −3 elk-benchmark/src/main/java/org/semanticweb/elk/reasoner/stages/CleaningRedundancyStageExecutor.java
  2. +83 −26 ...reasoner/src/main/java/org/semanticweb/elk/reasoner/incremental/ContextInitializationFactory.java
  3. +7 −5 ...oner/src/main/java/org/semanticweb/elk/reasoner/incremental/IncrementalChangesInitialization.java
  4. +2 −2 ...soner/src/main/java/org/semanticweb/elk/reasoner/incremental/TimedContextCollectionProcessor.java
  5. +10 −0 ...n/java/org/semanticweb/elk/reasoner/indexing/caching/ResolvingModifiableIndexedObjectFactory.java
  6. +10 −0 ...in/java/org/semanticweb/elk/reasoner/indexing/caching/UpdatingModifiableIndexedObjectFactory.java
  7. +14 −3 ...easoner/src/main/java/org/semanticweb/elk/reasoner/indexing/conversion/ElkAxiomConverterImpl.java
  8. +1 −0 .../src/main/java/org/semanticweb/elk/reasoner/indexing/factories/ModifiableIndexedAxiomFactory.java
  9. +42 −0 ...java/org/semanticweb/elk/reasoner/indexing/factories/ModifiableIndexedDefinitionAxiomFactory.java
  10. +311 −0 ...src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/AbstractElkAxiomIndexerVisitor.java
  11. +75 −1 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/DifferentialIndex.java
  12. +18 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/DirectIndex.java
  13. +72 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/ElkAxiomIndexer.java
  14. +12 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/IndexedClass.java
  15. +31 −0 ...easoner/src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/IndexedDefinitionAxiom.java
  16. +1 −1 ...er/src/main/java/org/semanticweb/elk/reasoner/indexing/hierarchy/IndexedObjectSomeValuesFrom.java
  17. +27 −0 ...er/src/main/java/org/semanticweb/elk/reasoner/indexing/implementation/CachedIndexedClassImpl.java
  18. +1 −1 ...a/org/semanticweb/elk/reasoner/indexing/implementation/CachedIndexedDisjointClassesAxiomImpl.java
  19. +91 −0 ...va/org/semanticweb/elk/reasoner/indexing/implementation/ModifiableIndexedDefinitionAxiomImpl.java
  20. +10 −0 ...java/org/semanticweb/elk/reasoner/indexing/implementation/ModifiableIndexedObjectFactoryImpl.java
  21. +1 −1 ...va/org/semanticweb/elk/reasoner/indexing/implementation/ModifiableIndexedSubClassOfAxiomImpl.java
  22. +1 −1 ...manticweb/elk/reasoner/indexing/implementation/ModifiableIndexedSubObjectPropertyOfAxiomImpl.java
  23. +18 −1 ...asoner/src/main/java/org/semanticweb/elk/reasoner/indexing/modifiable/ModifiableIndexedClass.java
  24. +36 −0 .../main/java/org/semanticweb/elk/reasoner/indexing/modifiable/ModifiableIndexedDefinitionAxiom.java
  25. +37 −0 ...soner/src/main/java/org/semanticweb/elk/reasoner/indexing/modifiable/ModifiableOntologyIndex.java
  26. +31 −25 .../src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/DelegatingIndexedObjectVisitor.java
  27. +36 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/IndexedAxiomFilter.java
  28. +1 −1 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/IndexedAxiomVisitor.java
  29. +30 −0 ...r/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/IndexedDefinitionAxiomVisitor.java
  30. +10 −4 ...easoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/NoOpIndexedAxiomVisitor.java
  31. +26 −20 ...asoner/src/main/java/org/semanticweb/elk/reasoner/indexing/visitors/NoOpIndexedObjectVisitor.java
  32. +9 −7 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/reduction/TransitiveReductionFactory.java
  33. +1 −1 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/reduction/TransitiveReductionState.java
  34. +54 −37 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/ContextImpl.java
  35. +6 −3 ...ticweb/elk/reasoner/saturation/conclusions/visitors/AbstractRuleApplicationConclusionVisitor.java
  36. +2 −2 .../java/org/semanticweb/elk/reasoner/saturation/conclusions/visitors/CountingConclusionVisitor.java
  37. +1 −1 ...manticweb/elk/reasoner/saturation/conclusions/visitors/LocalRuleApplicationConclusionVisitor.java
  38. +0 −1 ...eb/elk/reasoner/saturation/conclusions/visitors/NonRedundantRuleApplicationConclusionVisitor.java
  39. +12 −5 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/context/ContextPremises.java
  40. +8 −2 ...reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/context/HybridContextPremises.java
  41. +5 −4 ...rg/semanticweb/elk/reasoner/saturation/inferences/AbstractContradictionFromSubsumerInference.java
  42. +5 −4 ...easoner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ComposedDisjunction.java
  43. +1 −2 ...easoner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ComposedForwardLink.java
  44. +22 −0 ...r/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ComposedSubsumerInference.java
  45. +7 −5 ...r/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ContradictionFromNegation.java
  46. +1 −2 ...src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/ContradictionFromOwlNothing.java
  47. +1 −1 ...ner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/DecomposedFirstConjunct.java
  48. +1 −1 ...er/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/DecomposedSecondConjunct.java
  49. +22 −0 ...src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/DecomposedSubsumerInference.java
  50. +5 −4 ...rc/main/java/org/semanticweb/elk/reasoner/saturation/inferences/DisjointSubsumerFromSubsumer.java
  51. +7 −7 ...asoner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/GeneratedPropagation.java
  52. +1 −2 ...ner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/PropagatedContradiction.java
  53. +5 −4 ...reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/SubClassOfSubsumer.java
  54. +20 −0 ...soner/src/main/java/org/semanticweb/elk/reasoner/saturation/inferences/util/InferencePrinter.java
  55. +30 −12 ...va/org/semanticweb/elk/reasoner/saturation/inferences/visitors/AbstractClassInferenceVisitor.java
  56. +23 −2 ...ava/org/semanticweb/elk/reasoner/saturation/inferences/visitors/ClassInferencePremiseVisitor.java
  57. +16 −7 ...in/java/org/semanticweb/elk/reasoner/saturation/inferences/visitors/SubsumerInferenceVisitor.java
  58. +24 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/AbstractRuleVisitor.java
  59. +33 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/ConditionalRuleVisitor.java
  60. +24 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/DelegatingRuleVisitor.java
  61. +28 −1 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleApplicationTimer.java
  62. +51 −12 ...oner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleApplicationTimerVisitor.java
  63. +28 −1 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleCounter.java
  64. +34 −7 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleCounterVisitor.java
  65. +15 −0 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/saturation/rules/RuleStatistics.java
  66. +81 −0 ...a/org/semanticweb/elk/reasoner/saturation/rules/subsumers/ComposedFromDecomposedSubsumerRule.java
  67. +3 −2 ...n/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/ContradictionFromNegationRule.java
  68. +112 −0 .../main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/IndexedClassDecomposition.java
  69. +195 −0 .../java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/IndexedClassFromDefinitionRule.java
  70. +1 −1 ...g/semanticweb/elk/reasoner/saturation/rules/subsumers/IndexedObjectComplementOfDecomposition.java
  71. +4 −0 .../main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/LinkedSubsumerRuleVisitor.java
  72. +2 −1 ...a/org/semanticweb/elk/reasoner/saturation/rules/subsumers/ObjectIntersectionFromConjunctRule.java
  73. +13 −4 ...ava/org/semanticweb/elk/reasoner/saturation/rules/subsumers/SubsumerDecompositionRuleVisitor.java
  74. +3 −1 ...in/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/SubsumerDecompositionVisitor.java
  75. +39 −0 ...main/java/org/semanticweb/elk/reasoner/saturation/rules/subsumers/SuperClassFromSubClassRule.java
  76. +24 −0 ...rc/main/java/org/semanticweb/elk/reasoner/saturation/tracing/ModifiableClassInferenceSetImpl.java
  77. +2 −2 elk-reasoner/src/main/java/org/semanticweb/elk/reasoner/stages/AbstractReasonerState.java
  78. +10 −6 ...ner/src/main/java/org/semanticweb/elk/reasoner/stages/IncrementalAdditionInitializationStage.java
  79. +9 −6 ...ner/src/main/java/org/semanticweb/elk/reasoner/stages/IncrementalDeletionInitializationStage.java
  80. +6 −6 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/saturation/ConcurrentSaturatorTest.java
  81. +3 −4 ...reasoner/src/test/java/org/semanticweb/elk/reasoner/saturation/tracing/TracingSaturationTest.java
  82. +2 −0 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/saturation/tracing/TracingTest.java
  83. +2 −2 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/saturation/tracing/TracingTestUtils.java
  84. +3 −3 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/stages/CheckCleaningStage.java
  85. +1 −1 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/stages/CheckContextInvariants.java
  86. +1 −1 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/stages/EnumerateContextsStage.java
  87. +36 −2 elk-reasoner/src/test/java/org/semanticweb/elk/reasoner/stages/SaturationGraphValidationStage.java
  88. +8 −0 elk-reasoner/src/test/resources/classification_test_input/MultipleDefinitions
  89. +8 −0 elk-reasoner/src/test/resources/classification_test_input/MultipleDefinitions.expected
  90. +524 −0 ...arent/elk-util-collections/src/main/java/org/semanticweb/elk/util/collections/ArraySlicedSet.java
  91. +173 −0 ...t/elk-util-collections/src/test/java/org/semanticweb/elk/util/collections/ArraySlicedSetTest.java
@@ -76,7 +76,7 @@ public void execute(ReasonerStage stage) throws ElkException {
continue;
subsumerMap_.put(ice, new HashSet<IndexedClassExpression>(
context.getSubsumers()));
context.getComposedSubsumers()));
}
}
@@ -117,14 +117,14 @@ public void execute(ReasonerStage stage) throws ElkException {
private boolean sameSubsumers(Set<IndexedClassExpression> subsumers,
Context context) {
for (IndexedClassExpression ice : new LazyCollectionMinusSet<IndexedClassExpression>(
subsumers, context.getSubsumers())) {
subsumers, context.getComposedSubsumers())) {
if (ice instanceof IndexedClass) {
return false;
}
}
for (IndexedClassExpression ice : new LazyCollectionMinusSet<IndexedClassExpression>(
context.getSubsumers(), subsumers)) {
context.getComposedSubsumers(), subsumers)) {
if (ice instanceof IndexedClass) {
return false;
@@ -27,6 +27,7 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClass;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClassExpression;
import org.semanticweb.elk.reasoner.saturation.SaturationState;
import org.semanticweb.elk.reasoner.saturation.SaturationStateWriter;
@@ -35,7 +36,9 @@
import org.semanticweb.elk.reasoner.saturation.context.Context;
import org.semanticweb.elk.reasoner.saturation.rules.RuleVisitor;
import org.semanticweb.elk.reasoner.saturation.rules.contextinit.LinkedContextInitRule;
import org.semanticweb.elk.reasoner.saturation.rules.subsumers.IndexedClassDecomposition;
import org.semanticweb.elk.reasoner.saturation.rules.subsumers.LinkedSubsumerRule;
import org.semanticweb.elk.reasoner.saturation.rules.subsumers.SubsumerDecompositionRule;
import org.semanticweb.elk.util.concurrent.computation.BaseInputProcessor;
import org.semanticweb.elk.util.concurrent.computation.InputProcessor;
import org.semanticweb.elk.util.concurrent.computation.InputProcessorFactory;
@@ -58,25 +61,43 @@
.getLogger(ContextInitializationFactory.class);
private final SaturationState<?> saturationState_;
private final Map<? extends IndexedClassExpression, ? extends LinkedSubsumerRule> indexChanges_;
private final IndexedClassExpression[] indexChangesKeys_;
private final IndexedClassExpression[] changedComposedSubsumers_;
private final IndexedClass[] changedDecomposedSubsumers_;
private final LinkedContextInitRule changedGlobalRuleHead_;
private AtomicInteger ruleHits = new AtomicInteger(0);
private final Map<? extends IndexedClassExpression, ? extends LinkedSubsumerRule> changedCompositionRules_;
private AtomicInteger compositionRuleHits_ = new AtomicInteger(0);
private AtomicInteger decompositionRuleHits_ = new AtomicInteger(0);
private final SaturationStatistics stageStatistics_;
private final SubsumerDecompositionRule<IndexedClass> classDecomposition_;
public ContextInitializationFactory(
SaturationState<?> state,
Map<? extends IndexedClassExpression, ? extends LinkedSubsumerRule> indexChanges,
LinkedContextInitRule changedGlobalRuleHead,
Map<? extends IndexedClassExpression, ? extends LinkedSubsumerRule> changedCompositionRules,
final Map<? extends IndexedClass, ? extends IndexedClassExpression> changedDefinitions,
SaturationStatistics stageStats) {
saturationState_ = state;
indexChanges_ = indexChanges;
indexChangesKeys_ = new IndexedClassExpression[indexChanges.keySet()
.size()];
indexChanges.keySet().toArray(indexChangesKeys_);
changedCompositionRules_ = changedCompositionRules;
changedComposedSubsumers_ = new IndexedClassExpression[changedCompositionRules
.keySet().size()];
changedCompositionRules.keySet().toArray(changedComposedSubsumers_);
changedDecomposedSubsumers_ = new IndexedClass[changedDefinitions
.keySet().size()];
changedDefinitions.keySet().toArray(changedDecomposedSubsumers_);
changedGlobalRuleHead_ = changedGlobalRuleHead;
stageStatistics_ = stageStats;
classDecomposition_ = new IndexedClassDecomposition() {
private final Map<? extends IndexedClass, ? extends IndexedClassExpression> changedDefinitions_ = changedDefinitions;
@Override
protected IndexedClassExpression getDefinition(IndexedClass premise) {
// get the premise from the changed definitions
return changedDefinitions_.get(premise);
}
};
}
@Override
@@ -99,7 +120,8 @@ private ContextProcessor getBaseContextProcessor() {
return new ContextProcessor() {
int localRuleHits = 0;
private int localCompsitionRuleHits_ = 0;
private int localDecompositionRuleHits_ = 0;
@Override
public void process(Context context) {
@@ -115,46 +137,77 @@ public void process(Context context) {
saturationStateWriter);
nextGlobalRule = nextGlobalRule.next();
}
// apply all changed rules for indexed class expressions
Set<IndexedClassExpression> subsumers = context.getSubsumers();
if (subsumers.size() > indexChangesKeys_.length >> 2) {
// apply all changed composition rules for composed subsumers
Set<IndexedClassExpression> composedSubsumers = context
.getComposedSubsumers();
if (composedSubsumers.size() > changedComposedSubsumers_.length >> 2) {
// iterate over changes, check subsumers
for (int j = 0; j < indexChangesKeys_.length; j++) {
IndexedClassExpression changedICE = indexChangesKeys_[j];
if (subsumers.contains(changedICE)) {
applyLocalRules(context, changedICE);
for (int j = 0; j < changedComposedSubsumers_.length; j++) {
IndexedClassExpression changedICE = changedComposedSubsumers_[j];
if (composedSubsumers.contains(changedICE)) {
applyCompositionRules(context, changedICE);
}
}
} else {
// iterate over subsumers, check changes
for (IndexedClassExpression changedICE : subsumers) {
applyLocalRules(context, changedICE);
for (IndexedClassExpression changedICE : composedSubsumers) {
applyCompositionRules(context, changedICE);
}
}
// apply all definition expansion rules for decomposed subsumers
Set<IndexedClassExpression> decomposedSubsumers = context
.getDecomposedSubsumers();
if (decomposedSubsumers.size() > changedDecomposedSubsumers_.length >> 2) {
// iterate over changes, check subsumers
for (int j = 0; j < changedDecomposedSubsumers_.length; j++) {
IndexedClass changedIC = changedDecomposedSubsumers_[j];
if (decomposedSubsumers.contains(changedIC)) {
applyDecompositionRules(context, changedIC);
}
}
} else {
// iterate over subsumers, check changes
for (IndexedClassExpression changedICE : decomposedSubsumers) {
if (changedICE instanceof IndexedClass)
applyDecompositionRules(context,
(IndexedClass) changedICE);
}
}
}
@Override
public void finish() {
stageStatistics_.add(localStatistics);
ruleHits.addAndGet(localRuleHits);
compositionRuleHits_.addAndGet(localCompsitionRuleHits_);
decompositionRuleHits_.addAndGet(localDecompositionRuleHits_);
}
private void applyLocalRules(Context context,
private void applyCompositionRules(Context context,
IndexedClassExpression changedICE) {
LinkedSubsumerRule nextLocalRule = indexChanges_
LinkedSubsumerRule nextLocalRule = changedCompositionRules_
.get(changedICE);
if (nextLocalRule != null) {
localRuleHits++;
localCompsitionRuleHits_++;
LOGGER_.trace("{}: applying rules for {}", context,
changedICE);
LOGGER_.trace("{}: applying composition rules for {}",
context, changedICE);
}
while (nextLocalRule != null) {
nextLocalRule.accept(ruleAppVisitor, changedICE, context,
saturationStateWriter);
nextLocalRule = nextLocalRule.next();
}
}
private void applyDecompositionRules(Context context,
IndexedClass changedICE) {
localDecompositionRuleHits_++;
LOGGER_.trace("{}: applying decomposition rules for {}",
context, changedICE);
classDecomposition_.accept(ruleAppVisitor, changedICE, context,
saturationStateWriter);
}
};
}
@@ -171,8 +224,12 @@ private void applyLocalRules(Context context,
@Override
public void finish() {
if (LOGGER_.isDebugEnabled())
LOGGER_.debug("Rule hits: " + ruleHits.get());
if (LOGGER_.isDebugEnabled()) {
LOGGER_.debug("Composition rule hits: "
+ compositionRuleHits_.get());
LOGGER_.debug("Decomposition rule hits: "
+ decompositionRuleHits_.get());
}
}
/**
@@ -31,12 +31,13 @@
import org.semanticweb.elk.reasoner.ProgressMonitor;
import org.semanticweb.elk.reasoner.ReasonerComputationWithInputs;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClass;
import org.semanticweb.elk.reasoner.indexing.hierarchy.IndexedClassExpression;
import org.semanticweb.elk.reasoner.saturation.SaturationState;
import org.semanticweb.elk.reasoner.saturation.SaturationStatistics;
import org.semanticweb.elk.reasoner.saturation.context.Context;
import org.semanticweb.elk.reasoner.saturation.rules.contextinit.LinkedContextInitRule;
import org.semanticweb.elk.reasoner.saturation.rules.subsumers.ChainableSubsumerRule;
import org.semanticweb.elk.reasoner.saturation.rules.subsumers.LinkedSubsumerRule;
import org.semanticweb.elk.util.concurrent.computation.ComputationExecutor;
/**
@@ -56,12 +57,13 @@
public IncrementalChangesInitialization(
Collection<ArrayList<Context>> inputs,
LinkedContextInitRule changedInitRules,
Map<? extends IndexedClassExpression, ChainableSubsumerRule> changes,
Map<? extends IndexedClassExpression, ? extends LinkedSubsumerRule> changedCompositionRules,
Map<? extends IndexedClass, ? extends IndexedClassExpression> changedDefinitions,
SaturationState<?> state, ComputationExecutor executor,
SaturationStatistics stageStats, int maxWorkers,
ProgressMonitor progressMonitor) {
super(inputs, new ContextInitializationFactory(state, changes,
changedInitRules, stageStats), executor, maxWorkers,
progressMonitor);
super(inputs, new ContextInitializationFactory(state, changedInitRules,
changedCompositionRules, changedDefinitions, stageStats),
executor, maxWorkers, progressMonitor);
}
}
@@ -70,7 +70,7 @@ protected void process(ArrayList<Context> contexts) {
for (Context context : contexts) {
contextProcessor_.process(context);
contextCount++;
subsumerCount += context.getSubsumers().size();
subsumerCount += context.getComposedSubsumers().size();
}
localStats_.changeInitContextCollectionProcessingTime += (CachedTimeThread
@@ -100,4 +100,4 @@ protected boolean isInterrupted() {
}
}
}
@@ -26,8 +26,10 @@
import org.semanticweb.elk.reasoner.indexing.factories.ModifiableIndexedObjectFactory;
import org.semanticweb.elk.reasoner.indexing.implementation.ModifiableIndexedObjectFactoryImpl;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedAxiom;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedClass;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedClassExpression;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedDeclarationAxiom;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedDefinitionAxiom;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedEntity;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedObjectProperty;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedObjectPropertyRangeAxiom;
@@ -81,6 +83,14 @@ public final ModifiableIndexedSubClassOfAxiom getIndexedSubClassOfAxiom(
superClass, reason));
}
@Override
public ModifiableIndexedDefinitionAxiom getIndexedDefinitionAxiom(
ModifiableIndexedClass definedClass,
ModifiableIndexedClassExpression definition, ElkAxiom reason) {
return filter(baseFactory_.getIndexedDefinitionAxiom(definedClass,
definition, reason));
}
@Override
public final ModifiableIndexedSubObjectPropertyOfAxiom getIndexedSubObjectPropertyOfAxiom(
ModifiableIndexedPropertyChain subPropertyChain,
@@ -24,8 +24,10 @@
import org.semanticweb.elk.owl.interfaces.ElkAxiom;
import org.semanticweb.elk.reasoner.indexing.factories.ModifiableIndexedObjectFactory;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedClass;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedClassExpression;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedDeclarationAxiom;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedDefinitionAxiom;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedEntity;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedObject;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedObjectProperty;
@@ -75,6 +77,14 @@ public final ModifiableIndexedSubClassOfAxiom getIndexedSubClassOfAxiom(
superClass, reason), reason);
}
@Override
public ModifiableIndexedDefinitionAxiom getIndexedDefinitionAxiom(
ModifiableIndexedClass definedClass,
ModifiableIndexedClassExpression definition, ElkAxiom reason) {
return update(baseFactory_.getIndexedDefinitionAxiom(definedClass,
definition, reason), reason);
}
@Override
public final ModifiableIndexedSubObjectPropertyOfAxiom getIndexedSubObjectPropertyOfAxiom(
ModifiableIndexedPropertyChain subPropertyChain,
@@ -314,16 +314,27 @@ public Void visit(ElkTransitiveObjectPropertyAxiom axiom) {
@Override
public Void visit(ElkEquivalentClassesAxiom axiom) {
// reduces equivalence to sub-class axioms
// reduces equivalence to class definitions or sub-class axioms
ModifiableIndexedClassExpression first = null;
for (ElkClassExpression c : axiom.getClassExpressions()) {
if (first == null)
first = c.accept(dualConverter_);
else {
ModifiableIndexedClassExpression other = c
.accept(dualConverter_);
axiomFactory_.getIndexedSubClassOfAxiom(first, other, axiom);
axiomFactory_.getIndexedSubClassOfAxiom(other, first, axiom);
if (first instanceof ModifiableIndexedClass)
axiomFactory_.getIndexedDefinitionAxiom(
(ModifiableIndexedClass) first, other, axiom);
else if (other instanceof ModifiableIndexedClass)
axiomFactory_.getIndexedDefinitionAxiom(
(ModifiableIndexedClass) other, first, axiom);
else {
// index as two subsumptions
axiomFactory_
.getIndexedSubClassOfAxiom(first, other, axiom);
axiomFactory_
.getIndexedSubClassOfAxiom(other, first, axiom);
}
}
}
return null;
@@ -32,6 +32,7 @@
*/
public interface ModifiableIndexedAxiomFactory extends
ModifiableIndexedSubClassOfAxiomFactory,
ModifiableIndexedDefinitionAxiomFactory,
ModifiableIndexedSubObjectPropertyOfAxiomFactory,
ModifiableIndexedObjectPropertyRangeAxiomFactory,
ModifiableIndexedDisjointClassesAxiomFactory,
@@ -0,0 +1,42 @@
package org.semanticweb.elk.reasoner.indexing.factories;
/*
* #%L
* ELK Reasoner
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2011 - 2014 Department of Computer Science, University of Oxford
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.semanticweb.elk.owl.interfaces.ElkAxiom;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedClass;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedClassExpression;
import org.semanticweb.elk.reasoner.indexing.modifiable.ModifiableIndexedDefinitionAxiom;
/**
* A factory for creating instances of {@link ModifiableIndexedDefinitionAxiom}
*
* @author "Yevgeny Kazakov"
*
*/
public interface ModifiableIndexedDefinitionAxiomFactory {
public ModifiableIndexedDefinitionAxiom getIndexedDefinitionAxiom(
ModifiableIndexedClass definedClass,
ModifiableIndexedClassExpression definition, ElkAxiom reason);
}
Oops, something went wrong.

0 comments on commit b330594

Please sign in to comment.