org.mindswap.pellet
Class ABox

java.lang.Object
  extended by org.mindswap.pellet.ABox

public class ABox
extends java.lang.Object

Title:

Description:

Copyright: Copyright (c) 2008

Company: Clark & Parsia, LLC.

Author:
Evren Sirin

Field Summary
static java.util.logging.Logger log
           
 boolean ranRete
           
 boolean rulesNotApplied
           
 ABoxStats stats
           
 boolean useRete
           
 
Constructor Summary
ABox(KnowledgeBase kb)
           
ABox(KnowledgeBase kb, ABox abox, aterm.ATermAppl extraIndividual, boolean copyIndividuals)
           
 
Method Summary
 void addAllDifferent(aterm.ATermList list)
           
 void addDifferent(aterm.ATermAppl x, aterm.ATermAppl y)
           
 Edge addEdge(aterm.ATermAppl p, aterm.ATermAppl s, aterm.ATermAppl o, DependencySet ds)
           
 Individual addFreshIndividual(Individual parent, DependencySet ds)
           
 Individual addIndividual(aterm.ATermAppl x, DependencySet ds)
           
 Literal addLiteral(aterm.ATermAppl dataValue)
          Add a new literal to the ABox.
 Literal addLiteral(aterm.ATermAppl dataValue, DependencySet ds)
           
 Literal addLiteral(DependencySet ds)
          Add a new literal to the ABox.
 void addSame(aterm.ATermAppl x, aterm.ATermAppl y)
           
 void addType(aterm.ATermAppl x, aterm.ATermAppl c)
           
 void addType(aterm.ATermAppl x, aterm.ATermAppl c, DependencySet ds)
           
 void clearCaches(boolean clearSatCache)
          Clear the pseudo model created for the ABox and concept satisfiability.
 ABox copy()
          Create a copy of this ABox with all the nodes and edges.
 ABox copy(aterm.ATermAppl extraIndividual, boolean copyIndividuals)
          Create a copy of this ABox with one more additional individual.
 ABox copy(KnowledgeBase kb)
          Create a copy of this ABox with all the nodes and edges and the given KB.
 void copyOnWrite()
           
 aterm.ATermAppl createUniqueName(boolean isNominal)
           
 boolean doExplanation()
          Checks if the explanation is turned on.
 int getAnonCount()
           
 int getBranch()
          Return the current branch number.
 BranchEffectTracker getBranchEffectTracker()
           
 java.util.List<Branch> getBranches()
          Returns the branches.
 ConceptCache getCache()
           
 CachedNode getCached(aterm.ATermAppl c)
           
 Bool getCachedSat(aterm.ATermAppl c)
           
 Clash getClash()
           
 CompletionQueue getCompletionQueue()
           
 java.util.List<aterm.ATermAppl> getDataPropertyValues(aterm.ATermAppl s, Role role, aterm.ATermAppl datatype)
           
 java.util.List<aterm.ATermAppl> getDataPropertyValues(aterm.ATermAppl s, Role role, aterm.ATermAppl datatype, boolean onlyObvious)
           
 DatatypeReasoner getDatatypeReasoner()
           
 java.util.Map<aterm.ATermAppl,int[]> getDisjBranchStats()
           
 java.lang.String getExplanation()
           
 java.util.Set<aterm.ATermAppl> getExplanationSet()
           
 IncrementalChangeTracker getIncrementalChangeTracker()
           
 IndividualIterator getIndIterator()
          Return individuals to which we need to apply the tableau rules
 Individual getIndividual(aterm.ATerm x)
           
 EdgeList getInEdges(aterm.ATerm x)
           
 KnowledgeBase getKB()
           
 Clash getLastClash()
           
 ABox getLastCompletion()
           
 Literal getLiteral(aterm.ATerm x)
           
 Node getNode(aterm.ATerm x)
           
 java.util.List<aterm.ATermAppl> getNodeNames()
           
 java.util.Collection<Node> getNodes()
           
 void getObjectPropertyValues(aterm.ATermAppl s, Role role, java.util.Set<aterm.ATermAppl> knowns, java.util.Set<aterm.ATermAppl> unknowns, boolean getSames)
           
 java.util.List<aterm.ATermAppl> getObviousDataPropertyValues(aterm.ATermAppl s, Role prop, aterm.ATermAppl datatype)
           
 CandidateSet<aterm.ATermAppl> getObviousInstances(aterm.ATermAppl c)
           
 CandidateSet<aterm.ATermAppl> getObviousInstances(aterm.ATermAppl c, java.util.Collection<aterm.ATermAppl> individuals)
           
 void getObviousObjects(aterm.ATermAppl p, CandidateSet<aterm.ATermAppl> candidates)
           
 CandidateSet<aterm.ATermAppl> getObviousSubjects(aterm.ATermAppl p, aterm.ATermAppl o)
           
 void getObviousSubjects(aterm.ATermAppl p, aterm.ATermAppl o, CandidateSet<aterm.ATermAppl> candidates)
           
 void getObviousTypes(aterm.ATermAppl x, java.util.List<aterm.ATermAppl> types, java.util.List<aterm.ATermAppl> nonTypes)
           
 EdgeList getOutEdges(aterm.ATerm x)
           
 RBox getRBox()
          Return the RBox
 Role getRole(aterm.ATerm r)
          Convenience function to get the named role.
 void getSames(Individual ind, java.util.Set<aterm.ATermAppl> knowns, java.util.Set<aterm.ATermAppl> unknowns)
           
 void getSubjects(aterm.ATermAppl p, aterm.ATermAppl o, CandidateSet<aterm.ATermAppl> candidates)
           
 TBox getTBox()
          Return the TBox
 java.util.List<NodeMerge> getToBeMerged()
           
 Bool hasObviousDataPropertyValue(aterm.ATermAppl s, aterm.ATermAppl p, java.lang.Object value)
           
 Bool hasObviousObjectPropertyValue(aterm.ATermAppl s, aterm.ATermAppl p, aterm.ATermAppl o)
           
 Bool hasObviousPropertyValue(aterm.ATermAppl s, aterm.ATermAppl p, aterm.ATermAppl o)
           
 boolean hasPropertyValue(aterm.ATermAppl s, aterm.ATermAppl p, aterm.ATermAppl o)
           
 void incrementBranch()
          Increment the branch number (should only be called when a non-deterministic rule, e.g.
 boolean isChanged()
           
 boolean isClosed()
          Returns true if Abox has a clash.
 boolean isComplete()
           
 boolean isConsistent()
          Return true if this ABox is consistent.
 boolean isEmpty()
          Returns true if there are no individuals in the ABox.
 boolean isInitialized()
          Check if the ABox is ready to be completed.
 boolean isKeepLastCompletion()
           
 Bool isKnownSubClassOf(aterm.ATermAppl c1, aterm.ATermAppl c2)
           
 Bool isKnownType(aterm.ATermAppl x, aterm.ATermAppl c)
           
 Bool isKnownType(aterm.ATermAppl x, aterm.ATermAppl c, java.util.Collection<aterm.ATermAppl> subs)
           
 Bool isKnownType(Individual pNode, aterm.ATermAppl concept, java.util.Collection<aterm.ATermAppl> subs)
           
 boolean isNode(aterm.ATerm x)
           
 boolean isSameAs(aterm.ATermAppl ind1, aterm.ATermAppl ind2)
           
 boolean isSatisfiable(aterm.ATermAppl c)
           
 boolean isSatisfiable(aterm.ATermAppl c, boolean cacheModel)
           
 boolean isSubClassOf(aterm.ATermAppl c1, aterm.ATermAppl c2)
           
 boolean isType(aterm.ATermAppl x, aterm.ATermAppl c)
          Returns true if individual x belongs to type c.
 boolean isType(java.util.List<aterm.ATermAppl> inds, aterm.ATermAppl c)
          Returns true if any of the individuals in the given list belongs to type c.
 void printTree()
          Print the ABox as a completion tree (child nodes are indented).
 boolean removeNode(aterm.ATermAppl x)
          Remove the given node from the node map which maps names to nodes.
 void removeType(aterm.ATermAppl x, aterm.ATermAppl c)
           
 void reset()
          Reset the ABox to contain only asserted information.
 void resetQueue()
           
 int setAnonCount(int anonCount)
           
 void setBranch(int branch)
          Set the branch number (should only be called when backjumping is in progress)
 void setChanged(boolean changed)
           
 void setClash(Clash clash)
           
 void setComplete(boolean isComplete)
           
 void setDisjBranchStats(java.util.Map<aterm.ATermAppl,int[]> disjBranchStats)
           
 void setDoExplanation(boolean doExplanation)
          Enable/disable explanation generation
 void setExplanation(DependencySet ds)
           
 void setInitialized(boolean initialized)
           
 void setKeepLastCompletion(boolean keepLastCompletion)
           
 void setLastCompletion(ABox comp)
           
 int size()
          Return the number of nodes in the ABox.
 java.lang.String toString()
           
 void validate()
          Validate all the edges in the ABox nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

public static final java.util.logging.Logger log

stats

public ABoxStats stats

rulesNotApplied

public boolean rulesNotApplied

ranRete

public boolean ranRete

useRete

public boolean useRete
Constructor Detail

ABox

public ABox(KnowledgeBase kb)

ABox

public ABox(KnowledgeBase kb,
            ABox abox,
            aterm.ATermAppl extraIndividual,
            boolean copyIndividuals)
Method Detail

copy

public ABox copy()
Create a copy of this ABox with all the nodes and edges.

Returns:

copy

public ABox copy(KnowledgeBase kb)
Create a copy of this ABox with all the nodes and edges and the given KB.


copy

public ABox copy(aterm.ATermAppl extraIndividual,
                 boolean copyIndividuals)
Create a copy of this ABox with one more additional individual. This is NOT equivalent to create a copy and then add the individual. The order of individuals in the ABox is important to figure out which individuals exist in the original ontology and which ones are created by the tableau algorithm. This function creates a new ABox such that the individual is supposed to exist in the original ontology. This is very important when satisfiability of a concept starts with a pesudo model rather than the initial ABox.

Parameters:
extraIndividual - Extra individual to be added to the copy ABox
Returns:

copyOnWrite

public void copyOnWrite()

clearCaches

public void clearCaches(boolean clearSatCache)
Clear the pseudo model created for the ABox and concept satisfiability.

Parameters:
clearSatCache - If true clear concept satisfiability cache, if false only clear pseudo model.

getCachedSat

public Bool getCachedSat(aterm.ATermAppl c)

getCache

public ConceptCache getCache()

getCached

public CachedNode getCached(aterm.ATermAppl c)

isKnownSubClassOf

public Bool isKnownSubClassOf(aterm.ATermAppl c1,
                              aterm.ATermAppl c2)

isSubClassOf

public boolean isSubClassOf(aterm.ATermAppl c1,
                            aterm.ATermAppl c2)

isSatisfiable

public boolean isSatisfiable(aterm.ATermAppl c)

isSatisfiable

public boolean isSatisfiable(aterm.ATermAppl c,
                             boolean cacheModel)

getObviousInstances

public CandidateSet<aterm.ATermAppl> getObviousInstances(aterm.ATermAppl c)

getObviousInstances

public CandidateSet<aterm.ATermAppl> getObviousInstances(aterm.ATermAppl c,
                                                         java.util.Collection<aterm.ATermAppl> individuals)

getObviousTypes

public void getObviousTypes(aterm.ATermAppl x,
                            java.util.List<aterm.ATermAppl> types,
                            java.util.List<aterm.ATermAppl> nonTypes)

getObviousSubjects

public CandidateSet<aterm.ATermAppl> getObviousSubjects(aterm.ATermAppl p,
                                                        aterm.ATermAppl o)

getSubjects

public void getSubjects(aterm.ATermAppl p,
                        aterm.ATermAppl o,
                        CandidateSet<aterm.ATermAppl> candidates)

getObviousSubjects

public void getObviousSubjects(aterm.ATermAppl p,
                               aterm.ATermAppl o,
                               CandidateSet<aterm.ATermAppl> candidates)

getObviousObjects

public void getObviousObjects(aterm.ATermAppl p,
                              CandidateSet<aterm.ATermAppl> candidates)

isKnownType

public Bool isKnownType(aterm.ATermAppl x,
                        aterm.ATermAppl c)

isKnownType

public Bool isKnownType(aterm.ATermAppl x,
                        aterm.ATermAppl c,
                        java.util.Collection<aterm.ATermAppl> subs)

isKnownType

public Bool isKnownType(Individual pNode,
                        aterm.ATermAppl concept,
                        java.util.Collection<aterm.ATermAppl> subs)

isSameAs

public boolean isSameAs(aterm.ATermAppl ind1,
                        aterm.ATermAppl ind2)

isType

public boolean isType(aterm.ATermAppl x,
                      aterm.ATermAppl c)
Returns true if individual x belongs to type c. This is a logical consequence of the KB if in all possible models x belongs to C. This is checked by trying to construct a model where x belongs to not(c).

Parameters:
x -
c -
Returns:

isType

public boolean isType(java.util.List<aterm.ATermAppl> inds,
                      aterm.ATermAppl c)
Returns true if any of the individuals in the given list belongs to type c.

Parameters:
c -
inds -
Returns:

hasObviousPropertyValue

public Bool hasObviousPropertyValue(aterm.ATermAppl s,
                                    aterm.ATermAppl p,
                                    aterm.ATermAppl o)

hasObviousDataPropertyValue

public Bool hasObviousDataPropertyValue(aterm.ATermAppl s,
                                        aterm.ATermAppl p,
                                        java.lang.Object value)

hasObviousObjectPropertyValue

public Bool hasObviousObjectPropertyValue(aterm.ATermAppl s,
                                          aterm.ATermAppl p,
                                          aterm.ATermAppl o)

hasPropertyValue

public boolean hasPropertyValue(aterm.ATermAppl s,
                                aterm.ATermAppl p,
                                aterm.ATermAppl o)

getDataPropertyValues

public java.util.List<aterm.ATermAppl> getDataPropertyValues(aterm.ATermAppl s,
                                                             Role role,
                                                             aterm.ATermAppl datatype)

getDataPropertyValues

public java.util.List<aterm.ATermAppl> getDataPropertyValues(aterm.ATermAppl s,
                                                             Role role,
                                                             aterm.ATermAppl datatype,
                                                             boolean onlyObvious)

getObviousDataPropertyValues

public java.util.List<aterm.ATermAppl> getObviousDataPropertyValues(aterm.ATermAppl s,
                                                                    Role prop,
                                                                    aterm.ATermAppl datatype)

getObjectPropertyValues

public void getObjectPropertyValues(aterm.ATermAppl s,
                                    Role role,
                                    java.util.Set<aterm.ATermAppl> knowns,
                                    java.util.Set<aterm.ATermAppl> unknowns,
                                    boolean getSames)

getSames

public void getSames(Individual ind,
                     java.util.Set<aterm.ATermAppl> knowns,
                     java.util.Set<aterm.ATermAppl> unknowns)

isConsistent

public boolean isConsistent()
Return true if this ABox is consistent. Consistent ABox means after applying all the tableau completion rules at least one branch with no clashes was found

Returns:

getInEdges

public EdgeList getInEdges(aterm.ATerm x)

getOutEdges

public EdgeList getOutEdges(aterm.ATerm x)

getIndividual

public Individual getIndividual(aterm.ATerm x)

getLiteral

public Literal getLiteral(aterm.ATerm x)

getNode

public Node getNode(aterm.ATerm x)

addType

public void addType(aterm.ATermAppl x,
                    aterm.ATermAppl c)

addType

public void addType(aterm.ATermAppl x,
                    aterm.ATermAppl c,
                    DependencySet ds)

addEdge

public Edge addEdge(aterm.ATermAppl p,
                    aterm.ATermAppl s,
                    aterm.ATermAppl o,
                    DependencySet ds)

removeNode

public boolean removeNode(aterm.ATermAppl x)
Remove the given node from the node map which maps names to nodes. Does not remove the node from the node list or other nodes' edge lists.

Parameters:
x -
Returns:

removeType

public void removeType(aterm.ATermAppl x,
                       aterm.ATermAppl c)

addLiteral

public Literal addLiteral(DependencySet ds)
Add a new literal to the ABox. This function is used only when the literal value does not have a known value, e.g. applyMinRule would create such a literal.

Returns:

addLiteral

public Literal addLiteral(aterm.ATermAppl dataValue)
Add a new literal to the ABox. Literal will be assigned a fresh unique name.

Parameters:
dataValue - A literal ATerm which should be constructed with one of ATermUtils.makeXXXLiteral functions
Returns:
Literal object that has been created

addLiteral

public Literal addLiteral(aterm.ATermAppl dataValue,
                          DependencySet ds)

addIndividual

public Individual addIndividual(aterm.ATermAppl x,
                                DependencySet ds)

addFreshIndividual

public Individual addFreshIndividual(Individual parent,
                                     DependencySet ds)

addSame

public void addSame(aterm.ATermAppl x,
                    aterm.ATermAppl y)

addDifferent

public void addDifferent(aterm.ATermAppl x,
                         aterm.ATermAppl y)

addAllDifferent

public void addAllDifferent(aterm.ATermList list)

isNode

public boolean isNode(aterm.ATerm x)

createUniqueName

public final aterm.ATermAppl createUniqueName(boolean isNominal)

getNodes

public final java.util.Collection<Node> getNodes()

getNodeNames

public final java.util.List<aterm.ATermAppl> getNodeNames()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDatatypeReasoner

public DatatypeReasoner getDatatypeReasoner()
Returns:
Returns the datatype reasoner.

isComplete

public boolean isComplete()
Returns:
Returns the isComplete.

setComplete

public void setComplete(boolean isComplete)
Parameters:
isComplete - The isComplete to set.

isClosed

public boolean isClosed()
Returns true if Abox has a clash.

Returns:

getClash

public Clash getClash()

setClash

public void setClash(Clash clash)

getKB

public KnowledgeBase getKB()
Returns:
Returns the kb.

getRole

public Role getRole(aterm.ATerm r)
Convenience function to get the named role.


getRBox

public RBox getRBox()
Return the RBox


getTBox

public TBox getTBox()
Return the TBox


getBranch

public int getBranch()
Return the current branch number. Branches are created when a non-deterministic rule, e.g. disjunction or max rule, is being applied.

Returns:
Returns the branch.

setBranch

public void setBranch(int branch)
Set the branch number (should only be called when backjumping is in progress)

Parameters:
branch -

incrementBranch

public void incrementBranch()
Increment the branch number (should only be called when a non-deterministic rule, e.g. disjunction or max rule, is being applied)

Parameters:
branch -

isInitialized

public boolean isInitialized()
Check if the ABox is ready to be completed.

Returns:
Returns the initialized.

setInitialized

public void setInitialized(boolean initialized)

doExplanation

public final boolean doExplanation()
Checks if the explanation is turned on.

Returns:
Returns the doExplanation.

setDoExplanation

public void setDoExplanation(boolean doExplanation)
Enable/disable explanation generation

Parameters:
doExplanation - The doExplanation to set.

setExplanation

public void setExplanation(DependencySet ds)

getExplanation

public java.lang.String getExplanation()

getExplanationSet

public java.util.Set<aterm.ATermAppl> getExplanationSet()

getBranchEffectTracker

public BranchEffectTracker getBranchEffectTracker()

getBranches

public java.util.List<Branch> getBranches()
Returns the branches.


getIncrementalChangeTracker

public IncrementalChangeTracker getIncrementalChangeTracker()

getIndIterator

public IndividualIterator getIndIterator()
Return individuals to which we need to apply the tableau rules

Returns:

validate

public void validate()
Validate all the edges in the ABox nodes. Used to find bugs in the copy and detach/attach functions.


printTree

public void printTree()
Print the ABox as a completion tree (child nodes are indented).


getLastClash

public Clash getLastClash()

getLastCompletion

public ABox getLastCompletion()

isKeepLastCompletion

public boolean isKeepLastCompletion()

setKeepLastCompletion

public void setKeepLastCompletion(boolean keepLastCompletion)

size

public int size()
Return the number of nodes in the ABox. This number includes both the individuals and the literals.

Returns:

isEmpty

public boolean isEmpty()
Returns true if there are no individuals in the ABox.

Returns:

setLastCompletion

public void setLastCompletion(ABox comp)

getCompletionQueue

public CompletionQueue getCompletionQueue()

reset

public void reset()
Reset the ABox to contain only asserted information. Any ABox assertion added by tableau rules will be removed.


resetQueue

public void resetQueue()

setAnonCount

public int setAnonCount(int anonCount)
Parameters:
anonCount - the anonCount to set

getAnonCount

public int getAnonCount()
Returns:
the anonCount

setDisjBranchStats

public void setDisjBranchStats(java.util.Map<aterm.ATermAppl,int[]> disjBranchStats)
Parameters:
disjBranchStats - the disjBranchStats to set

getDisjBranchStats

public java.util.Map<aterm.ATermAppl,int[]> getDisjBranchStats()
Returns:
the disjBranchStats

setChanged

public void setChanged(boolean changed)
Parameters:
changed - the changed to set

isChanged

public boolean isChanged()
Returns:
the changed

getToBeMerged

public java.util.List<NodeMerge> getToBeMerged()
Returns:
the toBeMerged


Copyright © 2004 Evren Sirin. All Rights Reserved.