Interface GraphRepository

All Known Implementing Classes:
DocumentGraphRepository, PersistentGraphRepository

public interface GraphRepository
Graph repository. Each Graph is associated with ID. For OWL Ontology Graphs, Graph ID can be OntID.getImportsIRI().
  • Method Details

    • createGraphDocumentRepositoryMem

      static DocumentGraphRepository createGraphDocumentRepositoryMem()
      A factory method to create GraphRepository instance that loads graphs on demand from the given location. The location is specified by the method DocumentGraphRepository.addMapping(String, String). If there is no mapping specified, graph id will be used as a source.
      Returns:
      DocumentGraphRepository
    • createGraphDocumentRepository

      static DocumentGraphRepository createGraphDocumentRepository(Supplier<org.apache.jena.graph.Graph> factory)
      A factory method to creates GraphRepository instance that loads graphs on demand from the given location. The location is specified by the method DocumentGraphRepository.addMapping(String, String). If there is no mapping specified, graph id will be used as a source URL or file path.
      Parameters:
      factory - Supplier to produce new Graph, not null
      Returns:
      DocumentGraphRepository
    • createPersistentGraphRepository

      static PersistentGraphRepository createPersistentGraphRepository(GraphMaker maker)
      A factory method for creating persistent GraphRepository; persistence is ensured by the maker.
      Parameters:
      maker - GraphMaker a factory to create/fetch/remove Graphs
      Returns:
      PersistentGraphRepository
    • get

      org.apache.jena.graph.Graph get(String id)
      Gets Graph by ID.
      Parameters:
      id - String Graph's identifier, usually it is ontology ID or source URL or file path
      Returns:
      Graph
    • ids

      Stream<String> ids()
      Returns:
      Stream of Graph's identifiers
    • put

      org.apache.jena.graph.Graph put(String id, org.apache.jena.graph.Graph graph)
      Associates the specified graph with the specified ID, returning the previous association or null if there was no association.
      Parameters:
      id - String Graph's identifier
      graph - Graph
      Returns:
      Graph or null
    • remove

      org.apache.jena.graph.Graph remove(String id)
      Removes graph.
      Parameters:
      id - String Graph's identifier
      Returns:
      Graph associated with the id, or null if there was no graph for the given id
    • clear

      void clear()
      Removes all graphs.
    • count

      default long count()
      Returns:
      number of graphs
    • graphs

      default Stream<org.apache.jena.graph.Graph> graphs()
      Lists all graphs.
      Returns:
      Stream of Graphs
    • contains

      default boolean contains(String id)
      Parameters:
      id - String Graph's identifier
      Returns:
      boolean