org.semanticweb.elk.reasoner.saturation.context
Interface Context

All Known Implementing Classes:
ContextImpl

public interface Context

An object representing an elementary unit of computation for saturation of an IndexedClassExpression, stored as a root of the Context. This interface specifies method that can be used to access the result of the computation in addition to the methods used by a RuleApplicationFactory to perform the computation concurrently.

Author:
"Yevgeny Kazakov"
See Also:
RuleApplicationFactory

Method Summary
 boolean addBackwardLink(BackwardLink link)
          Adds the given BackwardLink to this Context.
 boolean addDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
          Adds one instance of IndexedDisjointnessAxiom to this Context.
 boolean addSubsumer(IndexedClassExpression expression)
          Adds the given IndexedClassExpression to the subsumers of the root IndexedClassExpression of this Context.
 boolean addToDo(Conclusion conclusion)
          Adds the given Conclusion to be processed within this Context.
 boolean containsBackwardLink(BackwardLink link)
           
 boolean containsDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
           
 boolean containsSubsumer(IndexedClassExpression expression)
          Tests whether the given IndexedClassExpression is a subsumer of the root IndexedClassExpression of this Context.
 Chain<ModifiableLinkRule<BackwardLink>> getBackwardLinkRuleChain()
           
 LinkRule<BackwardLink> getBackwardLinkRuleHead()
           
 Multimap<IndexedPropertyChain,Context> getBackwardLinksByObjectProperty()
           
 IndexedClassExpression getRoot()
           
 Set<IndexedClassExpression> getSubsumers()
           
 boolean inconsistencyDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
           
 boolean isEmpty()
           
 boolean isInconsistent()
           
 boolean isSaturated()
           
 boolean removeBackwardLink(BackwardLink link)
           
 boolean removeDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
          Removes one instance of the given IndexedDisjointnessAxiom from this Context.
 void removeLinks()
          removes links to the next and previous contexts, effectively removing this Context from the chain of contexts
 boolean removeSubsumer(IndexedClassExpression expression)
          Removes the given IndexedClassExpression from the subsumers of the root IndexedClassExpression of this Context.
 boolean setInconsistent(boolean consistent)
          Sets the inconsistency of this Context to the given value.
 boolean setSaturated(boolean saturated)
          Marks this Context as saturated.
 Conclusion takeToDo()
          Removes and returns one of the unprocessed Conclusions of this context.
 

Method Detail

getRoot

IndexedClassExpression getRoot()
Returns:
the IndexedClassExpression for which this Context is assigned. This may never been null.

getSubsumers

Set<IndexedClassExpression> getSubsumers()
Returns:
the object representing all derived (implied) IndexedClassExpressions that subsume the root IndexedClassExpression

getBackwardLinksByObjectProperty

