Class HierarchySupport

java.lang.Object
org.apache.jena.ontapi.impl.HierarchySupport

public final class HierarchySupport extends Object
Helper class to handle resource hierarchy.
  • Constructor Details

    • HierarchySupport

      public HierarchySupport()
  • Method Details

    • contains

      public static <X extends OntObject> boolean contains(X root, X test, Function<X,Stream<X>> listChildren, boolean direct, boolean useBuiltinHierarchySupport)
      Answers true if the specified test node is in the closure of the specified root nodes
      Type Parameters:
      X - any subtype of OntObject
      Parameters:
      root - the root of tree
      test - object to test
      listChildren - a Function that provides Stream of child nodes for the given parent node
      direct - if true, only return the direct (adjacent) values
      useBuiltinHierarchySupport - if true collect a nodes' tree by traversing the graph, this parameter is used when there is no reasoner attached to the graph
      Returns:
      boolean
    • treeNodes

      public static <X extends OntObject> Stream<X> treeNodes(X root, Function<X,Stream<X>> listChildren, boolean direct, boolean useBuiltinHierarchySupport)
      Lists tree nodes for the given root using listChildren function, which provides child nodes.
      Type Parameters:
      X - any subtype of OntObject
      Parameters:
      root - the root of tree
      listChildren - a Function that provides Stream of child nodes for the given parent node
      direct - if true, only return the direct (adjacent) values
      useBuiltinHierarchySupport - if true collect a nodes' tree by traversing the graph, this parameter is used when there is no reasoner attached to the graph
      Returns:
      a Stream of tree nodes
    • allTreeNodesSetInclusive

      public static <X extends org.apache.jena.rdf.model.Resource> Set<X> allTreeNodesSetInclusive(Supplier<Stream<X>> listRoots, Function<X,Stream<X>> listChildren)
      Returns a forest (collection of indirect node trees) for the given roots.
      Type Parameters:
      X - any subtype of Resource
      Parameters:
      listRoots - Supplier<Stream<X>> roots provider
      listChildren - Function<X, Stream<X>> called for each root
      Returns:
      Set of X including roots
    • directNodesAsStream

      public static <X extends org.apache.jena.rdf.model.Resource> Stream<X> directNodesAsStream(X object, boolean useBuiltinHierarchySupport, Function<X,Stream<X>> listChildren)
    • hasDirectNode

      public static <X extends org.apache.jena.rdf.model.Resource> boolean hasDirectNode(X object, X test, boolean useBuiltinHierarchySupport, Function<X,Stream<X>> listChildren)
    • directNodesAsSetStandard

      public static <X extends org.apache.jena.rdf.model.Resource> Set<X> directNodesAsSetStandard(X root, Function<X,Stream<X>> listChildren)
    • directNodesAsSetWithBuiltinInf

      public static <X extends org.apache.jena.rdf.model.Resource> Set<X> directNodesAsSetWithBuiltinInf(X root, Function<X,Stream<X>> listChildren)
    • hasDirectNodeStandard

      public static <X extends org.apache.jena.rdf.model.Resource> boolean hasDirectNodeStandard(X root, X test, Function<X,Stream<X>> listChildren)
    • hasDirectNodeWithBuiltinInf

      public static <X extends org.apache.jena.rdf.model.Resource> boolean hasDirectNodeWithBuiltinInf(X root, X test, Function<X,Stream<X>> listChildren)