Skip to content

Property Graph Model

okram edited this page Oct 29, 2010 · 31 revisions

Blueprints provides a property graph data model. The property graph model is made up of a collection of Java interfaces. In order to make a graph framework “Blueprints-enabled”, all that is required is that these interfaces be implemented. Moreover, any applications that write to the Blueprints property graph model API can make use of different graph frameworks (i.e. plug and play graph backends). This section will describe the interfaces of the property graph model.

The property graph interfaces are itemized below and in the following sub-sections, their method signatures presented.

  1. graph: an object that contains vertices and edges.
    • transactional graph: a graph that supports transactions
    • indexable graph: a graph that supports indices
  2. element: an object that maintains properties (i.e. key/value pair map).
    • vertex: an object that is connected to other objects by edges.
    • edge: an object that connects two vertices.
  3. index: an object that maintains a map structure of key/value pairs to elements.
    • automatic index: an index that manages itself as elements are updated.

In order to aid in the understanding of the various methods defined below, the following diagram identifies the names of the different components of a graph.

Graph

public Vertex addVertex(Object id);
public Vertex getVertex(Object id);
public Iterable<Vertex> getVertices();
public void removeVertex(Vertex vertex);
public Edge addEdge(Object id, Vertex outVertex, Vertex inVertex, String label);
public Iterable<Edge> getEdges();
public void removeEdge(Edge edge);
public void clear();
public void shutdown();

TransactionalGraph (extends Graph)

public void startTransaction();
public void stopTransaction(Conclusion conclusion);
public void setTransactionMode(Mode mode);
public Mode getTransactionMode();

IndexableGraph (extends Graph)

public <T extends Element> Index<T> createIndex(String indexName, Class<T> indexClass, Index.Type type);
public <T extends Element> Index<T> getIndex(String indexName, Class<T> indexClass);
public Iterable<Index> getIndices();
public void dropIndex(String indexName);

Element

public Object getProperty(String key);
public Set<String> getPropertyKeys();
public void setProperty(String key, Object value);
public Object getId();

Vertex (extends Element)

public Iterable<Edge> getOutEdges();
public Iterable<Edge> getInEdges();

Edge (extends Element)

public Vertex getOutVertex();
public Vertex getInVertex();
public String getLabel();

Index

public String getIndexName();
public Class<T> getIndexClass();
public void put(String key, Object value, T element);
public Iterable<T> get(String key, Object value);
public void remove(String key, Object value, T element);

AutomaticIndex (extends Index)

public void addAutoIndexKey(String key);
public void removeAutoIndexKey(String key);
public Set<String> getAutoIndexKeys();