public abstract class BlazeGraph extends Object implements org.apache.tinkerpop.gremlin.structure.Graph
BlazeGraphEmbedded
, which provides an embedded (same JVM)
implementation of the Blazegraph/tinkerpop3 API.
See BlazeGraphFeatures
for what tinkerpop3 features this
implementation supports. In addition to the tinkerpop3 features, this API
also provides the following:
Modifier and Type | Class and Description |
---|---|
protected static class |
BlazeGraph.Exceptions |
protected class |
BlazeGraph.GraphStreamer<E>
Convert a Sesame iteration into a Java 8 Stream.
|
static class |
BlazeGraph.Match
Enum used by the full text search API.
|
static interface |
BlazeGraph.Options
Options that can be specified in the graph configuration.
|
protected class |
BlazeGraph.Transforms
Transform functions from RDF results (binding sets and statements) to
property graph results.
|
org.apache.tinkerpop.gremlin.structure.Graph.Features, org.apache.tinkerpop.gremlin.structure.Graph.Hidden, org.apache.tinkerpop.gremlin.structure.Graph.OptIn, org.apache.tinkerpop.gremlin.structure.Graph.OptIns, org.apache.tinkerpop.gremlin.structure.Graph.OptOut, org.apache.tinkerpop.gremlin.structure.Graph.OptOuts, org.apache.tinkerpop.gremlin.structure.Graph.Variables
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.configuration.Configuration |
config
Configuration of this graph instance.
|
protected static LambdaLogger |
log |
protected static LambdaLogger |
sparqlLog |
protected int |
sparqlLogMax
Maximum number of chars to print through the SparqlLogger.
|
protected BlazeGraph.Transforms |
transforms
Transform functions for converting from RDF query results to property
graph results.
|
Modifier | Constructor and Description |
---|---|
protected |
BlazeGraph(org.apache.commons.configuration.Configuration config)
Construct an instance using the supplied configuration.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
_ask(String queryStr,
String extQueryId)
Internal Sparql ask method.
|
protected abstract Stream<org.openrdf.model.Statement> |
_project(String queryStr,
String extQueryId)
Internal Sparql project method.
|
protected abstract Stream<org.openrdf.query.BindingSet> |
_select(String queryStr,
String extQueryId)
Internal Sparql select method.
|
protected abstract void |
_update(String queryStr,
String extQueryId)
Internal Sparql update method.
|
BlazeEdge |
addEdge(BlazeVertex from,
BlazeVertex to,
String label,
Object... kvs)
Add an edge.
|
BlazeVertex |
addVertex(Object... kvs)
Add a vertex.
|
boolean |
ask(String queryStr)
Select results using a SPARQL query.
|
boolean |
ask(String queryStr,
String extQueryId)
Select results using a SPARQL query.
|
void |
bulkLoad(Code code)
Execute the supplied code fragment in bulk load mode and reset to
incremental mode when finished.
|
void |
bulkLoad(org.apache.tinkerpop.gremlin.structure.Graph g)
Bulk load a Graph (TinkerGraph or otherwise).
|
void |
bulkLoad(org.apache.tinkerpop.gremlin.structure.Graph g,
Function<String,org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality> getCardinality)
Bulk load a Graph (TinkerGraph or otherwise), using the supplied
function to determine VertexProperty key cardinality.
|
abstract void |
cancel(com.bigdata.rdf.sail.model.RunningQuery r)
Kill a running query specified by the RunningQuery object.
|
abstract void |
cancel(UUID queryId)
Kill a running query specified by the UUID.
|
abstract void |
close()
Close the graph.
|
org.apache.tinkerpop.gremlin.process.computer.GraphComputer |
compute()
GraphComputer not currently supported.
|
<C extends org.apache.tinkerpop.gremlin.process.computer.GraphComputer> |
compute(Class<C> graphComputerClass)
GraphComputer not currently supported.
|
org.apache.commons.configuration.Configuration |
configuration()
Return the graph configuration.
|
protected abstract org.openrdf.repository.RepositoryConnection |
cxn()
Provide a connection to the SAIL repository for read and write
operations.
|
Optional<BlazeEdge> |
edge(Object edgeId)
Lookup an edge by id.
|
int |
edgeCount()
Fast edge count using Sparql aggregation.
|
CloseableIterator<org.apache.tinkerpop.gremlin.structure.Edge> |
edges(Object... edgeIds)
Lookup edges by (optional) ids.
|
BlazeGraphFeatures |
features()
Return the features.
|
abstract Collection<com.bigdata.rdf.sail.model.RunningQuery> |
getRunningQueries()
Return a Collection of running queries
|
protected Function<org.openrdf.model.Statement,Optional<BlazeGraphAtom>> |
graphAtomTransform()
So that BlazeGraphEmbedded can use it for listeners.
|
CloseableIterator<BlazeGraphEdit> |
history(List<String> ids) |
CloseableIterator<BlazeGraphEdit> |
history(String... ids)
If history is enabled, return an iterator of historical graph edits
related to any of the supplied ids.
|
boolean |
isBulkLoad()
Returns whether the graph is in bulkLoad (true) or incremental update
(false) mode.
|
CloseableIterator<BlazeGraphAtom> |
project(String queryStr)
Project a subgraph using a SPARQL query.
|
CloseableIterator<BlazeGraphAtom> |
project(String queryStr,
String externalQueryId)
Project a subgraph using a SPARQL query.
|
abstract com.bigdata.rdf.model.BigdataValueFactory |
rdfValueFactory()
RDF value factory for Sesame model objects.
|
<V> CloseableIterator<org.apache.tinkerpop.gremlin.structure.Property<V>> |
search(String search,
BlazeGraph.Match match)
Search for properties in the graph using the built-in full text index.
|
CloseableIterator<BlazeBindingSet> |
select(String queryStr)
Select results using a SPARQL query.
|
CloseableIterator<BlazeBindingSet> |
select(String queryStr,
String extQueryId)
Select results using a SPARQL query.
|
void |
setBulkLoad(boolean bulkLoad)
When this is set to true, disables any implicit reads/removes that are
interleaved with the process of adding new data.
|
protected void |
setMaxQueryTime(org.openrdf.query.Query query)
Utility function to set the Query timeout to the global
setting if it is configured.
|
String |
toString()
Standard graph toString() representation using TP3 StringFactory.
|
abstract org.apache.tinkerpop.gremlin.structure.Transaction |
tx()
Return the transaction object for this graph.
|
void |
update(String queryStr)
Update graph using SPARQL Update.
|
void |
update(String queryStr,
String extQueryId)
Update graph using SPARQL Update.
|
BlazeValueFactory |
valueFactory()
Return the factory used to round-trip between Tinkerpop values and
RDF values.
|
org.apache.tinkerpop.gremlin.structure.Graph.Variables |
variables()
Variables not currently supported.
|
Optional<BlazeVertex> |
vertex(String vertexId)
Lookup a vertex by id.
|
int |
vertexCount()
Fast vertex count using Sparql aggregation.
|
CloseableIterator<org.apache.tinkerpop.gremlin.structure.Vertex> |
vertices(Object... vertexIds)
Lookup vertices by (optional) ids.
|
protected static final transient LambdaLogger log
protected static final transient LambdaLogger sparqlLog
protected final org.apache.commons.configuration.Configuration config
protected final BlazeGraph.Transforms transforms
protected final int sparqlLogMax
protected BlazeGraph(org.apache.commons.configuration.Configuration config)
public BlazeValueFactory valueFactory()
public abstract com.bigdata.rdf.model.BigdataValueFactory rdfValueFactory()
protected abstract org.openrdf.repository.RepositoryConnection cxn()
public boolean isBulkLoad()
setBulkLoad(boolean)
public void setBulkLoad(boolean bulkLoad)
public void bulkLoad(Code code)
setBulkLoad(boolean)
public void bulkLoad(org.apache.tinkerpop.gremlin.structure.Graph g)
public void bulkLoad(org.apache.tinkerpop.gremlin.structure.Graph g, Function<String,org.apache.tinkerpop.gremlin.structure.VertexProperty.Cardinality> getCardinality)
public BlazeVertex addVertex(Object... kvs)
addVertex
in interface org.apache.tinkerpop.gremlin.structure.Graph
Graph.addVertex(Object...)
public BlazeEdge addEdge(BlazeVertex from, BlazeVertex to, String label, Object... kvs)
BlazeVertex.addEdge(String, Vertex, Object...)
to consolidate these operations in one place.Vertex.addEdge(String, Vertex, Object...)
public int vertexCount()
public Optional<BlazeVertex> vertex(String vertexId)
vertexId
- the idpublic CloseableIterator<org.apache.tinkerpop.gremlin.structure.Vertex> vertices(Object... vertexIds)
vertices
in interface org.apache.tinkerpop.gremlin.structure.Graph
public int edgeCount()
public Optional<BlazeEdge> edge(Object edgeId)
edgeId
- the idpublic CloseableIterator<org.apache.tinkerpop.gremlin.structure.Edge> edges(Object... edgeIds)
edges
in interface org.apache.tinkerpop.gremlin.structure.Graph
public abstract org.apache.tinkerpop.gremlin.structure.Transaction tx()
tx
in interface org.apache.tinkerpop.gremlin.structure.Graph
BlazeGraphEmbedded.BlazeTransaction
public abstract void close()
close
in interface AutoCloseable
close
in interface org.apache.tinkerpop.gremlin.structure.Graph
BlazeGraphEmbedded.close()
public org.apache.commons.configuration.Configuration configuration()
configuration
in interface org.apache.tinkerpop.gremlin.structure.Graph
public BlazeGraphFeatures features()
features
in interface org.apache.tinkerpop.gremlin.structure.Graph
BlazeGraphFeatures
public String toString()
public org.apache.tinkerpop.gremlin.structure.Graph.Variables variables()
variables
in interface org.apache.tinkerpop.gremlin.structure.Graph
public org.apache.tinkerpop.gremlin.process.computer.GraphComputer compute() throws IllegalArgumentException
compute
in interface org.apache.tinkerpop.gremlin.structure.Graph
IllegalArgumentException
public <C extends org.apache.tinkerpop.gremlin.process.computer.GraphComputer> C compute(Class<C> graphComputerClass) throws IllegalArgumentException
compute
in interface org.apache.tinkerpop.gremlin.structure.Graph
IllegalArgumentException
public CloseableIterator<BlazeGraphAtom> project(String queryStr) throws Exception
Warning: You MUST close this iterator when finished.
Exception
public CloseableIterator<BlazeGraphAtom> project(String queryStr, String externalQueryId) throws Exception
Warning: You MUST close this iterator when finished.
Exception
public CloseableIterator<BlazeBindingSet> select(String queryStr)
Warning: You MUST close this iterator when finished.
public CloseableIterator<BlazeBindingSet> select(String queryStr, String extQueryId)
Warning: You MUST close this iterator when finished.
public boolean ask(String queryStr)
public void update(String queryStr)
public CloseableIterator<BlazeGraphEdit> history(String... ids)
BasicRepositoryProvider
. Only vertex and edges ids currently
supported.
Warning: You MUST close this iterator when finished.
AbstractTripleStore.Options#STATEMENT_IDENTIFIERS
,
AbstractTripleStore.Options#RDR_HISTORY_CLASS
,
RDRHistory
public CloseableIterator<BlazeGraphEdit> history(List<String> ids)
history(String...)
public <V> CloseableIterator<org.apache.tinkerpop.gremlin.structure.Property<V>> search(String search, BlazeGraph.Match match)
search
- The search string. Tokens in the search string will be matched
according to the supplied match parameter.match
- The match behavior.protected abstract Stream<org.openrdf.query.BindingSet> _select(String queryStr, String extQueryId)
BlazeGraph.GraphStreamer
.
Callers MUST close this stream when finished.protected abstract Stream<org.openrdf.model.Statement> _project(String queryStr, String extQueryId)
BlazeGraph.GraphStreamer
.
Callers MUST close this stream when finished.protected abstract boolean _ask(String queryStr, String extQueryId)
protected abstract void _update(String queryStr, String extQueryId)
protected void setMaxQueryTime(org.openrdf.query.Query query)
public abstract Collection<com.bigdata.rdf.sail.model.RunningQuery> getRunningQueries()
public abstract void cancel(UUID queryId)
public abstract void cancel(com.bigdata.rdf.sail.model.RunningQuery r)
protected Function<org.openrdf.model.Statement,Optional<BlazeGraphAtom>> graphAtomTransform()
Copyright © 2015–2016 SYSTAP, LLC DBA Blazegraph. All rights reserved.