Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mindswap.pellet.taxonomy
Class Taxonomy

    java.lang.Object
      org.mindswap.pellet.taxonomy.Taxonomy

    public class Taxonomy

extends java.lang.Object

Author:
  Evren Sirin

Field Summary
`static boolean` | `BOTTOM_UP`
`static boolean` | `DEBUG` Deprecated. Edit log4j.properties instead to turn on debugging
`static boolean` | `DETAILED_DEBUG` Deprecated. Edit log4j.properties instead to turn on debugging
`static org.apache.commons.logging.Log` | `log`
`static boolean` | `SUB`
`static boolean` | `SUPER`
`static boolean` | `TOP_DOWN`

Constructor Summary
`Taxonomy()`
`Taxonomy(boolean hideTopBottom)`
`Taxonomy(java.util.Collection<aterm.ATermAppl> classes)`
`Taxonomy(java.util.Collection<aterm.ATermAppl> classes, boolean hideTopBottom)`

Method Summary
`void` | `addEquivalentNode(aterm.ATermAppl c, TaxonomyNode node)`
`TaxonomyNode` | `addNode(aterm.ATermAppl c)`
`void` | `assertValid()`
`java.lang.Object` | `clone()`
`int` | `compareTaxonomy(Taxonomy tax)`
`java.util.List` | `computeLCA(aterm.ATermList list)` Given a list of concepts, find all the Least Common Ancestors (LCA).
`boolean` | `contains(aterm.ATermAppl c)`
`java.util.Set<aterm.ATermAppl>` | `getAllEquivalents(aterm.ATermAppl c)` Returns all the classes that are equivalent to class c.
`TaxonomyNode` | `getBottom()`
`java.util.Set<aterm.ATermAppl>` | `getClasses()`
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getDirectTypes(aterm.ATermAppl ind)` Get all the direct classes individual belongs to.
`java.util.Set<aterm.ATermAppl>` | `getEquivalents(aterm.ATermAppl c)` Returns all the classes that are equivalent to class c.
`java.util.Set<aterm.ATermAppl>` | `getFlattenedSubSupers(aterm.ATermAppl c, boolean direct, boolean subOrSuper)`
`java.util.Set<aterm.ATermAppl>` | `getInstances(aterm.ATermAppl c)` Returns all the instances of concept c.
`java.util.Set<aterm.ATermAppl>` | `getInstances(aterm.ATermAppl c, boolean direct)` Returns the instances of class c.
`TaxonomyNode` | `getNode(aterm.ATermAppl c)`
`java.util.Collection<TaxonomyNode>` | `getNodes()`
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getSubs(aterm.ATermAppl c)` Returns all the (named) subclasses of class c.
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getSubs(aterm.ATermAppl c, boolean direct)` Returns the (named) subclasses of class c.
`java.util.Set` | `getSubs(aterm.ATermAppl c, boolean direct, boolean flat)`
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getSubSupers(aterm.ATermAppl c, boolean direct, boolean subOrSuper)`
`java.util.Set` | `getSubSupers(aterm.ATermAppl c, boolean direct, boolean subOrSuper, boolean flat)`
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getSuperExplanations(aterm.ATermAppl sub, aterm.ATermAppl sup)` Get the set of explanations associated with a subsumption relationship
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getSupers(aterm.ATermAppl c)` Returns all the superclasses (implicitly or explicitly defined) of class c.
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getSupers(aterm.ATermAppl c, boolean direct)` Returns the (named) superclasses of class c.
`java.util.Set` | `getSupers(aterm.ATermAppl c, boolean direct, boolean flat)`
`TaxonomyNode` | `getTop()`
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getTypes(aterm.ATermAppl ind)` Get all the named classes individual belongs to.
`java.util.Set<java.util.Set<aterm.ATermAppl>>` | `getTypes(aterm.ATermAppl ind, boolean direct)` Returns the classes individual belongs to.
`Bool` | `isEquivalent(aterm.ATermAppl x, aterm.ATermAppl y)` Checks if x is equivalent to y
`boolean` | `isHideAnonTerms()`
`Bool` | `isSubNodeOf(aterm.ATermAppl x, aterm.ATermAppl y)` Checks if x has an ancestor y.
`boolean` | `isType(aterm.ATermAppl ind, aterm.ATermAppl c)`
`Taxonomy` | `merge(Taxonomy tax)`
`void` | `merge(TaxonomyNode node1, TaxonomyNode node2)`
`void` | `print()`
`void` | `print(OutputFormatter out)`
`void` | `removeCycles(TaxonomyNode node)` Walk through the super nodes of the given node and when a cycle is detected merge all the nodes in that path
`void` | `removeNode(TaxonomyNode node)`
`void` | `setHideAnonTerms(boolean hideAnonTerms)`
`java.util.List<aterm.ATermAppl>` | `topologocialSort(boolean includeEquivalents)` Sort the nodes in the taxonomy using topological ordering starting from top to bottom.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEBUG

    public static boolean DEBUG

  Deprecated. Edit log4j.properties instead to turn on debugging

