Module org.apache.jena.ontapi
Class DocumentGraphRepository
java.lang.Object
org.apache.jena.ontapi.impl.repositories.DocumentGraphRepository
- All Implemented Interfaces:
GraphRepository
Simple GraphRepository implementation with location mapping.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddMapping
(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).static String
Validates the specified String is a valid URI or file path.void
clear()
Removes all graphs.boolean
long
count()
org.apache.jena.graph.Graph
Gets Graph by ID.getIds()
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.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jena.ontapi.GraphRepository
graphs
-
Constructor Details
-
DocumentGraphRepository
public DocumentGraphRepository() -
DocumentGraphRepository
-
-
Method Details
-
check
Validates the specified String is a valid URI or file path.- Parameters:
fileNameOrURI
- to validate- Returns:
- the same string
-
addMapping
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 idfileNameOrUri
- location of the Graph document- Returns:
- this instance
-
get
Gets Graph by ID.- Specified by:
get
in interfaceGraphRepository
- Parameters:
id
-String
Graph's identifier- Returns:
Graph
- Throws:
org.apache.jena.shared.JenaException
- if graph can't be found
-
ids
- Specified by:
ids
in interfaceGraphRepository
- Returns:
Stream
of Graph's identifiers
-
put
Description copied from interface:GraphRepository
Associates the specified graph with the specified ID, returning the previous association ornull
if there was no association.- Specified by:
put
in interfaceGraphRepository
- Parameters:
id
-String
Graph's identifiergraph
-Graph
- Returns:
Graph
ornull
-
remove
Description copied from interface:GraphRepository
Removes graph.- Specified by:
remove
in interfaceGraphRepository
- Parameters:
id
-String
Graph's identifier- Returns:
Graph
-
clear
public void clear()Description copied from interface:GraphRepository
Removes all graphs.- Specified by:
clear
in interfaceGraphRepository
-
count
public long count()- Specified by:
count
in interfaceGraphRepository
- Returns:
- number of graphs
-
contains
- Specified by:
contains
in interfaceGraphRepository
- Parameters:
id
-String
Graph's identifier- Returns:
- boolean
-
getIds
-