Module org.apache.jena.ontapi
Class OntUnionGraphRepository
java.lang.Object
org.apache.jena.ontapi.impl.repositories.OntUnionGraphRepository
A wrapper for
DocumentGraphRepository
that controls imports OntModel
closure.-
Constructor Summary
ConstructorDescriptionOntUnionGraphRepository
(GraphRepository repository, Function<org.apache.jena.graph.Graph, UnionGraph> unionGraphFactory, Function<org.apache.jena.graph.Node, org.apache.jena.graph.Graph> baseGraphFactory, boolean ignoreUnresolvedImports) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkIDCanBeChanged
(UnionGraph graph) Throws exception if graph's ontology name is in imports closure.boolean
contains
(org.apache.jena.graph.Node node) static Optional<org.apache.jena.graph.Graph>
findSubGraphByOntName
(UnionGraph graph, org.apache.jena.graph.Node name) Finds ont subgraph by its ontology name (owl:Ontology
orowl:versionIRI
).get
(org.apache.jena.graph.Node name) Returns the graph by its ontology name.put
(org.apache.jena.graph.Graph graph) Puts the graph into the repository returningUnionGraph
wrapper.boolean
remap
(UnionGraph graph) Synchronizes graph's ontology name with the underlying storage.static void
Removes all subgraphs which are not connected to the parent by theowl:imports
relationship.
-
Constructor Details
-
OntUnionGraphRepository
public OntUnionGraphRepository(GraphRepository repository, Function<org.apache.jena.graph.Graph, UnionGraph> unionGraphFactory, Function<org.apache.jena.graph.Node, org.apache.jena.graph.Graph> baseGraphFactory, boolean ignoreUnresolvedImports)
-
-
Method Details
-
removeUnusedImportSubGraphs
Removes all subgraphs which are not connected to the parent by theowl:imports
relationship.- Parameters:
graph
-UnionGraph
-
findSubGraphByOntName
public static Optional<org.apache.jena.graph.Graph> findSubGraphByOntName(UnionGraph graph, org.apache.jena.graph.Node name) Finds ont subgraph by its ontology name (owl:Ontology
orowl:versionIRI
).- Parameters:
graph
-UnionGraph
name
-Node
- Returns:
Optional
wrapping subgraph
-
checkIDCanBeChanged
Throws exception if graph's ontology name is in imports closure.- Parameters:
graph
-UnionGraph
-
contains
public boolean contains(org.apache.jena.graph.Node node) - Parameters:
node
-Node
graph's ontology name (owl:Ontology
orowl:versionIRI
).- Returns:
- boolean
-
get
Returns the graph by its ontology name.- Parameters:
name
-Node
- Returns:
UnionGraph
, nevernull
-
put
Puts the graph into the repository returningUnionGraph
wrapper. All dependencies are processed.- Parameters:
graph
-Graph
- Returns:
UnionGraph
-
remap
Synchronizes graph's ontology name with the underlying storage. Graph's identifier in the storage must match ontology name (owl:Ontology
orowl:versionIRI
). If there is no ontology name, the graph will be removed from therepository
.- Parameters:
graph
-UnionGraph
- Returns:
true
if graph's identifier has been changed,false
if no change is made
-