Java Code Examples for com.tinkerpop.blueprints.Vertex#getId()
The following examples show how to use
com.tinkerpop.blueprints.Vertex#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransactionalLongVersionedGraphTest.java From antiquity with GNU General Public License v3.0 | 6 votes |
@Test public void testMultipleChangesInOneTransactionHaveSameVersion() { Vertex initial = graph.addVertex("vInit"); commit(); Object initialId = initial.getId(); Long ver1 = graph.getLatestGraphVersion(); assertThat(ver1, notNullValue()); Vertex v1 = graph.addVertex("v1"); Vertex v2 = graph.addVertex("v2"); Vertex v3 = graph.addVertex("v3"); graph.removeVertex(initial); commit(); Long ver2 = graph.getLatestGraphVersion(); assertThat(graph.utils.getVersionRange(graph.getHistoricGraph().getVertex(initialId)), is(Range.range(ver1, ver1))); assertThat(graph.utils.getVersionRange(graph.getHistoricGraph().getVertex(v1.getId())), is(Range.range(ver2, graph.getMaxPossibleGraphVersion()))); assertThat(graph.utils.getVersionRange(graph.getHistoricGraph().getVertex(v2.getId())), is(Range.range(ver2, graph.getMaxPossibleGraphVersion()))); assertThat(graph.utils.getVersionRange(graph.getHistoricGraph().getVertex(v3.getId())), is(Range.range(ver2, graph.getMaxPossibleGraphVersion()))); }
Example 2
Source File: FunctionExportPlugin.java From bjoern with GNU General Public License v3.0 | 5 votes |
private static void copyVertex(Graph graph, Vertex vertex) { Object id = vertex.getId(); if (graph.getVertex(id) != null) { return; } Vertex v = GraphHelper.addVertex(graph, id); if (v != null) { ElementHelper.copyProperties(vertex, v); } }
Example 3
Source File: DEdgeEntryList.java From org.openntf.domino with Apache License 2.0 | 5 votes |
@Override public Edge findEdge(final Vertex toVertex) { Edge result = null; Object toId = toVertex.getId(); Object fromId = source_.getId(); if (this.size() > 0) { for (Edge edge : this) { if (edge instanceof DEdge) { DEdge dedge = (DEdge) edge; if (toId.equals(dedge.getOtherVertexId(source_))) { result = dedge; break; } } else { Vertex inVertex = edge.getVertex(Direction.IN); if (fromId.equals(inVertex.getId())) { if (toId.equals(edge.getVertex(Direction.OUT))) { result = edge; break; } } else if (toId.equals(inVertex.getId())) { result = edge; break; } } } } else { // System.out.println("DEBUG: No edges defined in EdgeList"); } return result; }
Example 4
Source File: DEdgeList.java From org.openntf.domino with Apache License 2.0 | 5 votes |
@Override public Edge findEdge(final Vertex toVertex) { Edge result = null; Object toId = toVertex.getId(); Object fromId = sourceVertex_.getId(); if (this.size() > 0) { for (Edge edge : this) { if (edge instanceof DEdge) { DEdge dedge = (DEdge) edge; if (toId.equals(dedge.getOtherVertexId(sourceVertex_))) { result = dedge; break; } } else { Vertex inVertex = edge.getVertex(Direction.IN); if (fromId.equals(inVertex.getId())) { if (toId.equals(edge.getVertex(Direction.OUT))) { result = edge; break; } } else if (toId.equals(inVertex.getId())) { result = edge; break; } } } } else { // System.out.println("DEBUG: No edges defined in EdgeList"); } return result; }
Example 5
Source File: StringFactory.java From org.openntf.domino with Apache License 2.0 | 4 votes |
public static String vertexString(final Vertex vertex) { return V + L_BRACKET + vertex.getId() + R_BRACKET; }
Example 6
Source File: DEdge.java From org.openntf.domino with Apache License 2.0 | 4 votes |
void setInVertex(final Vertex in) { ((DVertex) in).addInEdge(this); in_ = in; inKey_ = in.getId(); setProperty(org.openntf.domino.graph2.DEdge.IN_NAME, inKey_.toString()); }
Example 7
Source File: DEdge.java From org.openntf.domino with Apache License 2.0 | 4 votes |
void setOutVertex(final Vertex out) { ((DVertex) out).addOutEdge(this); out_ = out; outKey_ = out.getId(); setProperty(org.openntf.domino.graph2.DEdge.OUT_NAME, outKey_.toString()); }
Example 8
Source File: DFastEdgeList.java From org.openntf.domino with Apache License 2.0 | 4 votes |
@Override public Edge findEdge(final Vertex toVertex) { Edge result = null; Object toId = toVertex.getId(); Object fromId = sourceVertex_.getId(); if (isUnique() && !isEmpty()) { if (toId instanceof NoteCoordinate && fromId instanceof NoteCoordinate) { String toString = ((NoteCoordinate) toId).toString(); String fromString = ((NoteCoordinate) fromId).toString(); String testString1 = DominoUtils.toUnid(toString + getLabel() + fromString); String testString2 = DominoUtils.toUnid(toString + getLabel() + fromString); NoteCoordinate nc1 = NoteCoordinate.Utils.getNoteCoordinate(storeid_, testString1); NoteCoordinate nc2 = NoteCoordinate.Utils.getNoteCoordinate(storeid_, testString2); if (contains(nc1)) { result = parentGraph_.getEdge(nc1); } else if (contains(nc2)) { result = parentGraph_.getEdge(nc2); } } else { //NTF then we go back to the old way... } } if (result == null && this.size() > 0 && !isUnique()) { for (Edge edge : this) { if (edge instanceof DEdge) { DEdge dedge = (DEdge) edge; if (toId.equals(dedge.getOtherVertexId(sourceVertex_))) { result = dedge; break; } } else { if (edge != null) { Vertex inVertex = edge.getVertex(Direction.IN); if (fromId.equals(inVertex.getId())) { if (toId.equals(edge.getVertex(Direction.OUT))) { result = edge; break; } } else if (toId.equals(inVertex.getId())) { result = edge; break; } } } } } else { // System.out.println("DEBUG: No edges defined in EdgeList"); } return result; }
Example 9
Source File: Converter.java From epcis with Apache License 2.0 | 2 votes |
/** * Return an identifier of edge * * @param outVertexID: * an identifier of out-vertex * @param edgeLabel: * edge label * @param inVertexID: * an identifier of in-vertex * @return an identifier of edge */ public static String getEdgeID(Vertex outVertex, String edgeLabel, Vertex inVertex) { return outVertex.getId() + "|" + edgeLabel + "|" + inVertex.getId(); }