org.semanticweb.elk.reasoner.indexing.hierarchy
Class DifferentialIndex

java.lang.Object
  extended by org.semanticweb.elk.reasoner.indexing.hierarchy.DirectIndex
      extended by org.semanticweb.elk.reasoner.indexing.hierarchy.DifferentialIndex
All Implemented Interfaces:
ModifiableOntologyIndex, OntologyIndex

public class DifferentialIndex
extends DirectIndex

An object representing incremental changes in the index. The changes are stored in two maps: additions and deletions. The map for additions assigns to every IndexedClassExpression new rules to be added to the index; likewise, the map of deletions assigns to every IndexedClassExpression a new rules to be removed from the index.

Author:
"Yevgeny Kazakov", Pavel Klinov

Nested Class Summary
 
Nested classes/interfaces inherited from class org.semanticweb.elk.reasoner.indexing.hierarchy.DirectIndex
DirectIndex.ContextRootInitializationRule
 
Constructor Summary
DifferentialIndex(IndexedObjectCache objectCache)
           
 
Method Summary
 void add(IndexedClassExpression target, ChainableRule<Context> newRule)
          Adds a new context rule for the given IndexedClassExpression
 void add(IndexedObject newObject)
          Adds the given IndexedObject to this OntologyIndex
 void addClass(ElkClass newClass)
          Add the given ElkClass to the signature of this OntologyIndex
 void addContextInitRule(ChainableRule<Context> newRule)
          Adds a new context initialization for this OntologyIndex.
 void addNamedIndividual(ElkNamedIndividual newIndividual)
          Add the given ElkNamedIndividual to the signature of this OntologyIndex
 void clearDeletedRules()
          Removes the deleted rules from this DifferentialIndex; these rules should be already applied in the main index during their registration
 void commitAddedRules()
          Commits the added rules to the main index and removes them from this DifferentialIndex.
 Collection<ElkClass> getAddedClasses()
           
 ChainableRule<Context> getAddedContextInitRules()
           
 Map<IndexedClassExpression,ChainableRule<Context>> getAddedContextRulesByClassExpressions()
           
 Collection<ElkNamedIndividual> getAddedIndividuals()
           
 Collection<IndexedClassExpression> getRemovedClassExpressions()
           
 ChainableRule<Context> getRemovedContextInitRules()
           
 Map<IndexedClassExpression,ChainableRule<Context>> getRemovedContextRulesByClassExpressions()
           
 void initAdditions()
           
 void initClassSignatureChanges()
           
 void initDeletions()
           
 void initIndividualSignatureChanges()
           
 boolean isEmpty()
           
 boolean isIncrementalMode()
           
 void remove(IndexedClassExpression target, ChainableRule<Context> oldRule)
          Removes an existing context rule for the given IndexedClassExpression
 void remove(IndexedObject oldObject)
          Removes the given IndexedObject from this OntologyIndex
 void removeClass(ElkClass oldClass)
          Removes the given ElkClass from the signature of this OntologyIndex
 void removeContextInitRule(ChainableRule<Context> oldRule)
          Removes an existing context initialization for this OntologyIndex
 void removeNamedIndividual(ElkNamedIndividual oldIndividual)
          Removes the given ElkNamedIndividual from the signature of this OntologyIndex
 void setIncrementalMode(boolean mode)
          Sets the incremental mode for this DifferentialIndex.
 
Methods inherited from class org.semanticweb.elk.reasoner.indexing.hierarchy.DirectIndex
addReflexiveProperty, getContextInitRuleChain, getContextInitRuleHead, getIndexedClasses, getIndexedClassExpressions, getIndexedIndividuals, getIndexedObjectCache, getIndexedObjectProperties, getIndexedOwlNothing, getIndexedOwlThing, getIndexedPropertyChains, getReflexiveObjectProperties, removeReflexiveProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DifferentialIndex

public DifferentialIndex(IndexedObjectCache objectCache)
Method Detail

initClassSignatureChanges

public void initClassSignatureChanges()

initIndividualSignatureChanges

public void initIndividualSignatureChanges()

initAdditions

public void initAdditions()

initDeletions

public void initDeletions()

addClass

public void addClass(ElkClass newClass)
Description copied from interface: ModifiableOntologyIndex
Add the given ElkClass to the signature of this OntologyIndex

Specified by:
addClass in interface ModifiableOntologyIndex
Overrides:
addClass in class DirectIndex
Parameters:
newClass - the ElkClass to be added

removeClass

public void removeClass(ElkClass oldClass)
Description copied from interface: ModifiableOntologyIndex
Removes the given ElkClass from the signature of this OntologyIndex

Specified by:
removeClass in interface ModifiableOntologyIndex
Overrides:
removeClass in class DirectIndex
Parameters:
oldClass - the ElkClass to be removed

addNamedIndividual

public void addNamedIndividual(ElkNamedIndividual newIndividual)
Description copied from interface: ModifiableOntologyIndex
Add the given ElkNamedIndividual to the signature of this OntologyIndex

