Package openllet.core
Class KnowledgeBaseImpl
- java.lang.Object
-
- openllet.core.KnowledgeBaseImpl
-
- All Implemented Interfaces:
Base
,Boxes
,ClassesBase
,InstancesBase
,MessageBase
,PropertiesBase
,KnowledgeBase
,openllet.shared.tools.Logging
- Direct Known Subclasses:
KnowledgeBaseImplFullSync
public class KnowledgeBaseImpl extends java.lang.Object implements KnowledgeBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
KnowledgeBaseImpl.AssertionType
-
Nested classes/interfaces inherited from interface openllet.core.KnowledgeBase
KnowledgeBase.ChangeType
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.logging.Logger
_logger
Timers
_timers
Timers used in various different parts of KB.-
Fields inherited from interface openllet.core.knowledge.MessageBase
_isNotAnClass, _isNotAnIndividual, _isNotAnKnowClass, _isNotAnKnowDataProperty, _isNotAnKnowIndividual, _isNotAnKnowObjectProperty, _isNotAnKnowProperty, _isNotAnProperty, _isNotAnPropertyNorAClass, _isNotAValidClassExpression, _isNotAValidClassExpressionOrDataRange
-
-
Constructor Summary
Constructors Constructor Description KnowledgeBaseImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAllDifferent(openllet.aterm.ATermList list)
boolean
addAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
boolean
addAnnotationProperty(openllet.aterm.ATerm p)
void
addClass(openllet.aterm.ATermAppl c)
void
addComplementClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
void
addDatatype(openllet.aterm.ATermAppl p)
boolean
addDatatypeDefinition(openllet.aterm.ATermAppl name, openllet.aterm.ATermAppl datarange)
Adds a new datatype defined to be equivalent to the given data range expression.boolean
addDatatypeProperty(openllet.aterm.ATerm p)
Add a new object property.void
addDifferent(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
void
addDisjointClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
void
addDisjointClasses(java.util.List<openllet.aterm.ATermAppl> classes)
void
addDisjointClasses(openllet.aterm.ATermList classes)
void
addDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
void
addDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)
For internal use when domain axioms come from TBox absorptionvoid
addEquivalentClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
Individual
addIndividual(openllet.aterm.ATermAppl i)
void
addKey(openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> properties)
boolean
addNegatedPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
boolean
addObjectProperty(openllet.aterm.ATerm p)
Add a new object property.void
addObjectPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
Deprecated.2.5.1 Use addPropertyValue insteadvoid
addOntologyProperty(openllet.aterm.ATermAppl p)
Deprecated.void
addProperty(openllet.aterm.ATermAppl p)
boolean
addPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
void
addRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
void
addRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)
For internal use when range axioms come from TBox absorptionboolean
addRule(Rule rule)
Add a rule to the KB.void
addSame(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
void
addSubClass(openllet.aterm.ATermAppl sub, openllet.aterm.ATermAppl sup)
void
addType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c)
void
addType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c, DependencySet ds)
CompletionStrategy
chooseStrategy(ABox abox)
CompletionStrategy
chooseStrategy(ABox abox, Expressivity expressivity)
Choose a completion strategy based on the expressivity of the KB.void
classify()
void
clear()
void
clearABox()
KnowledgeBase
copy(boolean emptyABox)
Create a copy of this KB.java.util.Set<openllet.aterm.ATermAppl>
currentIndividuals()
void
ensureConsistency()
void
ensureIncConsistency(boolean aboxDeletion)
ABox
getABox()
java.util.Set<openllet.aterm.ATermAppl>
getABoxAssertions(KnowledgeBaseImpl.AssertionType assertionType)
java.util.Set<openllet.aterm.ATermAppl>
getAllUnsatisfiableClasses()
Returns all unsatisfiable classes in the KB including the BOTTOM concept.java.util.Map<openllet.aterm.ATermAppl,java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>>>
getAnnotations()
TaxonomyBuilder
getBuilder()
ProgressMonitor
getBuilderProgressMonitor()
java.util.EnumSet<KnowledgeBase.ChangeType>
getChanges()
java.util.Set<openllet.aterm.ATermAppl>
getComplements(openllet.aterm.ATermAppl c)
DatatypeVisitor
getDatatypeVisitor()
java.util.Set<openllet.aterm.ATermAppl>
getDeletedAssertions()
DependencyIndex
getDependencyIndex()
java.util.Set<openllet.aterm.ATermAppl>
getDifferents(openllet.aterm.ATermAppl name)
java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>
getDisjointProperties(openllet.aterm.ATermAppl p)
java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>
getDisjointProperties(openllet.aterm.ATermAppl p, boolean direct)
java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>
getDisjoints(openllet.aterm.ATermAppl c)
boolean
getDoDependencyAxioms()
Deprecated.Use getExplanation insteadExpressivityChecker
getExpChecker()
Expressivity
getExpressivity()
ExpressivityChecker
getExpressivityChecker()
FullyDefinedClassVisitor
getFullyDefinedVisitor()
java.util.Set<openllet.aterm.ATermAppl>
getIndividuals()
int
getIndividualsCount()
java.lang.String
getInfo()
java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>>
getInstances()
KnowledgeBase
getKnowledgeBase()
java.util.logging.Logger
getLogger()
java.util.Map<Rule,Rule>
getNormalizedRules()
Return the asserted rules with their normalized form.java.util.Optional<TaxonomyBuilder>
getOptTaxonomyBuilder()
RBox
getRBox()
java.util.Set<Rule>
getRules()
Return all the asserted rules.java.util.Set<openllet.aterm.ATermAppl>
getSames(openllet.aterm.ATermAppl name)
SizeEstimate
getSizeEstimate()
java.util.Set<openllet.aterm.ATermAppl>
getSyntacticAssertions()
Taxonomy<openllet.aterm.ATermAppl>
getTaxonomy()
Get the classification results.TBox
getTBox()
Timers
getTimers()
java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>>
getToldDisjoints()
Taxonomy<openllet.aterm.ATermAppl>
getToldTaxonomy()
java.util.Set<openllet.aterm.ATermAppl>
getUnsatisfiableClasses()
Returns all unsatisfiable classes in the KB excluding the BOTTOM concept.boolean
hasInstance(openllet.aterm.ATerm d)
Bool
hasKnownPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
Answers the hasPropertyValue question without doing any satisfiability check.boolean
hasPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
java.util.stream.Stream<openllet.aterm.ATermAppl>
individuals()
boolean
isABoxChanged()
boolean
isAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
boolean
isChanged()
boolean
isChanged(KnowledgeBase.ChangeType change)
boolean
isClassified()
Returns true if the classification check has been done and nothing in the KB has changed after that.boolean
isConsistencyDone()
Returns true if the consistency check has been done and nothing in the KB has changed after that.boolean
isConsistent()
boolean
isDifferentFrom(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)
boolean
isExplainOnlyInconsistency()
Returns _current value of explainOnlyInconsistency option.boolean
isRBoxChanged()
boolean
isRealized()
boolean
isSameAs(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)
boolean
isSatisfiable(openllet.aterm.ATermAppl c)
boolean
isTBoxChanged()
void
prepare()
void
printClassTree(java.io.PrintWriter out)
void
realize()
boolean
removeAxiom(openllet.aterm.ATermAppl axiom)
Removes (if possible) the given TBox axiom from the KB and returntrue
if removal was successful.boolean
removeDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
Removes (if possible) the given property domain axiom from the KB and returntrue
if removal was successful.boolean
removePropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
boolean
removeRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
Removes (if possible) the given property range axiom from the KB and returntrue
if removal was successful.boolean
removeType(openllet.aterm.ATermAppl ind, openllet.aterm.ATermAppl c)
void
setBuilderProgressMonitor(ProgressMonitor builderProgressMonitor)
void
setChanges(java.util.EnumSet<KnowledgeBase.ChangeType> changes)
void
setDoDependencyAxioms(boolean doDepAxioms)
Deprecated.Use setDoExplanation insteadvoid
setExpChecker(ExpressivityChecker expChecker)
void
setExplainOnlyInconsistency(boolean explainOnlyInconsistency)
Controls what kind of explanations can be generated using this KB.void
setOptTaxonomyBuilder(java.util.Optional<TaxonomyBuilder> builder)
void
setTaxonomyBuilderProgressMonitor(ProgressMonitor progressMonitor)
void
setTimeout(long timeout)
Set a timeout for the main timer.void
updateExpressivity(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c)
This method is used for incremental reasoning.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface openllet.core.knowledge.Base
allClasses, doExplanation, getAllClasses, getAnnotationSubjects, getClasses, getExplanation, getExplanationSet, getProperties, getProperty, getPropertyType, getRole, getTaxonomyBuilder, isABoxProperty, isAnnotationProperty, isClass, isDatatype, isDatatypeProperty, isIndividual, isObjectProperty, isProperty, setDoExplanation
-
Methods inherited from interface openllet.core.knowledge.Boxes
getDatatypeReasoner
-
Methods inherited from interface openllet.core.knowledge.ClassesBase
getAllEquivalentClasses, getDisjointClasses, getEquivalentClasses, getSubClasses, getSuperClasses, hasRange, isComplement, isDisjoint, isDisjointClass, isDisjointProperty, isEquivalentClass, isKnownType, isSubClassOf, isType, printClassTree
-
Methods inherited from interface openllet.core.knowledge.InstancesBase
binaryInstanceRetrieval, getAllSames, getInstances, getInstances, getPrimitiveTypes, getTypes, linearInstanceRetrieval, partitionInstanceRetrieval, retrieve, retrieveIndividualsWithProperty, tracingBasedInstanceRetrieval
-
Methods inherited from interface openllet.core.KnowledgeBase
copy, getDisjointClasses, getSubClasses, getSuperClasses, getTypes
-
Methods inherited from interface openllet.core.knowledge.PropertiesBase
addAntisymmetricProperty, addAsymmetricProperty, addDisjointProperties, addDisjointProperty, addDisjointProperty, addEquivalentProperty, addFunctionalProperty, addInverseFunctionalProperty, addInverseProperty, addIrreflexiveProperty, addReflexiveProperty, addSubProperty, addSymmetricProperty, addTransitiveProperty, getAllEquivalentProperties, getAllSubProperties, getAllSuperProperties, getAnnotationProperties, getAnnotations, getAntisymmetricProperties, getAsymmetricProperties, getDataProperties, getDataPropertyValues, getDataPropertyValues, getDataPropertyValues, getDomains, getEquivalentProperties, getFunctionalProperties, getIndividualsWithAnnotation, getIndividualsWithDataProperty, getIndividualsWithObjectProperty, getIndividualsWithProperty, getInverse, getInverseFunctionalProperties, getInverses, getIrreflexiveProperties, getObjectProperties, getObjectPropertyValues, getObjectPropertyValuesSet, getProperties, getPropertyValues, getPropertyValues, getRanges, getReflexiveProperties, getRoleTaxonomy, getRoleTaxonomy, getSubAnnotationProperties, getSubProperties, getSubProperties, getSuperProperties, getSuperProperties, getSymmetricProperties, getTransitiveProperties, hasDomain, isAntisymmetricProperty, isAsymmetricProperty, isEquivalentProperty, isFunctionalProperty, isInverse, isInverseFunctionalProperty, isIrreflexiveProperty, isReflexiveProperty, isSubPropertyOf, isSymmetricProperty, isTransitiveProperty, objectPropertyValues
-
-
-
-
Field Detail
-
_logger
public static final java.util.logging.Logger _logger
-
_timers
public final Timers _timers
Timers used in various different parts of KB. There may be many different _timers created here depending on the level of debugging or application requirements. However, there are three major timers that are guaranteed to exist.- main - This is the main timer that exists in any Timers objects. All the other _timers defined in here will have this timer as its dependant so setting a timeout on this timer will put a limit on every operation done inside KB.
- preprocessing - This is the operation where TBox creation, absorbtion and normalization is done. It also includes computing hierarchy of properties in RBox and merging the _individuals in ABox if there are explicit sameAs assertions.
- consistency - This is the timer for ABox consistency check. Putting a timeout will mean that any single consistency check should be completed in a certain amount of time.
-
-
Method Detail
-
getAnnotations
public java.util.Map<openllet.aterm.ATermAppl,java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>>> getAnnotations()
- Specified by:
getAnnotations
in interfaceBase
-
getInstances
public java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>> getInstances()
- Specified by:
getInstances
in interfaceBase
-
getBuilderProgressMonitor
public ProgressMonitor getBuilderProgressMonitor()
- Specified by:
getBuilderProgressMonitor
in interfaceBase
-
setBuilderProgressMonitor
public void setBuilderProgressMonitor(ProgressMonitor builderProgressMonitor)
- Specified by:
setBuilderProgressMonitor
in interfaceBase
-
getFullyDefinedVisitor
public FullyDefinedClassVisitor getFullyDefinedVisitor()
- Specified by:
getFullyDefinedVisitor
in interfaceBase
-
getDatatypeVisitor
public DatatypeVisitor getDatatypeVisitor()
- Specified by:
getDatatypeVisitor
in interfaceBase
-
getOptTaxonomyBuilder
public java.util.Optional<TaxonomyBuilder> getOptTaxonomyBuilder()
- Specified by:
getOptTaxonomyBuilder
in interfaceBase
-
setOptTaxonomyBuilder
public void setOptTaxonomyBuilder(java.util.Optional<TaxonomyBuilder> builder)
- Specified by:
setOptTaxonomyBuilder
in interfaceBase
-
getChanges
public java.util.EnumSet<KnowledgeBase.ChangeType> getChanges()
- Specified by:
getChanges
in interfaceBase
-
setChanges
public void setChanges(java.util.EnumSet<KnowledgeBase.ChangeType> changes)
-
getExpChecker
public ExpressivityChecker getExpChecker()
- Specified by:
getExpChecker
in interfaceBase
-
setExpChecker
public void setExpChecker(ExpressivityChecker expChecker)
-
getKnowledgeBase
public KnowledgeBase getKnowledgeBase()
- Specified by:
getKnowledgeBase
in interfaceBase
-
getBuilder
public TaxonomyBuilder getBuilder()
- Specified by:
getBuilder
in interfaceBase
-
getLogger
public java.util.logging.Logger getLogger()
- Specified by:
getLogger
in interfaceopenllet.shared.tools.Logging
-
getExpressivity
public Expressivity getExpressivity()
- Specified by:
getExpressivity
in interfaceKnowledgeBase
-
getExpressivityChecker
public ExpressivityChecker getExpressivityChecker()
- Specified by:
getExpressivityChecker
in interfaceKnowledgeBase
-
clear
public void clear()
- Specified by:
clear
in interfaceKnowledgeBase
-
clearABox
public void clearABox()
- Specified by:
clearABox
in interfaceKnowledgeBase
-
copy
public KnowledgeBase copy(boolean emptyABox)
Create a copy of this KB. Depending on the value ofemptyABox
either a completely new copy of ABox will be created or the new KB will have an empty ABox. IfemptyABox
parameter is true but the original KB contains nominals in its RBox or TBox the new KB will have the definition of those _individuals (but not ) In either case, the new KB will point to the same RBox and TBox so changing one KB's RBox or TBox will affect other.- Specified by:
copy
in interfaceKnowledgeBase
- Parameters:
emptyABox
- Iftrue
ABox is not copied to the new KB- Returns:
- A copy of this KB
-
addClass
public void addClass(openllet.aterm.ATermAppl c)
- Specified by:
addClass
in interfaceKnowledgeBase
-
addSubClass
public void addSubClass(openllet.aterm.ATermAppl sub, openllet.aterm.ATermAppl sup)
- Specified by:
addSubClass
in interfaceKnowledgeBase
-
addEquivalentClass
public void addEquivalentClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
- Specified by:
addEquivalentClass
in interfaceKnowledgeBase
-
addKey
public void addKey(openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> properties)
- Specified by:
addKey
in interfaceKnowledgeBase
-
addDisjointClasses
public void addDisjointClasses(openllet.aterm.ATermList classes)
- Specified by:
addDisjointClasses
in interfaceKnowledgeBase
-
addDisjointClasses
public void addDisjointClasses(java.util.List<openllet.aterm.ATermAppl> classes)
- Specified by:
addDisjointClasses
in interfaceKnowledgeBase
-
addDisjointClass
public void addDisjointClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
- Specified by:
addDisjointClass
in interfaceKnowledgeBase
-
addComplementClass
public void addComplementClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
- Specified by:
addComplementClass
in interfaceKnowledgeBase
-
addIndividual
public Individual addIndividual(openllet.aterm.ATermAppl i)
- Specified by:
addIndividual
in interfaceKnowledgeBase
-
addType
public void addType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c)
- Specified by:
addType
in interfaceKnowledgeBase
-
addType
public void addType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c, DependencySet ds)
- Specified by:
addType
in interfaceKnowledgeBase
-
addSame
public void addSame(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
- Specified by:
addSame
in interfaceKnowledgeBase
-
addAllDifferent
public void addAllDifferent(openllet.aterm.ATermList list)
- Specified by:
addAllDifferent
in interfaceKnowledgeBase
-
addDifferent
public void addDifferent(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
- Specified by:
addDifferent
in interfaceKnowledgeBase
-
addObjectPropertyValue
@Deprecated public void addObjectPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
Deprecated.2.5.1 Use addPropertyValue instead- Parameters:
p
-s
-o
-
-
addPropertyValue
public boolean addPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
- Specified by:
addPropertyValue
in interfaceKnowledgeBase
-
addNegatedPropertyValue
public boolean addNegatedPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
- Specified by:
addNegatedPropertyValue
in interfaceKnowledgeBase
-
addProperty
public void addProperty(openllet.aterm.ATermAppl p)
- Specified by:
addProperty
in interfaceKnowledgeBase
-
addObjectProperty
public boolean addObjectProperty(openllet.aterm.ATerm p)
Add a new object property. If property was earlier defined to be a datatype property then this function will simply return without changing the KB.- Specified by:
addObjectProperty
in interfaceKnowledgeBase
- Parameters:
p
- Name of the property- Returns:
- True if property is added, false if not
-
addDatatypeProperty
public boolean addDatatypeProperty(openllet.aterm.ATerm p)
Add a new object property. If property was earlier defined to be a datatype property then this function will simply return without changing the KB.- Specified by:
addDatatypeProperty
in interfaceKnowledgeBase
- Parameters:
p
-- Returns:
- True if property is added, false if not
-
addOntologyProperty
@Deprecated public void addOntologyProperty(openllet.aterm.ATermAppl p)
Deprecated.
-
addAnnotationProperty
public boolean addAnnotationProperty(openllet.aterm.ATerm p)
- Specified by:
addAnnotationProperty
in interfaceKnowledgeBase
-
addAnnotation
public boolean addAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
- Specified by:
addAnnotation
in interfaceKnowledgeBase
-
isAnnotation
public boolean isAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
- Specified by:
isAnnotation
in interfaceKnowledgeBase
-
addDomain
public void addDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
- Specified by:
addDomain
in interfaceKnowledgeBase
-
addDomain
public void addDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)
For internal use when domain axioms come from TBox absorption- Specified by:
addDomain
in interfaceKnowledgeBase
-
addRange
public void addRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
- Specified by:
addRange
in interfaceKnowledgeBase
-
addRange
public void addRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)
For internal use when range axioms come from TBox absorption- Specified by:
addRange
in interfaceKnowledgeBase
-
addDatatype
public void addDatatype(openllet.aterm.ATermAppl p)
- Specified by:
addDatatype
in interfaceKnowledgeBase
-
addDatatypeDefinition
public boolean addDatatypeDefinition(openllet.aterm.ATermAppl name, openllet.aterm.ATermAppl datarange)
Adds a new datatype defined to be equivalent to the given data range expression.- Specified by:
addDatatypeDefinition
in interfaceKnowledgeBase
- Parameters:
name
- name of the datatypedatarange
- a data range expression- Returns:
- true if the add success
-
removeDomain
public boolean removeDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
Removes (if possible) the given property domain axiom from the KB and returntrue
if removal was successful. See alsoaddDomain(ATerm, ATermAppl)
.- Specified by:
removeDomain
in interfaceKnowledgeBase
- Parameters:
p
- Property in domain axiomc
- Class in domain axiom- Returns:
true
if axiom is removed,false
if removal failed
-
removePropertyValue
public boolean removePropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
- Specified by:
removePropertyValue
in interfaceKnowledgeBase
-
removeRange
public boolean removeRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
Removes (if possible) the given property range axiom from the KB and returntrue
if removal was successful. See alsoaddRange(ATerm, ATermAppl)
.- Specified by:
removeRange
in interfaceKnowledgeBase
- Parameters:
p
- Property in range axiomc
- Class or datatype in range axiom- Returns:
true
if axiom is removed,false
if removal failed
-
removeType
public boolean removeType(openllet.aterm.ATermAppl ind, openllet.aterm.ATermAppl c)
- Specified by:
removeType
in interfaceKnowledgeBase
-
removeAxiom
public boolean removeAxiom(openllet.aterm.ATermAppl axiom)
Removes (if possible) the given TBox axiom from the KB and returntrue
if removal was successful.- Specified by:
removeAxiom
in interfaceKnowledgeBase
- Parameters:
axiom
- TBox axiom to remove- Returns:
true
if axiom is removed,false
if removal failed
-
updateExpressivity
public void updateExpressivity(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c)
This method is used for incremental reasoning. We do not want to recompute the expressivity from scratch.- Parameters:
i
-c
-
-
getInfo
public java.lang.String getInfo()
-
isConsistencyDone
public boolean isConsistencyDone()
Returns true if the consistency check has been done and nothing in the KB has changed after that.- Specified by:
isConsistencyDone
in interfaceKnowledgeBase
- Returns:
- true if the consistency check has been done and nothing in the KB has changed after that.
-
isClassified
public boolean isClassified()
Returns true if the classification check has been done and nothing in the KB has changed after that.- Specified by:
isClassified
in interfaceBase
- Returns:
- true if the classification check has been done and nothing in the KB has changed after that.
-
isRealized
public boolean isRealized()
- Specified by:
isRealized
in interfaceBase
-
isChanged
public boolean isChanged()
-
isChanged
public boolean isChanged(KnowledgeBase.ChangeType change)
- Specified by:
isChanged
in interfaceKnowledgeBase
-
isTBoxChanged
public boolean isTBoxChanged()
-
isRBoxChanged
public boolean isRBoxChanged()
-
isABoxChanged
public boolean isABoxChanged()
-
getUnsatisfiableClasses
public java.util.Set<openllet.aterm.ATermAppl> getUnsatisfiableClasses()
Returns all unsatisfiable classes in the KB excluding the BOTTOM concept. The result may be empty if there is no user-defined concept in the KB that is unsatisfiable.- Specified by:
getUnsatisfiableClasses
in interfaceKnowledgeBase
- Returns:
- all unsatisfiable classes in the KB excluding the BOTTOM concept
-
getAllUnsatisfiableClasses
public java.util.Set<openllet.aterm.ATermAppl> getAllUnsatisfiableClasses()
Returns all unsatisfiable classes in the KB including the BOTTOM concept. Since BOTTOM concept is built-in the result will always have at least one element.- Specified by:
getAllUnsatisfiableClasses
in interfaceKnowledgeBase
- Returns:
- all unsatisfiable classes in the KB including the BOTTOM concept
-
isConsistent
public boolean isConsistent()
- Specified by:
isConsistent
in interfaceKnowledgeBase
-
getToldTaxonomy
public Taxonomy<openllet.aterm.ATermAppl> getToldTaxonomy()
- Specified by:
getToldTaxonomy
in interfaceKnowledgeBase
-
getToldDisjoints
public java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>> getToldDisjoints()
- Specified by:
getToldDisjoints
in interfaceKnowledgeBase
-
ensureConsistency
public void ensureConsistency()
- Specified by:
ensureConsistency
in interfaceBase
-
currentIndividuals
public java.util.Set<openllet.aterm.ATermAppl> currentIndividuals()
- Specified by:
currentIndividuals
in interfacePropertiesBase
- Returns:
- the actual set individuals.
-
getIndividuals
public java.util.Set<openllet.aterm.ATermAppl> getIndividuals()
- Specified by:
getIndividuals
in interfaceBase
- Returns:
- the set of all _individuals. Returned set is unmodifiable!
-
getIndividualsCount
public int getIndividualsCount()
- Specified by:
getIndividualsCount
in interfaceKnowledgeBase
- Returns:
- the total number of individuals in kb.
-
individuals
public java.util.stream.Stream<openllet.aterm.ATermAppl> individuals()
- Specified by:
individuals
in interfaceKnowledgeBase
- Returns:
- all individuals.
-
isSatisfiable
public boolean isSatisfiable(openllet.aterm.ATermAppl c)
- Specified by:
isSatisfiable
in interfaceBase
-
hasInstance
public boolean hasInstance(openllet.aterm.ATerm d)
- Specified by:
hasInstance
in interfaceKnowledgeBase
- Parameters:
d
-- Returns:
- true if there is at least one named individual that belongs to the given class
-
isSameAs
public boolean isSameAs(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)
- Specified by:
isSameAs
in interfaceKnowledgeBase
-
isDifferentFrom
public boolean isDifferentFrom(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)
- Specified by:
isDifferentFrom
in interfaceKnowledgeBase
-
getDifferents
public java.util.Set<openllet.aterm.ATermAppl> getDifferents(openllet.aterm.ATermAppl name)
- Specified by:
getDifferents
in interfaceKnowledgeBase
-
hasPropertyValue
public boolean hasPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
- Specified by:
hasPropertyValue
in interfaceKnowledgeBase
-
hasKnownPropertyValue
public Bool hasKnownPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
Description copied from interface:KnowledgeBase
Answers the hasPropertyValue question without doing any satisfiability check. It might returnBoolean.TRUE
,Boolean.FALSE
, ornull
(unknown). If the null value is returnedhasPropertyValue
function needs to be called to get the answer.- Specified by:
hasKnownPropertyValue
in interfaceKnowledgeBase
- Parameters:
s
- Subjectp
- Predicateo
- Object (null
can be used as wildcard)- Returns:
- true if the hasPropertyValue question without doing any satisfiability check.
-
getDisjoints
public java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getDisjoints(openllet.aterm.ATermAppl c)
-
getDisjointProperties
public java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getDisjointProperties(openllet.aterm.ATermAppl p)
- Specified by:
getDisjointProperties
in interfaceKnowledgeBase
-
getDisjointProperties
public java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getDisjointProperties(openllet.aterm.ATermAppl p, boolean direct)
-
getComplements
public java.util.Set<openllet.aterm.ATermAppl> getComplements(openllet.aterm.ATermAppl c)
- Specified by:
getComplements
in interfaceKnowledgeBase
-
getSames
public java.util.Set<openllet.aterm.ATermAppl> getSames(openllet.aterm.ATermAppl name)
- Specified by:
getSames
in interfaceKnowledgeBase
- Returns:
- all the individuals asserted to be equal to the given individual but not the the individual itself.
-
printClassTree
public void printClassTree(java.io.PrintWriter out)
-
setDoDependencyAxioms
@Deprecated public void setDoDependencyAxioms(boolean doDepAxioms)
Deprecated.Use setDoExplanation instead- Parameters:
doDepAxioms
-
-
getDoDependencyAxioms
@Deprecated public boolean getDoDependencyAxioms()
Deprecated.Use getExplanation instead- Returns:
- DO NOT USE
-
chooseStrategy
public CompletionStrategy chooseStrategy(ABox abox)
- Specified by:
chooseStrategy
in interfaceKnowledgeBase
-
chooseStrategy
public CompletionStrategy chooseStrategy(ABox abox, Expressivity expressivity)
Choose a completion strategy based on the expressivity of the KB. The _abox given is not necessarily the ABox that belongs to this KB but can be a derivative.- Specified by:
chooseStrategy
in interfaceKnowledgeBase
- Returns:
- the completion strategy choosen
-
setTimeout
public void setTimeout(long timeout)
Set a timeout for the main timer. Used to stop an automated test after a reasonable amount of time has passed.- Specified by:
setTimeout
in interfaceKnowledgeBase
- Parameters:
timeout
-
-
getTaxonomy
public Taxonomy<openllet.aterm.ATermAppl> getTaxonomy()
Get the classification results.- Specified by:
getTaxonomy
in interfaceKnowledgeBase
- Returns:
- the classification results.
-
setTaxonomyBuilderProgressMonitor
public void setTaxonomyBuilderProgressMonitor(ProgressMonitor progressMonitor)
- Specified by:
setTaxonomyBuilderProgressMonitor
in interfaceKnowledgeBase
-
getSizeEstimate
public SizeEstimate getSizeEstimate()
- Specified by:
getSizeEstimate
in interfaceKnowledgeBase
-
addRule
public boolean addRule(Rule rule)
Add a rule to the KB.- Specified by:
addRule
in interfaceKnowledgeBase
- Returns:
- true if the add success
-
getRules
public java.util.Set<Rule> getRules()
Return all the asserted rules.- Specified by:
getRules
in interfaceKnowledgeBase
- Returns:
- all the asserted rules.
-
getNormalizedRules
public java.util.Map<Rule,Rule> getNormalizedRules()
Return the asserted rules with their normalized form. A normalized rule is a rule where any class expression occurring in the rules is in normalized form.- Specified by:
getNormalizedRules
in interfaceKnowledgeBase
- Returns:
- set of rules where
-
ensureIncConsistency
public void ensureIncConsistency(boolean aboxDeletion)
-
getDependencyIndex
public DependencyIndex getDependencyIndex()
- Specified by:
getDependencyIndex
in interfaceKnowledgeBase
- Returns:
- the dependency index for syntactic assertions in this kb
-
getSyntacticAssertions
public java.util.Set<openllet.aterm.ATermAppl> getSyntacticAssertions()
- Specified by:
getSyntacticAssertions
in interfaceKnowledgeBase
- Returns:
- syntactic assertions in the kb
-
getABoxAssertions
public java.util.Set<openllet.aterm.ATermAppl> getABoxAssertions(KnowledgeBaseImpl.AssertionType assertionType)
-
getDeletedAssertions
public java.util.Set<openllet.aterm.ATermAppl> getDeletedAssertions()
- Specified by:
getDeletedAssertions
in interfaceKnowledgeBase
- Returns:
- the deletedAssertions
-
isExplainOnlyInconsistency
public boolean isExplainOnlyInconsistency()
Returns _current value of explainOnlyInconsistency option.- Returns:
- current value of explainOnlyInconsistency option
- See Also:
setExplainOnlyInconsistency(boolean)
-
setExplainOnlyInconsistency
public void setExplainOnlyInconsistency(boolean explainOnlyInconsistency)
Controls what kind of explanations can be generated using this KB. With this option enabled explanations for inconsistent ontologies will be returned. But if the ontology is _consistent, it will not be possible to retrieve explanations for inferences about _instances. This option is disabled by default. It should be turned on if explanations are only needed for inconsistencies but not other inferences. Turning this option on improves the performance of consistency checking for _consistent ontologies.- Parameters:
explainOnlyInconsistency
- new value for _explainOnlyInconsistency option
-
-