Skip to content

Commit

Permalink
Merge pull request #493 from juharris/GraphSail-addVertex
Browse files Browse the repository at this point in the history
GraphSail: add vertex to the store -- Handy; I will add a getVertex, as well.
  • Loading branch information
joshsh committed May 30, 2014
2 parents 800239a + 1b5a71d commit 975fa46
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,25 @@ public void enforceUniqueStatements(final boolean flag) {
store.uniqueStatements = flag;
}

/**
* Adds a vertex to the store.
* <p>
* This is useful for adding all of your nodes to the graph before adding
* edges. Since adding edges often involves trying to find each vertex,
* there would initially be many lookup misses, unless this methods is used
* intially to add vertices.
* </p>
*
* @param value
* The value used to initialize the vertex. It will be used to
* set other property on the vertex such as the {@value #KIND}
* and {@value #LANG}.
* @return The newly created vertex.
*/
public Vertex addVertex(Value value) {
return store.addVertex(value);
}

public String toString() {
String type = store.graph.getClass().getSimpleName().toLowerCase();
return "graphsail[" + type + "]";
Expand Down

0 comments on commit 975fa46

Please sign in to comment.