java.lang.Object
org.apache.jena.ontapi.utils.Graphs
Helper to work with
Jena Graph
(generally with our UnionGraph
) and with its related objects:
Triple
and Node
.- See Also:
-
GraphUtil
GraphUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.shared.PrefixMapping
collectPrefixes
(Iterable<org.apache.jena.graph.Graph> graphs) Collects a prefixes' library from the collection of the graphs.static org.apache.jena.graph.Node
createNode
(String iri) Makes a fresh node instance according to the given iri.static org.apache.jena.graph.Node
createOntologyHeaderNode
(org.apache.jena.graph.Graph graph, String uriOrNull) Creates a new ontology header (uriOrBlank rdf:type owl:Ontology
) if it is not present in the graph.static Stream<org.apache.jena.graph.Graph>
dataGraphs
(org.apache.jena.graph.Graph graph) Lists all indivisible graphs extracted from the composite or wrapper graph including the base as flat stream of non-composite (primitive) graphs.static boolean
dependsOn
(org.apache.jena.graph.Graph left, org.apache.jena.graph.Graph right) Answerstrue
if the left graph depends on the right one.static Stream<org.apache.jena.graph.Graph>
directSubGraphs
(org.apache.jena.graph.Graph graph) Extracts and lists all top-level sub-graphs from the given composite graph-container, that is allowed to be eitherUnionGraph
orPolyadic
orDyadic
.static Optional<org.apache.jena.graph.Node>
findOntologyNameNode
(org.apache.jena.graph.Graph graph) Returns OWL Ontology ID (either object inany owl:versionIRI <uri>
statement or subject in<uri> rdf:type owl:Ontology
statement).static Optional<org.apache.jena.graph.Node>
findOntologyNameNode
(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns OWL Ontology ID (either object inany owl:versionIRI <uri>
statement or subject in<uri> rdf:type owl:Ontology
statement).static Optional<org.apache.jena.graph.Node>
findVersionIRI
(org.apache.jena.graph.Graph graph, org.apache.jena.graph.Node header) static Stream<UnionGraph>
flatHierarchy
(UnionGraph graph) Lists all graphs in the tree that is specified asUnionGraph
.static Stream<org.apache.jena.graph.Graph>
flatTree
(org.apache.jena.graph.Graph graph, Function<org.apache.jena.graph.Graph, org.apache.jena.graph.Graph> getBase, Function<org.apache.jena.graph.Graph, Stream<org.apache.jena.graph.Graph>> listSubGraphs) Lists all indivisible data graphs extracted from the composite or wrapper graph;getImports
(org.apache.jena.graph.Graph graph) Returns all uri-objects from the_:x owl:imports _:uri
statements.getImports
(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns all uri-objects from the_:x owl:imports _:uri
statements.static org.apache.jena.graph.Graph
getPrimary
(org.apache.jena.graph.Graph graph) Gets the base (primary) base graph from a composite or wrapper graph if it is possible otherwise returns the same graph.static int
getSpliteratorCharacteristics
(org.apache.jena.graph.Graph graph) Returns aSpliterator
characteristics based on graph analysis.static boolean
hasImports
(org.apache.jena.graph.Graph graph, String uri) Answerstrue
if the given uri is present in the import closure.static boolean
hasOneOfType
(org.apache.jena.graph.Node node, org.apache.jena.graph.Graph graph, Set<org.apache.jena.graph.Node> types) Answerstrue
, if there is a declarationnode rdf:type $type
, where $type is one of the specified types.static org.apache.jena.graph.Triple
invertTriple
(org.apache.jena.graph.Triple triple) Inverts the given triple so that the new triple has the same subject as the given object, and the same object as the given subject.static boolean
isDistinct
(org.apache.jena.graph.Graph graph) Answerstrue
iff the given graph is distinct.static boolean
isGraphInf
(org.apache.jena.graph.Graph graph) Answerstrue
if the graph specified isInfGraph
.static boolean
isGraphMem
(org.apache.jena.graph.Graph graph) Answerstrue
if the graph specified isGraphMem
.static boolean
isNamedTriple
(org.apache.jena.graph.Triple triple) Answerstrue
if all parts of the given RDF triple are URIs (i.e., not blank nodes or literals).static boolean
isOntGraph
(org.apache.jena.graph.Graph graph) Checks whether the specified graph is ontological, that is, has an OWL header.static boolean
isOntUnionGraph
(UnionGraph graph, boolean allowMultipleOntologyHeaders) Checks whether the specified graph is ontological, that is, has a hierarchy synchronized with theowl:imports
&owl:Ontology
relationships.static boolean
isSameBase
(org.apache.jena.graph.Graph left, org.apache.jena.graph.Graph right) Answerstrue
iff the two input graphs are based on the same primitive graph.static boolean
isSized
(org.apache.jena.graph.Graph graph) Answerstrue
iff the givengraph
has known size and therefore the operationgraph.size()
does not take significant efforts.static boolean
isWrapper
(org.apache.jena.graph.Graph g) Answerstrue
if the given graph can be unwrapped.static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node>
listAllNodes
(org.apache.jena.graph.Graph graph) Lists all unique nodes in the given graph.static org.apache.jena.util.iterator.ExtendedIterator<String>
listImports
(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns anExtendedIterator
over all URIs from the_:x owl:imports _:uri
statements.static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Triple>
listOntHeaderTriples
(org.apache.jena.graph.Graph graph) Lists all triples which related to ontology header somehow.static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node>
listOntologyNodes
(org.apache.jena.graph.Graph graph) Lists all subjects fromuriOrBlankNode rdf:type owl:Ontology
statements.static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node>
listSubjects
(org.apache.jena.graph.Graph graph) Lists all unique subject nodes in the given graph.static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node>
listSubjectsAndObjects
(org.apache.jena.graph.Graph graph) Lists all unique nodes in the given graph, which are used in a subject or an object positions.static org.apache.jena.graph.Node
makeOntologyHeaderNode
(org.apache.jena.graph.Graph graph, org.apache.jena.graph.Node newOntology) Creates (if absents) a new ontology header (node rdf:type owl:Ontology
) for the specified node, removing existing ontology headers (if any) and moving their contents to the new header.static UnionGraph
makeOntUnion
(org.apache.jena.graph.Graph graph, Collection<org.apache.jena.graph.Graph> repository, Function<org.apache.jena.graph.Graph, UnionGraph> wrapAsUnion) Assembles the hierarchical ontologyUnion Graph
from the specified components in accordance with theirowl:imports
andowl:Ontology
declarations.static UnionGraph
makeOntUnionFrom
(org.apache.jena.graph.Graph graph, Function<org.apache.jena.graph.Graph, UnionGraph> wrapAsUnion) Creates an ontologyUnionGraph
from the specifiedgraph
of arbitrary nature.static Optional<org.apache.jena.graph.Node>
ontologyNode
(org.apache.jena.graph.Graph graph) Returns the primary Ontology Node (the subject in the_:x rdf:type owl:Ontology
statement) within the given graph if it can be uniquely determined.static Optional<org.apache.jena.graph.Node>
ontologyNode
(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns the primary Ontology Node (the subject in the_:x rdf:type owl:Ontology
statement) within the given graph if it can be uniquely determined.static Comparator<org.apache.jena.graph.Node>
rootNodeComparator
(org.apache.jena.graph.Graph graph) Returns a comparator for root nodes.static long
size
(org.apache.jena.graph.Graph graph) Returns the number of triples in thegraph
aslong
.static boolean
testTypes
(org.apache.jena.graph.Node node, org.apache.jena.graph.Graph graph, Set<org.apache.jena.graph.Node> whiteTypes, Set<org.apache.jena.graph.Node> blackTypes) Answerstrue
, if there is a declarationnode rdf:type $type
, where $type is from the white types list, but not from the black types list.static boolean
testTypesUsingContains
(org.apache.jena.graph.Node node, org.apache.jena.graph.Graph g, Set<org.apache.jena.graph.Node> whiteTypes, Set<org.apache.jena.graph.Node> blackTypes) static org.apache.jena.graph.Graph
unwrap
(org.apache.jena.graph.Graph graph) Unwraps the base (primary) base graph from a composite or wrapper graph if it is possible otherwise returns the same graph.
-
Constructor Details
-
Graphs
public Graphs()
-
-
Method Details
-
directSubGraphs
public static Stream<org.apache.jena.graph.Graph> directSubGraphs(org.apache.jena.graph.Graph graph) Extracts and lists all top-level sub-graphs from the given composite graph-container, that is allowed to be eitherUnionGraph
orPolyadic
orDyadic
. If the graph is not of the list above, an empty stream is expected. The base graph is not included in the resulting stream. In case ofDyadic
, the left graph is considered as a base and the right is a sub-graph.- Parameters:
graph
-Graph
- Returns:
Stream
ofGraph
s- See Also:
-
getPrimary(Graph)
UnionGraph
Polyadic
Dyadic
-
getPrimary
public static org.apache.jena.graph.Graph getPrimary(org.apache.jena.graph.Graph graph) Gets the base (primary) base graph from a composite or wrapper graph if it is possible otherwise returns the same graph. If the specified graph isDyadic
, the left part is considered as base graph.- Parameters:
graph
-Graph
- Returns:
Graph
- See Also:
-
directSubGraphs(Graph)
UnionGraph
MultiUnion
Polyadic
Dyadic
-
unwrap
public static org.apache.jena.graph.Graph unwrap(org.apache.jena.graph.Graph graph) Unwraps the base (primary) base graph from a composite or wrapper graph if it is possible otherwise returns the same graph. If the specified graph isDyadic
, the left part is considered as base graph.- Parameters:
graph
-Graph
- Returns:
Graph
- See Also:
-
isWrapper(Graph)
UnionGraph
MultiUnion
Polyadic
Dyadic
InfGraph
GraphWrapper
WrappedGraph
-
isWrapper
public static boolean isWrapper(org.apache.jena.graph.Graph g) Answerstrue
if the given graph can be unwrapped.- Parameters:
g
-Graph
- Returns:
- boolean
- See Also:
-
isGraphMem
public static boolean isGraphMem(org.apache.jena.graph.Graph graph) Answerstrue
if the graph specified isGraphMem
.- Parameters:
graph
-Graph
- Returns:
boolean
-
isGraphInf
public static boolean isGraphInf(org.apache.jena.graph.Graph graph) Answerstrue
if the graph specified isInfGraph
.- Parameters:
graph
-Graph
- Returns:
boolean
-
dataGraphs
Lists all indivisible graphs extracted from the composite or wrapper graph including the base as flat stream of non-composite (primitive) graphs.- Parameters:
graph
-Graph
- Returns:
Stream
ofGraph
s
-
flatTree
public static Stream<org.apache.jena.graph.Graph> flatTree(org.apache.jena.graph.Graph graph, Function<org.apache.jena.graph.Graph, org.apache.jena.graph.Graph> getBase, Function<org.apache.jena.graph.Graph, Stream<org.apache.jena.graph.Graph>> listSubGraphs) Lists all indivisible data graphs extracted from the composite or wrapper graph; -
isSameBase
public static boolean isSameBase(org.apache.jena.graph.Graph left, org.apache.jena.graph.Graph right) Answerstrue
iff the two input graphs are based on the same primitive graph.- Parameters:
left
-Graph
right
-Graph
- Returns:
boolean
-
isDistinct
public static boolean isDistinct(org.apache.jena.graph.Graph graph) Answerstrue
iff the given graph is distinct. A distinctGraph
behaves like aSet
: for each pair of encountered triplest1, t2
from any iterator,!t1.equals(t2)
.- Parameters:
graph
-Graph
to test- Returns:
boolean
ifgraph
is distinct- See Also:
-
isSized
public static boolean isSized(org.apache.jena.graph.Graph graph) Answerstrue
iff the givengraph
has known size and therefore the operationgraph.size()
does not take significant efforts. Composite graphs are considered as sized only if they relay on a single base graph, since their sizes are not always a sum of part size.- Parameters:
graph
-Graph
to test- Returns:
boolean
ifgraph
is sized- See Also:
-
size
public static long size(org.apache.jena.graph.Graph graph) Returns the number of triples in thegraph
aslong
.- Parameters:
graph
-Graph
, notnull
- Returns:
long
- See Also:
-
makeOntUnionFrom
public static UnionGraph makeOntUnionFrom(org.apache.jena.graph.Graph graph, Function<org.apache.jena.graph.Graph, UnionGraph> wrapAsUnion) Creates an ontologyUnionGraph
from the specifiedgraph
of arbitrary nature. The method can be used, for example, to transform the legacyMultiUnion
Graph toUnionGraph
.- Parameters:
graph
-Graph
wrapAsUnion
-Function
to produce new instanceUnionGraph
fromGraph
- Returns:
UnionGraph
-
makeOntUnion
public static UnionGraph makeOntUnion(org.apache.jena.graph.Graph graph, Collection<org.apache.jena.graph.Graph> repository, Function<org.apache.jena.graph.Graph, UnionGraph> wrapAsUnion) Assembles the hierarchical ontologyUnion Graph
from the specified components in accordance with theirowl:imports
andowl:Ontology
declarations. Irrelevant graphs are ignored.- Parameters:
graph
-Graph
repository
- aCollection
ofgraph
s to search in for missed dependencieswrapAsUnion
-Function
to produce new instanceUnionGraph
fromGraph
- Returns:
UnionGraph
-
flatHierarchy
Lists all graphs in the tree that is specified asUnionGraph
.- Parameters:
graph
-UnionGraph
- Returns:
Stream
ofUnionGraph
s- See Also:
-
isOntGraph
public static boolean isOntGraph(org.apache.jena.graph.Graph graph) Checks whether the specified graph is ontological, that is, has an OWL header. This method does not check the graph for validity; it may still be misconfigured (if there are several headers).- Parameters:
graph
-Graph
- Returns:
- boolean
-
isOntUnionGraph
Checks whether the specified graph is ontological, that is, has a hierarchy synchronized with theowl:imports
&owl:Ontology
relationships.- Parameters:
graph
-UnionGraph
allowMultipleOntologyHeaders
-boolean
, seeontologyNode(Graph, boolean)
for explanation- Returns:
- boolean
-
createOntologyHeaderNode
public static org.apache.jena.graph.Node createOntologyHeaderNode(org.apache.jena.graph.Graph graph, String uriOrNull) Creates a new ontology header (uriOrBlank rdf:type owl:Ontology
) if it is not present in the graph. According to the OWL specification, each non-composite ontology graph must contain one and only one ontology header. If a well-formed header already exists, the method returns it unchanged. If there are multiple other headers, any extra headers will be removed, and the content will be moved to a new generated anonymous header.- Parameters:
graph
-Graph
uriOrNull
- ontology header IRI, ifnull
then the method returns either existing anonymous header or generates new anonymous (blank) header- Returns:
- existing or new header
-
makeOntologyHeaderNode
public static org.apache.jena.graph.Node makeOntologyHeaderNode(org.apache.jena.graph.Graph graph, org.apache.jena.graph.Node newOntology) Creates (if absents) a new ontology header (node rdf:type owl:Ontology
) for the specified node, removing existing ontology headers (if any) and moving their contents to the new header. Note that a valid ontology must have a single header, but there could be multiple headers in imports closure.- Parameters:
graph
-Graph
newOntology
-Node
the new ontology header (iri or blank)- Returns:
newOntology
-
findOntologyNameNode
public static Optional<org.apache.jena.graph.Node> findOntologyNameNode(org.apache.jena.graph.Graph graph) Returns OWL Ontology ID (either object inany owl:versionIRI <uri>
statement or subject in<uri> rdf:type owl:Ontology
statement).- Parameters:
graph
-Graph
- Returns:
Optional
withNode
blank or URI, orOptional#empty
if the ontology Node cannot be uniquely defined or absent in thegraph
- See Also:
-
findOntologyNameNode
public static Optional<org.apache.jena.graph.Node> findOntologyNameNode(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns OWL Ontology ID (either object inany owl:versionIRI <uri>
statement or subject in<uri> rdf:type owl:Ontology
statement).- Parameters:
graph
-Graph
allowMultipleOntologyHeaders
-boolean
, seeontologyNode(Graph, boolean)
for explanation- Returns:
Optional
withNode
blank or URI, orOptional#empty
if the ontology Node cannot be uniquely defined or absent in thegraph
- See Also:
-
findVersionIRI
public static Optional<org.apache.jena.graph.Node> findVersionIRI(org.apache.jena.graph.Graph graph, org.apache.jena.graph.Node header) - Parameters:
graph
-Graph
header
-Node
subject fromheader rdf:type owl:Ontology
statement- Returns:
Optional
with URINode
-
ontologyNode
public static Optional<org.apache.jena.graph.Node> ontologyNode(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns the primary Ontology Node (the subject in the_:x rdf:type owl:Ontology
statement) within the given graph if it can be uniquely determined. Note: it works with any graph, not necessarily with the base. A valid composite ontology graph a lot of ontological nodes are expected. IfallowMultipleOntologyHeaders = true
, the most suitable ontology header will be chosen: if there are both uri and blank ontological nodes together in the graph, then the method prefers uri; if there are several ontological nodes of the same kind, it chooses the most cumbersome one.- Parameters:
graph
-Graph
allowMultipleOntologyHeaders
-boolean
- Returns:
Optional
around theNode
which could be uri or blank
-
ontologyNode
Returns the primary Ontology Node (the subject in the_:x rdf:type owl:Ontology
statement) within the given graph if it can be uniquely determined. Note: it works with any graph, not necessarily with the base. A valid composite ontology graph a lot of ontological nodes are expected.- Parameters:
graph
-Graph
- Returns:
Optional
around theNode
which could be uri or blank
-
rootNodeComparator
public static Comparator<org.apache.jena.graph.Node> rootNodeComparator(org.apache.jena.graph.Graph graph) Returns a comparator for root nodes. Tricky logic: first compares roots as standalone nodes and any uri-node is considered less than any blank-node, then compares roots as part of the graph using the rule 'the fewer children -> the greater weight'.- Parameters:
graph
-Graph
- Returns:
Comparator
-
listOntologyNodes
public static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node> listOntologyNodes(org.apache.jena.graph.Graph graph) Lists all subjects fromuriOrBlankNode rdf:type owl:Ontology
statements.- Parameters:
graph
-Graph
- Returns:
ExtendedIterator
ofNode
-
getImports
Returns all uri-objects from the_:x owl:imports _:uri
statements. In the case of composite graph, imports are listed transitively.- Parameters:
graph
-Graph
, notnull
- Returns:
- unordered Set of uris from the whole graph (it may be composite)
-
getImports
public static Set<String> getImports(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns all uri-objects from the_:x owl:imports _:uri
statements. In the case of composite graph, imports are listed transitively.- Parameters:
graph
-Graph
, notnull
allowMultipleOntologyHeaders
-boolean
, seeontologyNode(Graph, boolean)
for explanation- Returns:
- unordered Set of uris from the whole graph (it may be composite)
-
hasImports
Answerstrue
if the given uri is present in the import closure.- Parameters:
graph
-Graph
, notnull
uri
- to test- Returns:
- boolean
-
listImports
public static org.apache.jena.util.iterator.ExtendedIterator<String> listImports(org.apache.jena.graph.Graph graph, boolean allowMultipleOntologyHeaders) Returns anExtendedIterator
over all URIs from the_:x owl:imports _:uri
statements. In the case of composite graph, imports are listed transitively.- Parameters:
graph
-Graph
, notnull
allowMultipleOntologyHeaders
-boolean
, seeontologyNode(Graph, boolean)
for explanation- Returns:
ExtendedIterator
ofString
-URIs
-
listOntHeaderTriples
public static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Triple> listOntHeaderTriples(org.apache.jena.graph.Graph graph) Lists all triples which related to ontology header somehow.- Parameters:
graph
-Graph
- Returns:
ExtendedIterator
ofTriple
s
-
collectPrefixes
public static org.apache.jena.shared.PrefixMapping collectPrefixes(Iterable<org.apache.jena.graph.Graph> graphs) Collects a prefixes' library from the collection of the graphs.- Parameters:
graphs
-Iterable
a collection of graphs- Returns:
- unmodifiable (locked)
prefix mapping
-
dependsOn
public static boolean dependsOn(org.apache.jena.graph.Graph left, org.apache.jena.graph.Graph right) Answerstrue
if the left graph depends on the right one.- Parameters:
left
-Graph
right
-Graph
- Returns:
true
if the left argument graph is dependent on the right
-
listSubjects
public static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node> listSubjects(org.apache.jena.graph.Graph graph) Lists all unique subject nodes in the given graph. Warning: the result is temporary stored in-memory!- Parameters:
graph
-Graph
, notnull
- Returns:
- an
ExtendedIterator
(distinct) of all subjects in the graph - Throws:
OutOfMemoryError
- may occur while iterating, e.g.when the graph is huge so that all its subjects can be placed in memory as aSet
- See Also:
-
GraphUtil.listSubjects(Graph, Node, Node)
-
listSubjectsAndObjects
public static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node> listSubjectsAndObjects(org.apache.jena.graph.Graph graph) Lists all unique nodes in the given graph, which are used in a subject or an object positions. Warning: the result is temporary stored in-memory!- Parameters:
graph
-Graph
, notnull
- Returns:
- an
ExtendedIterator
(distinct) of all subjects or objects in the graph - Throws:
OutOfMemoryError
- while iterating in case the graph is too large so that all its subjects and objects can be placed in memory as aSet
- See Also:
-
GraphUtils.allNodes(Graph)
-
listAllNodes
public static org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.graph.Node> listAllNodes(org.apache.jena.graph.Graph graph) Lists all unique nodes in the given graph. Warning: the result is temporary stored in-memory!- Parameters:
graph
-Graph
, notnull
- Returns:
- an
ExtendedIterator
(distinct) of all nodes in the graph - Throws:
OutOfMemoryError
- while iterating in case the graph is too large to be placed in memory as aSet
-
createNode
Makes a fresh node instance according to the given iri.- Parameters:
iri
- String, an IRI to create URI-Node ornull
to create Blank-Node- Returns:
Node
, notnull
-
isNamedTriple
public static boolean isNamedTriple(org.apache.jena.graph.Triple triple) Answerstrue
if all parts of the given RDF triple are URIs (i.e., not blank nodes or literals).- Parameters:
triple
- a regular graphTriple
, notnull
- Returns:
boolean
-
invertTriple
public static org.apache.jena.graph.Triple invertTriple(org.apache.jena.graph.Triple triple) Inverts the given triple so that the new triple has the same subject as the given object, and the same object as the given subject.- Parameters:
triple
-SPO
theTriple
, notnull
- Returns:
Triple
,OPS
-
getSpliteratorCharacteristics
public static int getSpliteratorCharacteristics(org.apache.jena.graph.Graph graph) Returns aSpliterator
characteristics based on graph analysis.- Parameters:
graph
-Graph
- Returns:
- int
-
hasOneOfType
public static boolean hasOneOfType(org.apache.jena.graph.Node node, org.apache.jena.graph.Graph graph, Set<org.apache.jena.graph.Node> types) Answerstrue
, if there is a declarationnode rdf:type $type
, where $type is one of the specified types.Impl note: depending on the type of the underlying graph, it may or may not be advantageous to get all types at once, or ask many separate queries. Heuristically, we assume that fine-grain queries to an inference graph are preferable, and all-at-once for other types, including persistent stores.
- Parameters:
node
-Node
to testgraph
-Graph
types
- Set ofNode
-types- Returns:
- boolean
-
testTypes
public static boolean testTypes(org.apache.jena.graph.Node node, org.apache.jena.graph.Graph graph, Set<org.apache.jena.graph.Node> whiteTypes, Set<org.apache.jena.graph.Node> blackTypes) Answerstrue
, if there is a declarationnode rdf:type $type
, where $type is from the white types list, but not from the black types list.Impl note: depending on the type of the underlying graph, it may or may not be advantageous to get all types at once, or ask many separate queries. Heuristically, we assume that fine-grain queries to an inference graph are preferable, and all-at-once for other types, including persistent stores.
- Parameters:
node
-Node
to testgraph
-Graph
whiteTypes
- Set ofNode
-typesblackTypes
- Set ofNode
-types- Returns:
- boolean
-
testTypesUsingContains
-