Package openllet.core
Interface KnowledgeBase
-
- All Superinterfaces:
Base,Boxes,ClassesBase,InstancesBase,openllet.shared.tools.Logging,MessageBase,PropertiesBase
- All Known Implementing Classes:
KnowledgeBaseImpl,KnowledgeBaseImplFullSync
public interface KnowledgeBase extends InstancesBase, PropertiesBase, ClassesBase
Abstraction of operation expeteced from a knowledge base.- Since:
- 2.6.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classKnowledgeBase.ChangeType
-
Field Summary
-
Fields inherited from interface openllet.core.knowledge.MessageBase
_isNotAnClass, _isNotAnIndividual, _isNotAnKnowClass, _isNotAnKnowDataProperty, _isNotAnKnowIndividual, _isNotAnKnowObjectProperty, _isNotAnKnowProperty, _isNotAnProperty, _isNotAnPropertyNorAClass, _isNotAValidClassExpression, _isNotAValidClassExpressionOrDataRange
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddAllDifferent(openllet.aterm.ATermList list)booleanaddAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)booleanaddAnnotationProperty(openllet.aterm.ATerm p)voidaddClass(openllet.aterm.ATermAppl c)voidaddComplementClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)voidaddDatatype(openllet.aterm.ATermAppl p)booleanaddDatatypeDefinition(openllet.aterm.ATermAppl name, openllet.aterm.ATermAppl datarange)Adds a new datatype defined to be equivalent to the given data range expression.booleanaddDatatypeProperty(openllet.aterm.ATerm p)Add a new object property.voidaddDifferent(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)voidaddDisjointClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)voidaddDisjointClasses(java.util.List<openllet.aterm.ATermAppl> classes)voidaddDisjointClasses(openllet.aterm.ATermList classes)voidaddDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)voidaddDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)voidaddEquivalentClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)IndividualaddIndividual(openllet.aterm.ATermAppl i)voidaddKey(openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> properties)booleanaddNegatedPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)booleanaddObjectProperty(openllet.aterm.ATerm p)Add a new object property.voidaddProperty(openllet.aterm.ATermAppl p)booleanaddPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)voidaddRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)voidaddRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)booleanaddRule(Rule rule)Add a rule to the KB.voidaddSame(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)voidaddSubClass(openllet.aterm.ATermAppl sub, openllet.aterm.ATermAppl sup)voidaddType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c)voidaddType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c, DependencySet ds)default CompletionStrategychooseStrategy(ABox abox)CompletionStrategychooseStrategy(ABox abox, Expressivity expressivity)Choose a completion strategy based on the expressivity of the KB.voidclear()voidclearABox()default KnowledgeBasecopy()Create a copy of this KB with a completely new ABox copy but pointing to the same RBox and TBox.KnowledgeBasecopy(boolean emptyABox)Create a copy of this KB.java.util.Set<openllet.aterm.ATermAppl>getAllUnsatisfiableClasses()Returns all unsatisfiable classes in the KB including the BOTTOM concept.java.util.Set<openllet.aterm.ATermAppl>getComplements(openllet.aterm.ATermAppl c)java.util.Set<openllet.aterm.ATermAppl>getDeletedAssertions()DependencyIndexgetDependencyIndex()java.util.Set<openllet.aterm.ATermAppl>getDifferents(openllet.aterm.ATermAppl name)default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>getDisjointClasses(openllet.aterm.ATermAppl c)java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>getDisjointProperties(openllet.aterm.ATermAppl p)ExpressivitygetExpressivity()ExpressivityCheckergetExpressivityChecker()intgetIndividualsCount()java.util.Map<Rule,Rule>getNormalizedRules()Return the asserted rules with their normalized form.java.util.Set<Rule>getRules()java.util.Set<openllet.aterm.ATermAppl>getSames(openllet.aterm.ATermAppl name)SizeEstimategetSizeEstimate()default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>getSubClasses(openllet.aterm.ATermAppl c)Returns all the (named) subclasses of class c.default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>getSuperClasses(openllet.aterm.ATermAppl c)Returns all the superclasses (implicitly or explicitly defined) of class c.java.util.Set<openllet.aterm.ATermAppl>getSyntacticAssertions()Taxonomy<openllet.aterm.ATermAppl>getTaxonomy()java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>>getToldDisjoints()Taxonomy<openllet.aterm.ATermAppl>getToldTaxonomy()default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>>getTypes(openllet.aterm.ATermAppl ind)Get all the (named) classes _individual belongs to.java.util.Set<openllet.aterm.ATermAppl>getUnsatisfiableClasses()Returns all unsatisfiable classes in the KB excluding the BOTTOM concept.booleanhasInstance(openllet.aterm.ATerm c)BoolhasKnownPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)Answers the hasPropertyValue question without doing any satisfiability check.booleanhasPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)java.util.stream.Stream<openllet.aterm.ATermAppl>individuals()booleanisAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)booleanisChanged(KnowledgeBase.ChangeType change)booleanisConsistencyDone()booleanisConsistent()booleanisDifferentFrom(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)booleanisSameAs(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)booleanremoveAxiom(openllet.aterm.ATermAppl axiom)Removes (if possible) the given TBox axiom from the KB and returntrueif removal was successful.booleanremoveDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)Removes (if possible) the given property domain axiom from the KB and returntrueif removal was successful.booleanremovePropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)booleanremoveRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)Removes (if possible) the given property range axiom from the KB and returntrueif removal was successful.booleanremoveType(openllet.aterm.ATermAppl ind, openllet.aterm.ATermAppl c)voidsetTaxonomyBuilderProgressMonitor(ProgressMonitor progressMonitor)voidsetTimeout(long timeout)Set a timeout for the main timer.-
Methods inherited from interface openllet.core.knowledge.Base
allClasses, classify, doExplanation, ensureConsistency, getAllClasses, getAnnotations, getAnnotationSubjects, getBuilder, getBuilderProgressMonitor, getChanges, getClasses, getDatatypeVisitor, getExpChecker, getExplanation, getExplanationSet, getFullyDefinedVisitor, getIndividuals, getInstances, getKnowledgeBase, getOptTaxonomyBuilder, getProperties, getProperty, getPropertyType, getRole, getTaxonomyBuilder, isABoxProperty, isAnnotationProperty, isClass, isClassified, isDatatype, isDatatypeProperty, isIndividual, isObjectProperty, isProperty, isRealized, isSatisfiable, prepare, realize, setBuilderProgressMonitor, setDoExplanation, setOptTaxonomyBuilder
-
Methods inherited from interface openllet.core.knowledge.Boxes
getABox, getDatatypeReasoner, getRBox, getTBox, getTimers
-
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.knowledge.PropertiesBase
addAntisymmetricProperty, addAsymmetricProperty, addDisjointProperties, addDisjointProperty, addDisjointProperty, addEquivalentProperty, addFunctionalProperty, addInverseFunctionalProperty, addInverseProperty, addIrreflexiveProperty, addReflexiveProperty, addSubProperty, addSymmetricProperty, addTransitiveProperty, currentIndividuals, 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
-
-
-
-
Method Detail
-
clear
void clear()
-
getSizeEstimate
SizeEstimate getSizeEstimate()
-
setTimeout
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.- Parameters:
timeout-
-
clearABox
void clearABox()
-
getExpressivity
Expressivity getExpressivity()
-
getIndividualsCount
int getIndividualsCount()
- Returns:
- the total number of individuals in kb.
- Since:
- 2.6.2
-
individuals
java.util.stream.Stream<openllet.aterm.ATermAppl> individuals()
- Returns:
- all individuals.
-
isConsistent
boolean isConsistent()
-
isConsistencyDone
boolean isConsistencyDone()
- Returns:
- true if the consistency check has been done and nothing in the KB has changed after that.
-
getTaxonomy
Taxonomy<openllet.aterm.ATermAppl> getTaxonomy()
- Returns:
- the classification results.
-
getExpressivityChecker
ExpressivityChecker getExpressivityChecker()
-
getDependencyIndex
DependencyIndex getDependencyIndex()
- Returns:
- the dependency index for syntactic assertions in this kb
-
getSyntacticAssertions
java.util.Set<openllet.aterm.ATermAppl> getSyntacticAssertions()
- Returns:
- syntactic assertions in the kb
-
getDeletedAssertions
java.util.Set<openllet.aterm.ATermAppl> getDeletedAssertions()
- Returns:
- the deletedAssertions
-
chooseStrategy
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.- Parameters:
abox-expressivity-- Returns:
- a Completion strategy choose.
-
chooseStrategy
default CompletionStrategy chooseStrategy(ABox abox)
-
getUnsatisfiableClasses
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.- Returns:
- all unsatisfiable classes in the KB excluding the BOTTOM concept
-
getAllUnsatisfiableClasses
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.- Returns:
- all unsatisfiable classes in the KB including the BOTTOM concept
-
getNormalizedRules
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.- Returns:
- set of rules where
-
getRules
java.util.Set<Rule> getRules()
- Returns:
- all the asserted rules.
-
addProperty
void addProperty(openllet.aterm.ATermAppl p)
-
hasKnownPropertyValue
Bool hasKnownPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
Answers the hasPropertyValue question without doing any satisfiability check. It might returnBoolean.TRUE,Boolean.FALSE, ornull(unknown). If the null value is returnedhasPropertyValuefunction needs to be called to get the answer.- Parameters:
s- Subjectp- Predicateo- Object (nullcan be used as wildcard)- Returns:
- true if the hasPropertyValue question without doing any satisfiability check.
-
hasPropertyValue
boolean hasPropertyValue(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
-
isAnnotation
boolean isAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
-
getToldTaxonomy
Taxonomy<openllet.aterm.ATermAppl> getToldTaxonomy()
-
getToldDisjoints
java.util.Map<openllet.aterm.ATermAppl,java.util.Set<openllet.aterm.ATermAppl>> getToldDisjoints()
-
getTypes
default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getTypes(openllet.aterm.ATermAppl ind)
Get all the (named) classes _individual belongs to.*** This function will first realize the whole ontology ***
- Parameters:
ind- An individual name- Returns:
- A set of sets, where each set in the collection represents an equivalence class. The elements of the inner class are ATermAppl objects.
-
addType
void addType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c, DependencySet ds)
-
addType
void addType(openllet.aterm.ATermAppl i, openllet.aterm.ATermAppl c)
-
getSubClasses
default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getSubClasses(openllet.aterm.ATermAppl c)
Returns all the (named) subclasses of class c. The class c itself is not included in the list but all the other classes that are equivalent to c are put into the list. Also note that the returned list will always have at least one element, that is the BOTTOM concept. By definition BOTTOM concept is subclass of every concept. This function is equivalent to calling getSubClasses(c, true).*** This function will first classify the whole ontology ***
- Parameters:
c- class whose subclasses are returned- Returns:
- A set of sets, where each set in the collection represents an equivalence class. The elements of the inner class are ATermAppl objects.
-
hasInstance
boolean hasInstance(openllet.aterm.ATerm c)
- Parameters:
c- is a classes- Returns:
- true if there is at least one named individual that belongs to the given class
-
addObjectProperty
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.- Parameters:
p- Name of the property- Returns:
- True if property is added, false if not
-
addDatatypeProperty
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.- Parameters:
p-- Returns:
- True if property is added, false if not
-
addClass
void addClass(openllet.aterm.ATermAppl c)
-
addIndividual
Individual addIndividual(openllet.aterm.ATermAppl i)
-
addEquivalentClass
void addEquivalentClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
-
addSubClass
void addSubClass(openllet.aterm.ATermAppl sub, openllet.aterm.ATermAppl sup)
-
addDisjointClasses
void addDisjointClasses(openllet.aterm.ATermList classes)
-
addDisjointClasses
void addDisjointClasses(java.util.List<openllet.aterm.ATermAppl> classes)
-
addComplementClass
void addComplementClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
-
addDisjointClass
void addDisjointClass(openllet.aterm.ATermAppl c1, openllet.aterm.ATermAppl c2)
-
addDomain
void addDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
-
addDomain
void addDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)
-
addRange
void addRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)
-
addRange
void addRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> explain)
-
addPropertyValue
boolean addPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
-
addNegatedPropertyValue
boolean addNegatedPropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl o)
-
addSame
void addSame(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
-
addDifferent
void addDifferent(openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
-
addAllDifferent
void addAllDifferent(openllet.aterm.ATermList list)
-
addAnnotation
boolean addAnnotation(openllet.aterm.ATermAppl s, openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl o)
-
addAnnotationProperty
boolean addAnnotationProperty(openllet.aterm.ATerm p)
-
addDatatype
void addDatatype(openllet.aterm.ATermAppl p)
-
addKey
void addKey(openllet.aterm.ATermAppl c, java.util.Set<openllet.aterm.ATermAppl> properties)
-
addDatatypeDefinition
boolean addDatatypeDefinition(openllet.aterm.ATermAppl name, openllet.aterm.ATermAppl datarange)Adds a new datatype defined to be equivalent to the given data range expression.- Parameters:
name- name of the datatypedatarange- a data range expression- Returns:
- true if the add success
-
addRule
boolean addRule(Rule rule)
Add a rule to the KB.- Parameters:
rule-- Returns:
- true if the add success
-
removeType
boolean removeType(openllet.aterm.ATermAppl ind, openllet.aterm.ATermAppl c)
-
removeDomain
boolean removeDomain(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)Removes (if possible) the given property domain axiom from the KB and returntrueif removal was successful. See alsoaddDomain(ATerm, ATermAppl).- Parameters:
p- Property in domain axiomc- Class in domain axiom- Returns:
trueif axiom is removed,falseif removal failed
-
removeRange
boolean removeRange(openllet.aterm.ATerm p, openllet.aterm.ATermAppl c)Removes (if possible) the given property range axiom from the KB and returntrueif removal was successful. See alsoaddRange(ATerm, ATermAppl).- Parameters:
p- Property in range axiomc- Class or datatype in range axiom- Returns:
trueif axiom is removed,falseif removal failed
-
removePropertyValue
boolean removePropertyValue(openllet.aterm.ATermAppl p, openllet.aterm.ATermAppl i1, openllet.aterm.ATermAppl i2)
-
removeAxiom
boolean removeAxiom(openllet.aterm.ATermAppl axiom)
Removes (if possible) the given TBox axiom from the KB and returntrueif removal was successful.- Parameters:
axiom- TBox axiom to remove- Returns:
trueif axiom is removed,falseif removal failed
-
setTaxonomyBuilderProgressMonitor
void setTaxonomyBuilderProgressMonitor(ProgressMonitor progressMonitor)
-
getSuperClasses
default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getSuperClasses(openllet.aterm.ATermAppl c)
Returns all the superclasses (implicitly or explicitly defined) of class c. The class c itself is not included in the list. but all the other classes that are sameAs c are put into the list. Also note that the returned list will always have at least one element, that is TOP concept. By definition TOP concept is superclass of every concept. This function is equivalent to calling getSuperClasses(c, true).*** This function will first classify the whole ontology ***
- Parameters:
c- class whose superclasses are returned- Returns:
- A set of sets, where each set in the collection represents an equivalence class. The elements of the inner class are ATermAppl objects.
-
getDisjointClasses
default java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getDisjointClasses(openllet.aterm.ATermAppl c)
-
getComplements
java.util.Set<openllet.aterm.ATermAppl> getComplements(openllet.aterm.ATermAppl c)
-
getSames
java.util.Set<openllet.aterm.ATermAppl> getSames(openllet.aterm.ATermAppl name)
- Parameters:
name-- Returns:
- all the individuals asserted to be equal to the given individual but not the the individual itself.
-
getDifferents
java.util.Set<openllet.aterm.ATermAppl> getDifferents(openllet.aterm.ATermAppl name)
-
isDifferentFrom
boolean isDifferentFrom(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)
-
getDisjointProperties
java.util.Set<java.util.Set<openllet.aterm.ATermAppl>> getDisjointProperties(openllet.aterm.ATermAppl p)
-
isSameAs
boolean isSameAs(openllet.aterm.ATermAppl t1, openllet.aterm.ATermAppl t2)
-
copy
default KnowledgeBase copy()
Create a copy of this KB with a completely new ABox copy but pointing to the same RBox and TBox.- Returns:
- A copy of this KB
-
copy
KnowledgeBase copy(boolean emptyABox)
Create a copy of this KB. Depending on the value ofemptyABoxeither a completely new copy of ABox will be created or the new KB will have an empty ABox. IfemptyABoxparameter 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.- Parameters:
emptyABox- IftrueABox is not copied to the new KB- Returns:
- A copy of this KB
-
isChanged
boolean isChanged(KnowledgeBase.ChangeType change)
-
-