@Override protected String convert(Edge o) { return o.getLabel(); } });
@Override protected boolean isIncluded(Edge o) { return label.equals(o.getLabel()); } };
@Override protected boolean isIncluded(Edge o) { return label.equals(o.getLabel()); } };
@Override protected boolean isIncluded(Edge o) { return label.equals(o.getLabel()); } };
@Override protected boolean isIncluded(Edge edge) { for (String label : labels) { if (label.equals(edge.getLabel())) { return true; } } return false; } };
@Override protected boolean isIncluded(Edge o) { return label.equals(o.getLabel()); } };
@Override public String getLabel() { return getSecureGraphElement().getLabel(); }
@Override public String getLabel() { return getSecureGraphElement().getLabel(); }
private JSONObject edgeToJson(Edge edge) { JSONObject json = elementToJson(edge); json.put("outVertexId", edge.getVertexId(Direction.OUT)); json.put("inVertexId", edge.getVertexId(Direction.IN)); json.put("label", edge.getLabel()); return json; }
void addOutEdge(Edge edge) { this.outEdges.put(edge.getId(), new EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.IN))); }
void addInEdge(Edge edge) { this.inEdges.put(edge.getId(), new EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.OUT))); }
@Override public String toString() { if (this instanceof Edge) { Edge edge = (Edge) this; return getId() + ":[" + edge.getVertexId(Direction.OUT) + "-" + edge.getLabel() + "->" + edge.getVertexId(Direction.IN) + "]"; } return getId(); }
@Override public String toString() { if (this instanceof Edge) { Edge edge = (Edge) this; return getId() + ":[" + edge.getVertexId(Direction.OUT) + "-" + edge.getLabel() + "->" + edge.getVertexId(Direction.IN) + "]"; } return getId(); }
public EdgeBuilderByVertexId prepareEdge(Edge edge) { return prepareEdge( edge.getId(), edge.getVertexId(Direction.OUT), edge.getVertexId(Direction.IN), edge.getLabel(), edge.getVisibility() ); }
public boolean alterEdgeVertexInVertex(Mutation mvin, Edge edge, Visibility newVisibility) { ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility()); ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility); if (currentColumnVisibility.equals(newColumnVisibility)) { return false; } EdgeInfo edgeInfo = new EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.OUT)); mvin.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), currentColumnVisibility); mvin.put(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue()); return true; }
public boolean alterEdgeVertexOutVertex(Mutation mvout, Edge edge, Visibility newVisibility) { ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility()); ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility); if (currentColumnVisibility.equals(newColumnVisibility)) { return false; } EdgeInfo edgeInfo = new EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.IN)); mvout.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), currentColumnVisibility); mvout.put(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue()); return true; }
@Test public void testAddEdgeWithVisibility() { Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A); Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A); graph.addEdge("e1", v1, v2, "edgeA", VISIBILITY_A, AUTHORIZATIONS_A); graph.addEdge("e2", v1, v2, "edgeB", VISIBILITY_B, AUTHORIZATIONS_B); Iterable<Edge> aEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A); assertEquals(1, count(aEdges)); Edge e1 = aEdges.iterator().next(); assertNotNull(e1); assertEquals("edgeA", e1.getLabel()); Iterable<Edge> bEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_B); assertEquals(1, count(bEdges)); Edge e2 = bEdges.iterator().next(); assertNotNull(e2); assertEquals("edgeB", e2.getLabel()); Iterable<Edge> allEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A_AND_B); assertEquals(2, count(allEdges)); }
@Test public void testAddEdgeWithVisibility() { Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A); Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A); graph.addEdge("e1", v1, v2, "edgeA", VISIBILITY_A, AUTHORIZATIONS_A); graph.addEdge("e2", v1, v2, "edgeB", VISIBILITY_B, AUTHORIZATIONS_B); Iterable<Edge> aEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A); assertEquals(1, count(aEdges)); Edge e1 = aEdges.iterator().next(); assertNotNull(e1); assertEquals("edgeA", e1.getLabel()); Iterable<Edge> bEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_B); assertEquals(1, count(bEdges)); Edge e2 = bEdges.iterator().next(); assertNotNull(e2); assertEquals("edgeB", e2.getLabel()); Iterable<Edge> allEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A_AND_B); assertEquals(2, count(allEdges)); }
assertNotNull(addedEdge); assertEquals("e1", addedEdge.getId()); assertEquals("label1", addedEdge.getLabel()); assertEquals("v1", addedEdge.getVertexId(Direction.OUT)); assertEquals(v1, addedEdge.getVertex(Direction.OUT, AUTHORIZATIONS_A)); assertNotNull(e); assertEquals("e1", e.getId()); assertEquals("label1", e.getLabel()); assertEquals("v1", e.getVertexId(Direction.OUT)); assertEquals(v1, e.getVertex(Direction.OUT, AUTHORIZATIONS_A));
assertNotNull(addedEdge); assertEquals("e1", addedEdge.getId()); assertEquals("label1", addedEdge.getLabel()); assertEquals("v1", addedEdge.getVertexId(Direction.OUT)); assertEquals(v1, addedEdge.getVertex(Direction.OUT, AUTHORIZATIONS_A)); assertNotNull(e); assertEquals("e1", e.getId()); assertEquals("label1", e.getLabel()); assertEquals("v1", e.getVertexId(Direction.OUT)); assertEquals(v1, e.getVertex(Direction.OUT, AUTHORIZATIONS_A));