Package openllet.core.taxonomy
Class TaxonomyImpl<T>
- java.lang.Object
-
- openllet.core.taxonomy.TaxonomyImpl<T>
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.logging.Logger_logger
-
Constructor Summary
Constructors Constructor Description TaxonomyImpl()TaxonomyImpl(java.util.Collection<T> elements, T top, T bottom)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator<java.util.Map.Entry<java.util.Set<T>,java.lang.Object>>datumEquivalentsPair(TaxonomyUtils.TaxonomyKey key)Iterate over nodes in taxonomy (no specific order)returning pair of equivalence set and datum associated withkeyfor each.java.util.Iterator<java.lang.Object>depthFirstDatumOnly(T t, TaxonomyUtils.TaxonomyKey key)Iterate down taxonomy in a _depth first traversal, beginning with classc, returning only datum associated with_keyfor each.TaxonomyNode<T>getBottomNode()shortgetDepth()java.util.Set<T>getFlattenedSubs(T t, boolean direct)As ingetSubs(Object, boolean)except the return _value is the union of nested setsjava.util.Set<T>getFlattenedSupers(T t, boolean direct)As ingetSupers(Object, boolean)except the return _value is the union of nested setsjava.util.logging.LoggergetLogger()java.util.Map<T,TaxonomyNode<T>>getNodes()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()TaxonomyNode<T>getTopNode()intgetTotalBranching()voidmerge(TaxonomyNode<T> node1, TaxonomyNode<T> node2)voidremoveCycles(TaxonomyNode<T> node)Walk through the super _nodes of the given _node and when a cycle is detected merge all the _nodes in that pathjava.lang.ObjectremoveDatum(T t, TaxonomyUtils.TaxonomyKey key)voidsetBottomNode(TaxonomyNode<T> bottomNode)voidsetDepth(short depth)voidsetNodes(java.util.Map<T,TaxonomyNode<T>> nodes)voidsetTopNode(TaxonomyNode<T> topNode)voidsetTotalBranching(int totalBranching)java.util.stream.Stream<java.util.Set<T>>supers(T t, boolean direct)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface openllet.core.taxonomy.Taxonomy
addEquivalentNode, addEquivalents, addNode, addNode, addSuper, addSupers, assertValid, computeLCA, contains, getAllEquivalents, getClasses, getDatum, getEquivalents, getNode, getSubs, isEquivalent, isSubNodeOf, putDatum, remove, resetSupers, topologocialSort, topologocialSort
-
-
-
-
Method Detail
-
getLogger
public java.util.logging.Logger getLogger()
- Specified by:
getLoggerin interfaceopenllet.shared.tools.Logging
-
getBottomNode
public TaxonomyNode<T> getBottomNode()
- Specified by:
getBottomNodein interfaceTaxonomy<T>
-
setBottomNode
public void setBottomNode(TaxonomyNode<T> bottomNode)
- Specified by:
setBottomNodein interfaceTaxonomy<T>
-
getTopNode
public TaxonomyNode<T> getTopNode()
- Specified by:
getTopNodein interfaceTaxonomy<T>
-
setTopNode
public void setTopNode(TaxonomyNode<T> topNode)
- Specified by:
setTopNodein interfaceTaxonomy<T>
-
getTotalBranching
public int getTotalBranching()
- Specified by:
getTotalBranchingin interfaceTaxonomy<T>
-
setTotalBranching
public void setTotalBranching(int totalBranching)
- Specified by:
setTotalBranchingin interfaceTaxonomy<T>
-
getNodes
public java.util.Map<T,TaxonomyNode<T>> getNodes()
-
setNodes
public void setNodes(java.util.Map<T,TaxonomyNode<T>> nodes)
-
datumEquivalentsPair
public java.util.Iterator<java.util.Map.Entry<java.util.Set<T>,java.lang.Object>> datumEquivalentsPair(TaxonomyUtils.TaxonomyKey key)
Iterate over nodes in taxonomy (no specific order)returning pair of equivalence set and datum associated withkeyfor each. Useful, e.g., to collect equivalence sets matching some condition on the datum (as in all classes which have a particular instances)- Specified by:
datumEquivalentsPairin interfaceTaxonomy<T>- Parameters:
key- key associated with datum returned- Returns:
- iterator over equivalence set, datum pairs
-
depthFirstDatumOnly
public java.util.Iterator<java.lang.Object> depthFirstDatumOnly(T t, TaxonomyUtils.TaxonomyKey key)
Iterate down taxonomy in a _depth first traversal, beginning with classc, returning only datum associated with_keyfor each. Useful, e.g., to collect datum values in a transitive closure (as in all instances of a class).- Specified by:
depthFirstDatumOnlyin interfaceTaxonomy<T>- Parameters:
t- starting location in taxonomykey- _key associated with datum returned- Returns:
- datum iterator
-
getFlattenedSubs
public java.util.Set<T> getFlattenedSubs(T t, boolean direct)
As ingetSubs(Object, boolean)except the return _value is the union of nested sets- Specified by:
getFlattenedSubsin interfaceTaxonomy<T>- Returns:
- a union of subs
-
getFlattenedSupers
public java.util.Set<T> getFlattenedSupers(T t, boolean direct)
As ingetSupers(Object, boolean)except the return _value is the union of nested sets- Specified by:
getFlattenedSupersin interfaceTaxonomy<T>- Returns:
- a union of supers
-
getSubs
public java.util.Set<java.util.Set<T>> getSubs(T t, 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- d is subclass of c
- there is no other class x different from c and d such that x is subclass of c and d is subclass of x
- Specified by:
getSubsin interfaceTaxonomy<T>- Parameters:
t- Class whose subclasses are founddirect- 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<T>> getSupers(T t)
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).
-
getSupers
public java.util.Set<java.util.Set<T>> getSupers(T t, 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- d is superclass of c
- there is no other class x such that x is superclass of c and d is superclass of x
- Specified by:
getSupersin interfaceTaxonomy<T>- Parameters:
t- Class whose subclasses are founddirect- 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.
-
getTop
public TaxonomyNode<T> getTop()
-
merge
public void merge(TaxonomyNode<T> node1, TaxonomyNode<T> node2)
-
removeCycles
public 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- Specified by:
removeCyclesin interfaceTaxonomy<T>
-
removeDatum
public java.lang.Object removeDatum(T t, TaxonomyUtils.TaxonomyKey key)
- Specified by:
removeDatumin interfaceTaxonomy<T>
-
-