java.lang.Object
org.apache.jena.ontapi.impl.HierarchySupport
Helper class to handle resource hierarchy.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <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.static <X extends OntObject>
booleancontains
(X root, X test, Function<X, Stream<X>> listChildren, boolean direct, boolean useBuiltinHierarchySupport) Answerstrue
if the specifiedtest
node is in the closure of the specifiedroot
nodesstatic <X extends org.apache.jena.rdf.model.Resource>
Set<X>directNodesAsSetStandard
(X root, Function<X, Stream<X>> listChildren) static <X extends org.apache.jena.rdf.model.Resource>
Set<X>directNodesAsSetWithBuiltinInf
(X root, Function<X, Stream<X>> listChildren) static <X extends org.apache.jena.rdf.model.Resource>
Stream<X>directNodesAsStream
(X object, boolean useBuiltinHierarchySupport, Function<X, Stream<X>> listChildren) static <X extends org.apache.jena.rdf.model.Resource>
booleanhasDirectNode
(X object, X test, boolean useBuiltinHierarchySupport, Function<X, Stream<X>> listChildren) static <X extends org.apache.jena.rdf.model.Resource>
booleanhasDirectNodeStandard
(X root, X test, Function<X, Stream<X>> listChildren) static <X extends org.apache.jena.rdf.model.Resource>
booleanhasDirectNodeWithBuiltinInf
(X root, X test, Function<X, Stream<X>> listChildren) treeNodes
(X root, Function<X, Stream<X>> listChildren, boolean direct, boolean useBuiltinHierarchySupport) Lists tree nodes for the given root usinglistChildren
function, which provides child nodes.
-
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) Answerstrue
if the specifiedtest
node is in the closure of the specifiedroot
nodes- Type Parameters:
X
- any subtype ofOntObject
- Parameters:
root
- the root of treetest
- object to testlistChildren
- aFunction
that providesStream
of child nodes for the given parent nodedirect
- iftrue
, only return the direct (adjacent) valuesuseBuiltinHierarchySupport
- iftrue
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 usinglistChildren
function, which provides child nodes.- Type Parameters:
X
- any subtype ofOntObject
- Parameters:
root
- the root of treelistChildren
- aFunction
that providesStream
of child nodes for the given parent nodedirect
- iftrue
, only return the direct (adjacent) valuesuseBuiltinHierarchySupport
- iftrue
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 ofResource
- Parameters:
listRoots
-Supplier<Stream<X>>
roots providerlistChildren
-Function<X, Stream<X>>
called for each root- Returns:
Set
ofX
including roots
-
directNodesAsStream
-
hasDirectNode
-
directNodesAsSetStandard
-
directNodesAsSetWithBuiltinInf
-
hasDirectNodeStandard
-
hasDirectNodeWithBuiltinInf
-