Package openllet.core

Interface KnowledgeBase

    • Method Detail

      • clear

        void clear()
      • 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()
      • 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.
      • 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.
      • 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 return Boolean.TRUE, Boolean.FALSE, or null (unknown). If the null value is returned hasPropertyValue function needs to be called to get the answer.
        Parameters:
        s - Subject
        p - Predicate
        o - Object (null can 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 datatype
        datarange - 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 return true if removal was successful. See also addDomain(ATerm, ATermAppl).
        Parameters:
        p - Property in domain axiom
        c - Class in domain axiom
        Returns:
        true if axiom is removed, false if 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 return true if removal was successful. See also addRange(ATerm, ATermAppl).
        Parameters:
        p - Property in range axiom
        c - Class or datatype in range axiom
        Returns:
        true if axiom is removed, false if 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 return true if removal was successful.
        Parameters:
        axiom - TBox axiom to remove
        Returns:
        true if axiom is removed, false if 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 of emptyABox either a completely new copy of ABox will be created or the new KB will have an empty ABox. If emptyABox 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.
        Parameters:
        emptyABox - If true ABox is not copied to the new KB
        Returns:
        A copy of this KB