public class SailGraph extends Object implements TransactionalGraph, MetaGraph<org.openrdf.sail.Sail>
TransactionalGraph.Conclusion| Modifier and Type | Field and Description |
|---|---|
static Map<String,org.openrdf.rio.RDFFormat> |
formats |
protected org.openrdf.sail.Sail |
rawGraph |
protected ThreadLocal<org.openrdf.sail.SailConnection> |
sailConnection |
| Constructor and Description |
|---|
SailGraph(org.openrdf.sail.Sail sail)
Construct a new SailGraph with an uninitialized Sail.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDefaultNamespaces()
Defines a few commonly-used namespace prefixes.
|
Edge |
addEdge(Object id,
Vertex outVertex,
Vertex inVertex,
String label) |
void |
addNamespace(String prefix,
String namespace)
Add a prefix-to-namespace mapping to the Sail connection of this graph.
|
Vertex |
addVertex(Object id) |
void |
commit() |
List<Map<String,Vertex>> |
executeSparql(String sparqlQuery)
Evaluate a SPARQL query against the SailGraph (http://www.w3.org/TR/rdf-sparql-query/).
|
String |
expandPrefix(String uri)
Given a URI, expand it to its full URI.
|
Edge |
getEdge(Object id) |
Iterable<Edge> |
getEdges() |
Iterable<Edge> |
getEdges(String key,
Object value) |
Features |
getFeatures() |
static org.openrdf.rio.RDFFormat |
getFormat(String format) |
Map<String,String> |
getNamespaces()
Get all the prefix-to-namespace mappings of the graph.
|
org.openrdf.sail.Sail |
getRawGraph() |
ThreadLocal<org.openrdf.sail.SailConnection> |
getSailConnection()
Get the Sail connection currently being used by the graph.
|
Vertex |
getVertex(Object id) |
Iterable<Vertex> |
getVertices() |
Iterable<Vertex> |
getVertices(String key,
Object value) |
void |
loadRDF(InputStream input,
String baseURI,
String format,
String baseGraph)
Load RDF data into the SailGraph.
|
String |
prefixNamespace(String uri)
Given a URI, compress it to its prefixed URI.
|
GraphQuery |
query() |
void |
removeEdge(Edge edge) |
void |
removeNamespace(String prefix)
Remove a prefix-to-namespace mapping from the Sail connection of this graph.
|
void |
removeVertex(Vertex vertex) |
void |
rollback() |
void |
saveRDF(OutputStream output,
String format)
Save RDF data from the SailGraph.
|
void |
shutdown() |
void |
stopTransaction(TransactionalGraph.Conclusion conclusion) |
String |
toString() |
protected final org.openrdf.sail.Sail rawGraph
protected final ThreadLocal<org.openrdf.sail.SailConnection> sailConnection
public SailGraph(org.openrdf.sail.Sail sail)
sail - a not-yet-initialized Sail instancepublic static org.openrdf.rio.RDFFormat getFormat(String format)
public void addDefaultNamespaces()
public org.openrdf.sail.Sail getRawGraph()
getRawGraph in interface MetaGraph<org.openrdf.sail.Sail>public Iterable<Vertex> getVertices()
getVertices in interface Graphpublic Iterable<Vertex> getVertices(String key, Object value)
getVertices in interface Graphpublic void removeVertex(Vertex vertex)
removeVertex in interface Graphpublic void removeEdge(Edge edge)
removeEdge in interface Graphpublic ThreadLocal<org.openrdf.sail.SailConnection> getSailConnection()
public void addNamespace(String prefix, String namespace)
prefix - the prefix (e.g. tg)namespace - the namespace (e.g. http://tinkerpop.com#)public void removeNamespace(String prefix)
prefix - the prefix of the prefix-to-namespace mapping to removepublic Map<String,String> getNamespaces()
public void loadRDF(InputStream input, String baseURI, String format, String baseGraph)
input - the InputStream of RDF databaseURI - the baseURI for RDF dataformat - supported formats include rdf-xml, n-triples, turtle, n3, trix, or trigbaseGraph - the baseGraph to insert the data intopublic void saveRDF(OutputStream output, String format)
output - the OutputStream to which to write RDF dataformat - supported formats include rdf-xml, n-triples, turtle, n3, trix, or trigpublic void shutdown()
shutdown in interface Graphshutdown in interface TransactionalGraphpublic String expandPrefix(String uri)
uri - the compressed URI (e.g. tg:knows)public String prefixNamespace(String uri)
uri - the expanded URI (e.g. http://tinkerpop.com#knows)public void stopTransaction(TransactionalGraph.Conclusion conclusion)
stopTransaction in interface TransactionalGraphpublic void commit()
commit in interface TransactionalGraphpublic void rollback()
rollback in interface TransactionalGraphpublic Features getFeatures()
getFeatures in interface Graphpublic GraphQuery query()
public List<Map<String,Vertex>> executeSparql(String sparqlQuery) throws RuntimeException
sparqlQuery - the SPARQL query to evaluateRuntimeException - if an error occurs in the SPARQL query engineCopyright © 2010-2014. All Rights Reserved.