|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mindswap.pellet.taxonomy.Taxonomy<T>
public class Taxonomy<T>
Field Summary | |
---|---|
static java.util.logging.Logger |
log
|
static boolean |
TOP_DOWN
|
Constructor Summary | |
---|---|
Taxonomy()
|
|
Taxonomy(java.util.Collection<T> elements,
T top,
T bottom)
|
Method Summary | |
---|---|
void |
addEquivalentNode(T t,
TaxonomyNode<T> node)
|
void |
addEquivalents(T t,
java.util.Collection<T> eqs)
Add a collection of elements equivalent to an element already in the taxonomy. |
TaxonomyNode<T> |
addNode(java.util.Collection<T> equivalents,
java.util.Collection<T> sups,
java.util.Collection<T> subs,
boolean hidden)
Add a node with known supers and subs. |
TaxonomyNode<T> |
addNode(T t,
boolean hidden)
|
void |
addSuper(java.util.Collection<T> subs,
T sup)
Add a collection of elements as subs to an element |
void |
addSuper(T sub,
T sup)
Add a sub/super relation |
void |
addSupers(T sub,
java.util.Collection<T> sups)
Add a collection of supers to an element |
void |
assertValid()
|
java.util.List<T> |
computeLCA(java.util.List<T> list)
Given a list of concepts, find all the Least Common Ancestors (LCA). |
boolean |
contains(T t)
|
java.util.Iterator<java.util.Map.Entry<java.util.Set<T>,java.lang.Object>> |
datumEquivalentsPair(java.lang.Object key)
Iterate over nodes in taxonomy (no specific order)returning pair of equivalence set and datum associated with key for each. |
java.util.Iterator<java.lang.Object> |
depthFirstDatumOnly(T t,
java.lang.Object key)
Iterate down taxonomy in a depth first traversal, beginning with class c , returning only datum associated with key for each. |
java.util.Set<T> |
getAllEquivalents(T t)
Returns all the classes that are equivalent to class c. |
TaxonomyNode<T> |
getBottom()
|
java.util.Set<T> |
getClasses()
|
java.lang.Object |
getDatum(T t,
java.lang.Object key)
Get datum on taxonomy elements associated with key |
java.util.Set<T> |
getEquivalents(T t)
Returns all the classes that are equivalent to class c. |
java.util.Set<T> |
getFlattenedSubs(T t,
boolean direct)
As in getSubs(Object, boolean) except the return value is the
union of nested sets |
java.util.Set<T> |
getFlattenedSupers(T t,
boolean direct)
As in getSupers(Object, boolean) except the return value is the
union of nested sets |
TaxonomyNode<T> |
getNode(T t)
|
java.util.Collection<TaxonomyNode<T>> |
getNodes()
|
java.util.Set<java.util.Set<T>> |
getSubs(T t)
Returns all the (named) subclasses of class c. |
java.util.Set<java.util.Set<T>> |
getSubs(T t,
boolean direct)
Returns the (named) subclasses of class c. |
java.util.Set<java.util.Set<T>> |
getSupers(T t)
Returns all the superclasses (implicitly or explicitly defined) of class c. |
java.util.Set<java.util.Set<T>> |
getSupers(T t,
boolean direct)
Returns the (named) superclasses of class c. |
TaxonomyNode<T> |
getTop()
|
Bool |
isEquivalent(T x,
T y)
Checks if x is equivalent to y |
Bool |
isSubNodeOf(T x,
T y)
Checks if x has an ancestor y. |
void |
merge(TaxonomyNode<T> node1,
TaxonomyNode<T> node2)
|
java.lang.Object |
putDatum(T t,
java.lang.Object key,
java.lang.Object value)
Set a datum value associated with key on a taxonomy element |
void |
remove(T t)
Remove an element from the taxonomy. |
void |
removeCycles(TaxonomyNode<T> node)
Walk through the super nodes of the given node and when a cycle is detected merge all the nodes in that path |
java.lang.Object |
removeDatum(T t,
java.lang.Object key)
|
void |
resetSupers(T t,
java.util.Collection<T> supers)
Clear existing supers for an element and set to a new collection |
java.util.List<T> |
topologocialSort(boolean includeEquivalents)
Sort the nodes in the taxonomy using topological ordering starting from top to bottom. |
java.util.List<T> |
topologocialSort(boolean includeEquivalents,
java.util.Comparator<? super T> comparator)
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 |
---|
public static final java.util.logging.Logger log
public static final boolean TOP_DOWN
Constructor Detail |
---|
public Taxonomy()
public Taxonomy(java.util.Collection<T> elements, T top, T bottom)
Method Detail |
---|
public void addEquivalentNode(T t, TaxonomyNode<T> node)
public void addEquivalents(T t, java.util.Collection<T> eqs)
public TaxonomyNode<T> addNode(java.util.Collection<T> equivalents, java.util.Collection<T> sups, java.util.Collection<T> subs, boolean hidden)
equivalents
- a non-empty set of equivalent elements defining the node (one
of which becomes the label)sups
- collection of supers, all of which must already exist in the
taxonomysubs
- collection of subs, all of which must already exist in the
taxonomyhidden
- indicates hidden or not
public TaxonomyNode<T> addNode(T t, boolean hidden)
public void addSuper(java.util.Collection<T> subs, T sup)
public void addSuper(T sub, T sup)
public void addSupers(T sub, java.util.Collection<T> sups)
public void assertValid()
public java.util.List<T> computeLCA(java.util.List<T> list)
public boolean contains(T t)
public java.util.Iterator<java.util.Map.Entry<java.util.Set<T>,java.lang.Object>> datumEquivalentsPair(java.lang.Object key)
key
for each. Useful,
e.g., to collect equivalence sets matching some condition on the datum
(as in all classes which have a particular instances)
key
- key associated with datum returned
public java.util.Iterator<java.lang.Object> depthFirstDatumOnly(T t, java.lang.Object key)
c
, returning only datum associated with key
for each.
Useful, e.g., to collect datum values in a transitive closure (as in all
instances of a class).
t
- starting location in taxonomykey
- key associated with datum returned
public java.util.Set<T> getAllEquivalents(T t)
t
- class whose equivalent classes are found
public TaxonomyNode<T> getBottom()
public java.util.Set<T> getClasses()
public java.lang.Object getDatum(T t, java.lang.Object key)
key
t
- identifies the taxonomy elementkey
- identifies the specific datum
null
if none is associated with key
)public java.util.Set<T> getEquivalents(T t)
t
- class whose equivalent classes are found
public java.util.Set<T> getFlattenedSubs(T t, boolean direct)
getSubs(Object, boolean)
except the return value is the
union of nested sets
public java.util.Set<T> getFlattenedSupers(T t, boolean direct)
getSupers(Object, boolean)
except the return value is the
union of nested sets
public TaxonomyNode<T> getNode(T t)
public java.util.Collection<TaxonomyNode<T>> getNodes()
public java.util.Set<java.util.Set<T>> getSubs(T t)
t
- class whose subclasses are returned
public java.util.Set<java.util.Set<T>> getSubs(T t, boolean direct)
t
- Class whose subclasses are founddirect
- If true return only direct subclasses elese return all the
subclasses
public java.util.Set<java.util.Set<T>> getSupers(T t)
t
- class whose superclasses are returned
public java.util.Set<java.util.Set<T>> getSupers(T t, boolean direct)
t
- Class whose subclasses are founddirect
- If true return all the superclasses else return only direct
superclasses
public TaxonomyNode<T> getTop()
public Bool isEquivalent(T x, T y)
x
- Name of the first classy
- Name of the second class
public Bool isSubNodeOf(T x, T y)
x
- Name of the nodey
- Name of the ancestor ode
public void merge(TaxonomyNode<T> node1, TaxonomyNode<T> node2)
public java.lang.Object putDatum(T t, java.lang.Object key, java.lang.Object value)
key
on a taxonomy element
t
- identifies the taxonomy elementkey
- identifies the datumvalue
- the datum
null
if not setpublic void remove(T t)
public void removeCycles(TaxonomyNode<T> node)
public java.lang.Object removeDatum(T t, java.lang.Object key)
public void resetSupers(T t, java.util.Collection<T> supers)
public java.util.List<T> topologocialSort(boolean includeEquivalents)
includeEquivalents
- If false the equivalents in a node will be ignored and only
the name of the node will be added to the result
public java.util.List<T> topologocialSort(boolean includeEquivalents, java.util.Comparator<? super T> comparator)
includeEquivalents
- If false the equivalents in a node will be ignored and only
the name of the node will be added to the resultcomparator
- comparator to use sort the nodes at same level,
null
if no special ordering is needed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |