Class DocumentGraphRepository

java.lang.Object
org.apache.jena.ontapi.impl.repositories.DocumentGraphRepository
All Implemented Interfaces:
GraphRepository

public class DocumentGraphRepository extends Object implements GraphRepository
Simple GraphRepository implementation with location mapping.
  • Constructor Details

    • DocumentGraphRepository

      public DocumentGraphRepository()
    • DocumentGraphRepository

      public DocumentGraphRepository(Supplier<org.apache.jena.graph.Graph> factory)
  • Method Details

    • check

      public static String check(String fileNameOrURI)
      Validates the specified String is a valid URI or file path.
      Parameters:
      fileNameOrURI - to validate
      Returns:
      the same string
    • addMapping

      public DocumentGraphRepository addMapping(String id, String fileNameOrUri)
      Adds mapping Graph's ID <-> source document location, which can be a file path, class-resource path, or URI (ftp or http). Note that class-resource path string should be without leading "/" symbol.
      Parameters:
      id - Graph's id
      fileNameOrUri - location of the Graph document
      Returns:
      this instance
    • get

      public org.apache.jena.graph.Graph get(String id)
      Gets Graph by ID.
      Specified by:
      get in interface GraphRepository
      Parameters:
      id - String Graph's identifier
      Returns:
      Graph
      Throws:
      org.apache.jena.shared.JenaException - if graph can't be found
    • ids

      public Stream<String> ids()
      Specified by:
      ids in interface GraphRepository
      Returns:
      Stream of Graph's identifiers
    • put

      public org.apache.jena.graph.Graph put(String id, org.apache.jena.graph.Graph graph)
      Description copied from interface: GraphRepository
      Associates the specified graph with the specified ID, returning the previous association or null if there was no association.
      Specified by:
      put in interface GraphRepository
      Parameters:
      id - String Graph's identifier
      graph - Graph
      Returns:
      Graph or null
    • remove

      public org.apache.jena.graph.Graph remove(String id)
      Description copied from interface: GraphRepository
      Removes graph.
      Specified by:
      remove in interface GraphRepository
      Parameters:
      id - String Graph's identifier
      Returns:
      Graph
    • clear

      public void clear()
      Description copied from interface: GraphRepository
      Removes all graphs.
      Specified by:
      clear in interface GraphRepository
    • count

      public long count()
      Specified by:
      count in interface GraphRepository
      Returns:
      number of graphs
    • contains

      public boolean contains(String id)
      Specified by:
      contains in interface GraphRepository
      Parameters:
      id - String Graph's identifier
      Returns:
      boolean
    • getIds

      public Set<String> getIds()