- 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 Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all graphs.default boolean
default long
count()
static DocumentGraphRepository
createGraphDocumentRepository
(Supplier<org.apache.jena.graph.Graph> factory) A factory method to createsGraphRepository
instance that loads graphs on demand from the given location.static DocumentGraphRepository
A factory method to createGraphRepository
instance that loads graphs on demand from the given location.static PersistentGraphRepository
A factory method for creating persistentGraphRepository
; persistence is ensured by themaker
.org.apache.jena.graph.Graph
Gets Graph by ID.default Stream<org.apache.jena.graph.Graph>
graphs()
Lists all graphs.ids()
org.apache.jena.graph.Graph
Associates the specified graph with the specified ID, returning the previous association ornull
if there was no association.org.apache.jena.graph.Graph
Removes graph.
-
Method Details
-
createGraphDocumentRepositoryMem
A factory method to createGraphRepository
instance that loads graphs on demand from the given location. The location is specified by the methodDocumentGraphRepository.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 createsGraphRepository
instance that loads graphs on demand from the given location. The location is specified by the methodDocumentGraphRepository.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 newGraph
, notnull
- Returns:
DocumentGraphRepository
-
createPersistentGraphRepository
A factory method for creating persistentGraphRepository
; persistence is ensured by themaker
.- Parameters:
maker
-GraphMaker
a factory to create/fetch/removeGraph
s- Returns:
PersistentGraphRepository
-
get
Gets Graph by ID.- Parameters:
id
-String
Graph's identifier, usually it is ontology ID or source URL or file path- Returns:
Graph
-
ids
- Returns:
Stream
of Graph's identifiers
-
put
Associates the specified graph with the specified ID, returning the previous association ornull
if there was no association.- Parameters:
id
-String
Graph's identifiergraph
-Graph
- Returns:
Graph
ornull
-
remove
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
Lists all graphs.- Returns:
Stream
ofGraph
s
-
contains
- Parameters:
id
-String
Graph's identifier- Returns:
- boolean
-