Multimap<IndexedPropertyChain,Context> getBackwardLinksByObjectProperty()
Returns:
the Contexts from which there exists an (implied) "existential relation" with this Context indexed by the IndexedPropertyChain of this relation. For example, if the input ontology contains an axiom SubClassOf(:A ObjectSomeValuesFrom(:r :B) then an existential link between the context with root :A and the context with root :B with property :r will be created. For technical reasons, this link is stored in the context for :B, as a "backward link" <:r, :A> indexed by :r in the Multimap returned by this method. The returned Multimap is not thread safe and should be accessed from at most one thread at a time. This is never null.

getBackwardLinkRuleHead

LinkRule<BackwardLink> getBackwardLinkRuleHead()
Returns:
the first backward link rule assigned to this Context, or null if there no such rules; all other rules can be obtained by traversing over Link.next(); this method should be used to access the rules without modifying them.

getBackwardLinkRuleChain

Chain<ModifiableLinkRule<BackwardLink>> getBackwardLinkRuleChain()
Returns:
the Chain view of all backward link rules assigned to this Context; this is always not null. This method can be used for convenient search and modification (addition and deletion) of the rules using the methods of the Chain interface without without worrying about null values.

addBackwardLink

boolean addBackwardLink(BackwardLink link)
Adds the given BackwardLink to this Context.

Parameters:
link - the BackwardLink being added to this Context
Returns:
true if this Context has changed as the result this method, i.e., the given BackwardLink has not been added before to this Context. This method is not thread safe.

removeBackwardLink

boolean removeBackwardLink(BackwardLink link)

containsBackwardLink

boolean containsBackwardLink(BackwardLink link)

addSubsumer

boolean addSubsumer(IndexedClassExpression expression)
Adds the given IndexedClassExpression to the subsumers of the root IndexedClassExpression of this Context.

Parameters:
expression - the IndexedClassExpression to be added as a susbumer of the root IndexedClassExpression of this Context.
Returns:
true if the set of subsumers of this Context has changed as the result of calling this method, i.e., the input IndexedClassExpression was not a subsumer before. This method is not thread safe.

removeSubsumer

boolean removeSubsumer(IndexedClassExpression expression)
Removes the given IndexedClassExpression from the subsumers of the root IndexedClassExpression of this Context.

Parameters:
expression - the IndexedClassExpression to be removed from the subsumers of the root in this Context
Returns:
true if the set of subsumers of this Context has changed as the result of calling this method, i.e., the input IndexedClassExpression was a subsumer before. This method is not thread safe.

containsSubsumer

boolean containsSubsumer(IndexedClassExpression expression)
Tests whether the given IndexedClassExpression is a subsumer of the root IndexedClassExpression of this Context.

Parameters:
expression - the IndexedClassExpression to be tested for this Context
Returns:
true if the given IndexedClassExpression is a subsumer of the root in this Context. This method is not thread safe.

addDisjointnessAxiom

boolean addDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
Adds one instance of IndexedDisjointnessAxiom to this Context.

Parameters:
axiom - the IndexedDisjointnessAxiom to be added to this Context
Returns:
true if adding the axiom changes the state of this Context, i.e., some rules need to be applied

removeDisjointnessAxiom

boolean removeDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
Removes one instance of the given IndexedDisjointnessAxiom from this Context.

Parameters:
axiom - the IndexedDisjointnessAxiom to be removed from this Context
Returns:
true if the state of this Context has changed as the result of calling this method, i.e., the context has contained this IndexedDisjointnessAxiom

containsDisjointnessAxiom

boolean containsDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
Parameters:
axiom - the IndexedDisjointnessAxiom to be checked for occurrences in this Context
Returns:
true if the given IndexedDisjointnessAxiom occurs in this Context

inconsistencyDisjointnessAxiom

boolean inconsistencyDisjointnessAxiom(IndexedDisjointnessAxiom axiom)
Parameters:
axiom - the IndexedDisjointnessAxiom to be checked for causing inconsistency in this Context
Returns:
true if the given IndexedDisjointnessAxiom causes inconsistency of this Context

addToDo

boolean addToDo(Conclusion conclusion)
Adds the given Conclusion to be processed within this Context. The method returns true when this is the first unprocessed conclusion added to the context after it is being created or cleared (that is, takeToDo() has returned null). If several threads call this method at the same time for the same Context then at most one of these method returns true, unless takeToDo() is called as well.

Parameters:
conclusion - the Conclusion added to be processed within this Context
Returns:
true when the added conclusion is the first unprocessed conclusion for this context
See Also:
takeToDo()

takeToDo

Conclusion takeToDo()
Removes and returns one of the unprocessed Conclusions of this context. This method is thread safe and can be used concurrently with the method addToDo(Conclusion).

Returns:
some unprocessed Conclusion of this context, if there is one, or null if there is no such Conclusion
See Also:
addToDo(Conclusion)

isInconsistent

boolean isInconsistent()
Returns:
true if a contradiction has not been derived for the root IndexedClassExpression

isSaturated

boolean isSaturated()
Returns:
true if all Conclusions for this Context, as determined by the function Conclusion.getSourceContext(Context), are already computed.

setInconsistent

boolean setInconsistent(boolean consistent)
Sets the inconsistency of this Context to the given value.

Returns:
the previous inconsistency value

setSaturated

boolean setSaturated(boolean saturated)
Marks this Context as saturated. This means that all all Conclusions for this Context are already computed.

Returns:
the previous value of the saturation state for this Context

isEmpty

boolean isEmpty()
Returns:
true if the context is empty

removeLinks

void removeLinks()
removes links to the next and previous contexts, effectively removing this Context from the chain of contexts



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