java.lang.Object
org.apache.jena.ontapi.impl.HierarchySupport
Helper class to handle resource hierarchy.
-
Constructor Summary
Constructors -
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) Answerstrueif the specifiedtestnode is in the closure of the specifiedrootnodesstatic <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 usinglistChildrenfunction, 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) Answerstrueif the specifiedtestnode is in the closure of the specifiedrootnodes- Type Parameters:
X- any subtype ofOntObject- Parameters:
root- the root of treetest- object to testlistChildren- aFunctionthat providesStreamof child nodes for the given parent nodedirect- iftrue, only return the direct (adjacent) valuesuseBuiltinHierarchySupport- iftruecollect 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 usinglistChildrenfunction, which provides child nodes.- Type Parameters:
X- any subtype ofOntObject- Parameters:
root- the root of treelistChildren- aFunctionthat providesStreamof child nodes for the given parent nodedirect- iftrue, only return the direct (adjacent) valuesuseBuiltinHierarchySupport- iftruecollect a nodes' tree by traversing the graph, this parameter is used when there is no reasoner attached to the graph- Returns:
- a
Streamof 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:
SetofXincluding roots
-
directNodesAsStream
-
hasDirectNode
-
directNodesAsSetStandard
-
directNodesAsSetWithBuiltinInf
-
hasDirectNodeStandard
-
hasDirectNodeWithBuiltinInf
-