cz.cuni.versatile.api
Interface Taxonomy

All Superinterfaces:
ControlledVocabulary, OrderProperty, Property, RelationalProperty
All Known Subinterfaces:
TreeTaxonomy

public interface Taxonomy
extends ControlledVocabulary, OrderProperty

A taxonomy property. Taxonomy represents a hierarchical structure of concepts and sub-concepts (terms/sub-terms).

Author:
jgergic
See Also:
Vocabulary, Taxonomy, Thesaurus, Ontology and a Meta-Model, TreeTaxonomy

Method Summary
 java.util.Iterator getAncestorIterator(java.lang.Object entry, java.util.Comparator cmp)
          Iterate over the ancestor hierarchy bottom-up in a well-defined (deterministic) order.
 java.util.Set getAncestors(java.lang.Object entry)
          Returns ancestors of the context node.
 java.util.Set getChildren(java.lang.Object entry)
          Returns children of the context node.
 java.util.Set getDescendants(java.lang.Object entry)
          Returns descendants of the context node.
 java.lang.Object getLCA(java.lang.Object[] entries)
          Least Common Ancestor (LCA).
 java.util.Set getParents(java.lang.Object entry)
          Returns parents of the context node.
 java.lang.Object getRoot()
          Returns the root of the taxonomy.
 boolean isAncestor(java.lang.Object entry, java.lang.Object descendant)
          Ancestry check.
 boolean isChild(java.lang.Object entry, java.lang.Object parent)
          Child check.
 boolean isDescendant(java.lang.Object entry, java.lang.Object ancestor)
          Descendancy check.
 boolean isParent(java.lang.Object entry, java.lang.Object child)
          Parent check.
 boolean isRoot(java.lang.Object entry)
          Checks whether a given value is the taxonomy root.
 
Methods inherited from interface cz.cuni.versatile.api.ControlledVocabulary
getValueSet, iterator
 
Methods inherited from interface cz.cuni.versatile.api.Property
getLocalName, getNamespace, getSeparator, getType, getUniqueName
 
Methods inherited from interface cz.cuni.versatile.api.OrderProperty
comparable, comparator, isPartialOrder, isStrictOrder, isTotalOrder
 
Methods inherited from interface cz.cuni.versatile.api.RelationalProperty
contains, isAntisymmetric, isAsymetric, isIrreflexive, isReflexive, isSymmetric, isTransitive
 

Method Detail

getRoot

public java.lang.Object getRoot()
Returns the root of the taxonomy.

Returns:
root node of the taxonomy.

getParents

public java.util.Set getParents(java.lang.Object entry)
Returns parents of the context node.

Parameters:
entry - a context node to compare to
Returns:
a Set of parents of the context node

getChildren

public java.util.Set getChildren(java.lang.Object entry)
Returns children of the context node.

Parameters:
entry - a context node to compare to
Returns:
a Set of children of the context node

getAncestors

public java.util.Set getAncestors(java.lang.Object entry)
Returns ancestors of the context node.

Parameters:
entry - a context node to compare to
Returns:
a Set of ancestors of the context node

getDescendants

public java.util.Set getDescendants(java.lang.Object entry)
Returns descendants of the context node.

Parameters:
entry - a context node to compare to
Returns:
a Set of descendants of the context node

isRoot

public boolean isRoot(java.lang.Object entry)
Checks whether a given value is the taxonomy root. Equivalent to: getRoot().equals(entry)

Parameters:
entry - a context node to compare to
Returns:
true if a given node is the taxonomy root, false otherwise

isParent

public boolean isParent(java.lang.Object entry,
                        java.lang.Object child)
Parent check. (Parent-child relation.)

Parameters:
entry - a context node to compare to
child - a test node to compare to
Returns:
true if entry is a parent of child, false otherwise

isChild

public boolean isChild(java.lang.Object entry,
                       java.lang.Object parent)
Child check. (Child-parent relation.)

Parameters:
entry - a context node to compare to
parent - a test node to compare to
Returns:
true if entry is a child of parent, false otherwise

isAncestor

public boolean isAncestor(java.lang.Object entry,
                          java.lang.Object descendant)
Ancestry check. (A transitive closure of isParent relation.)

Parameters:
entry - a context node to compare to
descendant - a test node to compare to
Returns:
true if entry is an ancestor of descendant, false otherwise

isDescendant

public boolean isDescendant(java.lang.Object entry,
                            java.lang.Object ancestor)
Descendancy check. (A transitive closure of isChild relation.)

Parameters:
entry - a context node to compare to
ancestor - a test node to compare to
Returns:
true if entry is an descendant of ancestor, false otherwise

getLCA

public java.lang.Object getLCA(java.lang.Object[] entries)
Least Common Ancestor (LCA).
Remarks: In cases the entries are not actually related, it returns the root node of the taxonomy.

Parameters:
entries - an array of nodes
Returns:
returns a node which is the least common ancestor of all nodes on the entries list

getAncestorIterator

public java.util.Iterator getAncestorIterator(java.lang.Object entry,
                                              java.util.Comparator cmp)
Iterate over the ancestor hierarchy bottom-up in a well-defined (deterministic) order. This method can be used to implement hierarchical defaulting (constraint relaxing). To implement this feature we apply two order relations on the set of taxonomy values:
  1. the partial order implied by the taxonomy hierarchy (the primary order)
  2. the total order defined by the additional Comparator (the secondary order)
The secondary order applies only in cases two nodes are not comparable to each other using the primary order, this happens when a node has more than one parent. This method allows to traverse the taxonomy hierarchy in a well-defined (deterministic) way.
Remarks: the entry node is not included.

Parameters:
entry - a context node to start from
cmp - an comparator to define the secondary order.
Returns:
bottom-up taxonomy Iterator
See Also:
RelationalOperatorsRegistry.getTotalOrder(String), OrderProperty.comparator()