Specified by:
addNamedIndividual in interface ModifiableOntologyIndex
Overrides:
addNamedIndividual in class DirectIndex
Parameters:
newIndividual - the ElkNamedIndividual to be added

removeNamedIndividual

public void removeNamedIndividual(ElkNamedIndividual oldIndividual)
Description copied from interface: ModifiableOntologyIndex
Removes the given ElkNamedIndividual from the signature of this OntologyIndex

Specified by:
removeNamedIndividual in interface ModifiableOntologyIndex
Overrides:
removeNamedIndividual in class DirectIndex
Parameters:
oldIndividual - the ElkNamedIndividual to be removed

add

public void add(IndexedClassExpression target,
                ChainableRule<Context> newRule)
Description copied from interface: ModifiableOntologyIndex
Adds a new context rule for the given IndexedClassExpression

Specified by:
add in interface ModifiableOntologyIndex
Overrides:
add in class DirectIndex
Parameters:
target - the IndexedClassExpression for which to add the rule
newRule - the context rule to be added

remove

public void remove(IndexedClassExpression target,
                   ChainableRule<Context> oldRule)
Description copied from interface: ModifiableOntologyIndex
Removes an existing context rule for the given IndexedClassExpression

Specified by:
remove in interface ModifiableOntologyIndex
Overrides:
remove in class DirectIndex
Parameters:
target - the IndexedClassExpression for which to remove the rule
oldRule - the context rule to be removed

addContextInitRule

public void addContextInitRule(ChainableRule<Context> newRule)
Description copied from interface: ModifiableOntologyIndex
Adds a new context initialization for this OntologyIndex.

Specified by:
addContextInitRule in interface ModifiableOntologyIndex
Overrides:
addContextInitRule in class DirectIndex
Parameters:
newRule - the context initialization rule to be added
See Also:
OntologyIndex.getContextInitRuleHead()

removeContextInitRule

public void removeContextInitRule(ChainableRule<Context> oldRule)
Description copied from interface: ModifiableOntologyIndex
Removes an existing context initialization for this OntologyIndex

Specified by:
removeContextInitRule in interface ModifiableOntologyIndex
Overrides:
removeContextInitRule in class DirectIndex
Parameters:
oldRule - the context initialization rule to be removed
See Also:
OntologyIndex.getContextInitRuleHead()

add

public void add(IndexedObject newObject)
Description copied from interface: ModifiableOntologyIndex
Adds the given IndexedObject to this OntologyIndex

Specified by:
add in interface ModifiableOntologyIndex
Overrides:
add in class DirectIndex
Parameters:
newObject - the object to be added

remove

public void remove(IndexedObject oldObject)
Description copied from interface: ModifiableOntologyIndex
Removes the given IndexedObject from this OntologyIndex

Specified by:
remove in interface ModifiableOntologyIndex
Overrides:
remove in class DirectIndex
Parameters:
oldObject - the object to be removed

getAddedContextInitRules

public ChainableRule<Context> getAddedContextInitRules()
Returns:
the context initialization rules added during the last incremental session

getRemovedContextInitRules

public ChainableRule<Context> getRemovedContextInitRules()
Returns:
the context initialization rules removed during the last incremental session

getAddedContextRulesByClassExpressions

public Map<IndexedClassExpression,ChainableRule<Context>> getAddedContextRulesByClassExpressions()
Returns:
the map from indexed class expressions to the corresponding objects containing index additions for these class expressions

getRemovedContextRulesByClassExpressions

public Map<IndexedClassExpression,ChainableRule<Context>> getRemovedContextRulesByClassExpressions()
Returns:
the map from indexed class expressions to the corresponding objects containing index deletions for these class expressions

getAddedClasses

public Collection<ElkClass> getAddedClasses()
Returns:
the ElkClass added during the last incremental session

getAddedIndividuals

public Collection<ElkNamedIndividual> getAddedIndividuals()
Returns:
the collection of named individuals added to the signature

getRemovedClassExpressions

public Collection<IndexedClassExpression> getRemovedClassExpressions()
Returns:
the IndexedClassExpressions removed during the last incremental session

clearDeletedRules

public void clearDeletedRules()
Removes the deleted rules from this DifferentialIndex; these rules should be already applied in the main index during their registration


commitAddedRules

public void commitAddedRules()
Commits the added rules to the main index and removes them from this DifferentialIndex.


isEmpty

public boolean isEmpty()
Returns:
true if there are no uncommitted changes in this DifferentialIndex

setIncrementalMode

public void setIncrementalMode(boolean mode)
Sets the incremental mode for this DifferentialIndex.

Parameters:
mode - if true, deletions and additions to this indexed are stored separately; if false all changes are immediately applied to the index.

isIncrementalMode

public boolean isIncrementalMode()
Returns:
the current value of the incremental mode for this DifferentialIndex
See Also:
setIncrementalMode(boolean)


Copyright © 2011-2013 Department of Computer Science, University of Oxford. All Rights Reserved.