public interface GraphMaker
A factory for providing instances of named graphs with appropriate storage models.
It represents a directory, or a database, or a mapping: names map to graphs for the
lifetime of the GraphMaker. Names can be "arbitrary" character sequences.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the factory - no more requests will be executed, and any cleanup can be performed.org.apache.jena.graph.Graph
createGraph
(String name) Create a new graph associated with the given name.default org.apache.jena.graph.Graph
getGraphOrNull
(String name) Returns the existing graph or null if it does not exist.default Stream<org.apache.jena.graph.Graph>
graphs()
Lists all graphs.boolean
Returns true iff the factory has a graph with the given namenames()
Answers aStream
where each element is the name of a graph in the maker, and the complete sequence exhausts the set of names.org.apache.jena.graph.Graph
Finds an existing graph that this factory knows about under the given name.void
removeGraph
(String name) Removes the association between the name and the graph.
-
Method Details
-
createGraph
org.apache.jena.graph.Graph createGraph(String name) throws org.apache.jena.shared.AlreadyExistsException Create a new graph associated with the given name. If there is no such association, create one and return it. Otherwise, throw an AlreadyExistsException.- Parameters:
name
- graph identifier, notnull
- Returns:
Graph
, notnull
- Throws:
org.apache.jena.shared.AlreadyExistsException
- if graph already exists in the underlying storage
-
openGraph
org.apache.jena.graph.Graph openGraph(String name) throws org.apache.jena.shared.DoesNotExistException Finds an existing graph that this factory knows about under the given name. If such a graph exists, return it. Otherwise, throw a DoesNotExistException.- Parameters:
name
- graph identifier, notnull
- Returns:
Graph
, notnull
- Throws:
org.apache.jena.shared.DoesNotExistException
- if there is no such graph in the underlying storage
-
removeGraph
Removes the association between the name and the graph. The methodcreateGraph(String)
will now be able to create a graph with that name, andopenGraph(String)
will no longer be able to find it. The graph itself is not touched.- Parameters:
name
- graph identifier, notnull
- Throws:
org.apache.jena.shared.DoesNotExistException
- if there is no such graph in the underlying storage
-
hasGraph
Returns true iff the factory has a graph with the given name- Parameters:
name
- graph identifier, notnull
- Returns:
boolean
-
names
Answers aStream
where each element is the name of a graph in the maker, and the complete sequence exhausts the set of names. No particular order is expected from the list.- Returns:
Stream
of graph's identifiers
-
close
void close()Closes the factory - no more requests will be executed, and any cleanup can be performed. -
getGraphOrNull
Returns the existing graph or null if it does not exist.- Parameters:
name
- graph identifier, notnull
- Returns:
Graph
, ornull
-
graphs
Lists all graphs.- Returns:
Stream
ofGraph
s
-