### DETAILED_DEBUG

    public static boolean DETAILED_DEBUG

  Deprecated. Edit log4j.properties instead to turn on debugging

### log

    public static final org.apache.commons.logging.Log log

### SUB

    public static final boolean SUB

See Also:
  Constant Field Values

### SUPER

    public static final boolean SUPER

See Also:
  Constant Field Values

### TOP_DOWN

    public static final boolean TOP_DOWN

See Also:
  Constant Field Values

### BOTTOM_UP

    public static final boolean BOTTOM_UP

See Also:
  Constant Field Values

Constructor Detail

### Taxonomy

    public Taxonomy()

### Taxonomy

    public Taxonomy(java.util.Collection<aterm.ATermAppl> classes)

### Taxonomy

    public Taxonomy(boolean hideTopBottom)

### Taxonomy

    public Taxonomy(java.util.Collection<aterm.ATermAppl> classes,
                    boolean hideTopBottom)

Method Detail

### assertValid

    public void assertValid()

### getBottom

    public TaxonomyNode getBottom()

### getTop

    public TaxonomyNode getTop()

### getClasses

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

### getNodes

    public java.util.Collection<TaxonomyNode> getNodes()

### contains

    public boolean contains(aterm.ATermAppl c)

### addNode

    public TaxonomyNode addNode(aterm.ATermAppl c)

### addEquivalentNode

    public void addEquivalentNode(aterm.ATermAppl c,
                                  TaxonomyNode node)

### getNode

    public TaxonomyNode getNode(aterm.ATermAppl c)

### removeNode

    public void removeNode(TaxonomyNode node)

### getInstances

    public java.util.Set<aterm.ATermAppl> getInstances(aterm.ATermAppl c)

  Returns all the instances of concept c. If TOP concept is used every individual in the knowledge base will be returned

  Parameters:
    `c` - Class whose instances are returned
  Returns:
    A set of ATerm objects

### getInstances

    public java.util.Set<aterm.ATermAppl> getInstances(aterm.ATermAppl c,
                                                       boolean direct)

  Returns the instances of class c. Depending on the second parameter the resulting list will include all or only the direct instances, i.e. if the individual is not type of any other class that is a subclass of c.

  Parameters:
    `c` - Class whose instances are found
    `direct` - If true return only the direct instances, otherwise return all the instances
  Returns:
    A set of ATerm objects

### isType

    public boolean isType(aterm.ATermAppl ind,
                          aterm.ATermAppl c)

