public class BlueprintsGraphManager<T extends com.tinkerpop.blueprints.Graph> extends Object implements GraphManager
This class can be extended for when specific graph implementations (such as Neo4j) can provide more efficient implementations of certain methods.
Modifier and Type | Field and Description |
---|---|
protected com.tinkerpop.frames.FramedGraph<T> |
graph |
protected static String |
METADATA_PREFIX |
Constructor and Description |
---|
BlueprintsGraphManager(com.tinkerpop.frames.FramedGraph<T> graph) |
Modifier and Type | Method and Description |
---|---|
com.tinkerpop.blueprints.Vertex |
createVertex(String id,
EntityClass type,
Map<String,?> data)
Create a vertex with the given id, type, and data.
|
void |
deleteVertex(String id)
Delete a vertex with the given ID.
|
void |
deleteVertex(com.tinkerpop.blueprints.Vertex vertex)
Delete the given vertex.
|
boolean |
exists(String id)
Check if a node with the given ID exists or not.
|
<E> com.tinkerpop.blueprints.CloseableIterable<E> |
getEntities(EntityClass type,
Class<E> cls)
Get an Iterable of vertices of the given type, frames with the given
interface class.
|
<E> com.tinkerpop.blueprints.CloseableIterable<E> |
getEntities(String key,
Object value,
EntityClass type,
Class<E> cls)
Get a CloseableIterable of entities with the given type, and the given
key/value property.
|
<E> E |
getEntity(String id,
Class<E> cls)
Get a node with the given ID, and frame it with the given interface
class.
|
<E> E |
getEntity(String id,
EntityClass type,
Class<E> cls)
Get a node with the given ID and type, framing it with the given
interface class.
|
EntityClass |
getEntityClass(Entity entity)
Get the type of an arbitrary framed vertex.
|
EntityClass |
getEntityClass(com.tinkerpop.blueprints.Vertex vertex)
Get the type of an arbitrary vertex.
|
com.tinkerpop.frames.FramedGraph<T> |
getGraph()
Get a pointer to the underlying graph.
|
String |
getId(com.tinkerpop.blueprints.Vertex vertex)
Get the id of a given vertex.
|
Map<String,Object> |
getProperties(com.tinkerpop.blueprints.Vertex vertex)
Get a vertex's properties.
|
String |
getType(com.tinkerpop.blueprints.Vertex vertex)
Get the id of a given vertex.
|
com.tinkerpop.blueprints.Vertex |
getVertex(String id)
Get a node with the given ID.
|
com.tinkerpop.blueprints.CloseableIterable<com.tinkerpop.blueprints.Vertex> |
getVertices(EntityClass type)
Get a CloseableIterable of vertices with the given entity class.
|
com.tinkerpop.blueprints.CloseableIterable<com.tinkerpop.blueprints.Vertex> |
getVertices(Iterable<String> ids)
Get a CloseableIterable of vertices with the given ids.
|
com.tinkerpop.blueprints.CloseableIterable<com.tinkerpop.blueprints.Vertex> |
getVertices(String key,
Object value,
EntityClass type)
Get a CloseableIterable of vertices with the given type, and the given
key/value property.
|
void |
initialize() |
void |
renameVertex(com.tinkerpop.blueprints.Vertex vertex,
String oldId,
String newId)
Rename an existing vertex, changing its ID.
|
void |
setProperty(com.tinkerpop.blueprints.Vertex vertex,
String key,
Object value)
Set a property on a vertex.
|
com.tinkerpop.blueprints.Vertex |
updateVertex(String id,
EntityClass type,
Map<String,?> data)
Create a vertex with the given id, type, and data.
|
protected static final String METADATA_PREFIX
protected final com.tinkerpop.frames.FramedGraph<T extends com.tinkerpop.blueprints.Graph> graph
public BlueprintsGraphManager(com.tinkerpop.frames.FramedGraph<T> graph)
public com.tinkerpop.frames.FramedGraph<T> getGraph()
GraphManager
getGraph
in interface GraphManager
public String getId(com.tinkerpop.blueprints.Vertex vertex)
GraphManager
getId
in interface GraphManager
vertex
- A vertexpublic String getType(com.tinkerpop.blueprints.Vertex vertex)
GraphManager
getType
in interface GraphManager
vertex
- A vertexpublic Map<String,Object> getProperties(com.tinkerpop.blueprints.Vertex vertex)
GraphManager
getProperties
in interface GraphManager
public EntityClass getEntityClass(com.tinkerpop.blueprints.Vertex vertex)
GraphManager
getEntityClass
in interface GraphManager
vertex
- A vertexpublic EntityClass getEntityClass(Entity entity)
GraphManager
getEntityClass
in interface GraphManager
entity
- A framed vertexpublic boolean exists(String id)
GraphManager
exists
in interface GraphManager
id
- A string idpublic <E> E getEntity(String id, Class<E> cls) throws ItemNotFound
GraphManager
getEntity
in interface GraphManager
id
- The vertex's string IDcls
- The desired frame classItemNotFound
public <E> E getEntity(String id, EntityClass type, Class<E> cls) throws ItemNotFound
GraphManager
getEntity
in interface GraphManager
id
- The vertex's string IDtype
- The entity typecls
- The desired frame classItemNotFound
public <E> com.tinkerpop.blueprints.CloseableIterable<E> getEntities(EntityClass type, Class<E> cls)
GraphManager
getEntities
in interface GraphManager
type
- The entity typepublic <E> com.tinkerpop.blueprints.CloseableIterable<E> getEntities(String key, Object value, EntityClass type, Class<E> cls)
GraphManager
getEntities
in interface GraphManager
key
- the property keyvalue
- property valuetype
- the entity typepublic com.tinkerpop.blueprints.Vertex getVertex(String id) throws ItemNotFound
GraphManager
getVertex
in interface GraphManager
id
- The vertex's string IDItemNotFound
public com.tinkerpop.blueprints.CloseableIterable<com.tinkerpop.blueprints.Vertex> getVertices(EntityClass type)
GraphManager
getVertices
in interface GraphManager
type
- The entity typepublic com.tinkerpop.blueprints.CloseableIterable<com.tinkerpop.blueprints.Vertex> getVertices(Iterable<String> ids)
GraphManager
getVertices
in interface GraphManager
ids
- An iterable of String IDspublic com.tinkerpop.blueprints.CloseableIterable<com.tinkerpop.blueprints.Vertex> getVertices(String key, Object value, EntityClass type)
GraphManager
getVertices
in interface GraphManager
key
- the property keyvalue
- property valuetype
- the entity typepublic com.tinkerpop.blueprints.Vertex createVertex(String id, EntityClass type, Map<String,?> data) throws IntegrityError
GraphManager
createVertex
in interface GraphManager
id
- The vertex's string IDtype
- The entity typedata
- The data mapIntegrityError
- if an item with the given id already existspublic com.tinkerpop.blueprints.Vertex updateVertex(String id, EntityClass type, Map<String,?> data) throws ItemNotFound
GraphManager
updateVertex
in interface GraphManager
id
- The vertex's string IDtype
- The entity typedata
- The data mapItemNotFound
public void setProperty(com.tinkerpop.blueprints.Vertex vertex, String key, Object value)
GraphManager
setProperty
in interface GraphManager
vertex
- The vertexkey
- The property keyvalue
- The property valuepublic void renameVertex(com.tinkerpop.blueprints.Vertex vertex, String oldId, String newId)
GraphManager
renameVertex
in interface GraphManager
vertex
- the vertexoldId
- the old IDnewId
- the new IDpublic void deleteVertex(String id) throws ItemNotFound
GraphManager
deleteVertex
in interface GraphManager
id
- The vertex's string IDItemNotFound
public void deleteVertex(com.tinkerpop.blueprints.Vertex vertex)
GraphManager
deleteVertex
in interface GraphManager
vertex
- The vertex to deletepublic void initialize()
initialize
in interface GraphManager
Copyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.