Class OntUnionGraphRepository

java.lang.Object
org.apache.jena.ontapi.impl.repositories.OntUnionGraphRepository

public class OntUnionGraphRepository extends Object
A wrapper for DocumentGraphRepository that controls imports OntModel closure.
  • 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

      public static void removeUnusedImportSubGraphs(UnionGraph graph)
      Removes all subgraphs which are not connected to the parent by the owl: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 or owl:versionIRI).
      Parameters:
      graph - UnionGraph
      name - Node
      Returns:
      Optional wrapping subgraph
    • checkIDCanBeChanged

      public static void checkIDCanBeChanged(UnionGraph graph)
      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 or owl:versionIRI).
      Returns:
      boolean
    • get

      public UnionGraph get(org.apache.jena.graph.Node name)
      Returns the graph by its ontology name.
      Parameters:
      name - Node
      Returns:
      UnionGraph, never null
    • put

      public UnionGraph put(org.apache.jena.graph.Graph graph)
      Puts the graph into the repository returning UnionGraph wrapper. All dependencies are processed.
      Parameters:
      graph - Graph
      Returns:
      UnionGraph
    • remap

      public boolean remap(UnionGraph graph)
      Synchronizes graph's ontology name with the underlying storage. Graph's identifier in the storage must match ontology name (owl:Ontology or owl:versionIRI). If there is no ontology name, the graph will be removed from the repository.
      Parameters:
      graph - UnionGraph
      Returns:
      true if graph's identifier has been changed, false if no change is made