### getSuperExplanations

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getSuperExplanations(aterm.ATermAppl sub,
                                                                              aterm.ATermAppl sup)

  Get the set of explanations associated with a subsumption relationship

  Parameters:
    `sub` - Subclass ( sub [= sup )
    `sup` - Superclass
  Returns:
    Set of explanations, null if none are present or sub/sup not in taxonomy

### isEquivalent

    public Bool isEquivalent(aterm.ATermAppl x,
                             aterm.ATermAppl y)

  Checks if x is equivalent to y

  Parameters:
    `x` - Name of the first class
    `y` - Name of the second class
  Returns:
    true if x is equivalent to y

### isSubNodeOf

    public Bool isSubNodeOf(aterm.ATermAppl x,
                            aterm.ATermAppl y)

  Checks if x has an ancestor y.

  Parameters:
    `x` - Name of the node
    `y` - Name of the ancestor ode
  Returns:
    true if x has an ancestor y

### getSubs

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getSubs(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).

  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.

### getSubs

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getSubs(aterm.ATermAppl c,
                                                                 boolean direct)

  Returns the (named) subclasses of class c. Depending on the second parameter the resulting list will include either all subclasses or only the direct subclasses. A class d is a direct subclass of c iff
  1. d is subclass of c
  2. there is no other class x different from c and d such that x is subclass of c and d is subclass of x
  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. The list will either include one other concept from the hierarchy or the BOTTOM concept if no other class is subsumed by c. By definition BOTTOM concept is subclass of every concept.

  Parameters:
    `c` - Class whose subclasses are found
    `direct` - If true return only direct subclasses elese return all the subclasses
  Returns:
    A set of sets, where each set in the collection represents an equivalence class. The elements of the inner class are ATermAppl objects.

### getSupers

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getSupers(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).

  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.

### getSupers

    public java.util.Set getSupers(aterm.ATermAppl c,
                                   boolean direct,
                                   boolean flat)

### getSubs

    public java.util.Set getSubs(aterm.ATermAppl c,
                                 boolean direct,
                                 boolean flat)

### getSupers

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getSupers(aterm.ATermAppl c,
                                                                   boolean direct)

  Returns the (named) superclasses of class c. Depending on the second parameter the resulting list will include either all or only the direct superclasses. A class d is a direct superclass of c iff
  1. d is superclass of c
  2. there is no other class x such that x is superclass of c and d is superclass of x
  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. The list will either include one other concept from the hierarchy or the TOP concept if no other class subsumes c. By definition TOP concept is superclass of every concept.

  Parameters:
    `c` - Class whose subclasses are found
    `direct` - If true return all the superclasses else return only direct superclasses
  Returns:
    A set of sets, where each set in the collection represents an equivalence class. The elements of the inner class are ATermAppl objects.

### getSubSupers

    public java.util.Set getSubSupers(aterm.ATermAppl c,
                                      boolean direct,
                                      boolean subOrSuper,
                                      boolean flat)

### getSubSupers

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getSubSupers(aterm.ATermAppl c,
                                                                      boolean direct,
                                                                      boolean subOrSuper)

### getFlattenedSubSupers

    public java.util.Set<aterm.ATermAppl> getFlattenedSubSupers(aterm.ATermAppl c,
                                                                boolean direct,
                                                                boolean subOrSuper)

### getEquivalents

    public java.util.Set<aterm.ATermAppl> getEquivalents(aterm.ATermAppl c)

  Returns all the classes that are equivalent to class c. Class c itself is NOT included in the result.

  Parameters:
    `c` - class whose equivalent classes are found
  Returns:
    A set of ATerm objects

### getAllEquivalents

    public java.util.Set<aterm.ATermAppl> getAllEquivalents(aterm.ATermAppl c)

  Returns all the classes that are equivalent to class c. Class c itself is included in the result.

  Parameters:
    `c` - class whose equivalent classes are found
  Returns:
    A set of ATerm objects

### getDirectTypes

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getDirectTypes(aterm.ATermAppl ind)

  Get all the direct classes individual belongs to.

  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.

### getTypes

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getTypes(aterm.ATermAppl ind)

  Get all the named classes individual belongs to. The result is returned as a set of sets where each

  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.

### getTypes

    public java.util.Set<java.util.Set<aterm.ATermAppl>> getTypes(aterm.ATermAppl ind,
                                                                  boolean direct)

  Returns the classes individual belongs to. Depending on the second parameter the resulting list will include either all types or only the direct types.

  Parameters:
    `ind` - An individual name
    `direct` - If true return only the direct types, otherwise return all types
  Returns:
    A set of sets, where each set in the collection represents an equivalence class. The elements of the inner class are ATermAppl objects.

### topologocialSort

    public java.util.List<aterm.ATermAppl> topologocialSort(boolean includeEquivalents)

  Sort the nodes in the taxonomy using topological ordering starting from top to bottom.

  Parameters:
    `includeEquivalents` - If false the equivalents in a node will be ignored and only the name of the node will be added to the result
  Returns:
    List of node names sorted in topological ordering

### removeCycles

    public void removeCycles(TaxonomyNode node)

  Walk through the super nodes of the given node and when a cycle is detected merge all the nodes in that path

  Parameters:
    `node` -

### merge

    public void merge(TaxonomyNode node1,
                      TaxonomyNode node2)

### computeLCA

    public java.util.List computeLCA(aterm.ATermList list)

  Given a list of concepts, find all the Least Common Ancestors (LCA). Note that a taxonomy is DAG not a tree so we do not have a unique LCA but a set of LCA. The function might return a singleton list that contains TOP if there are no lower level nodes that satisfy the LCA condition.

  Parameters:
    `names` -
  Returns:

### print

    public void print()

### print

    public void print(OutputFormatter out)

### merge

    public Taxonomy merge(Taxonomy tax)

### compareTaxonomy

    public int compareTaxonomy(Taxonomy tax)

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `java.lang.Object`

### isHideAnonTerms

    public boolean isHideAnonTerms()

### setHideAnonTerms

    public void setHideAnonTerms(boolean hideAnonTerms)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Evren Sirin. All Rights Reserved.