本文整理了Java中org.vertexium.Edge
类的一些代码示例,展示了Edge
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge
类的具体详情如下:
包路径:org.vertexium.Edge
类名称:Edge
暂无
代码示例来源:origin: org.vertexium/vertexium-accumulo
public EdgeBuilderByVertexId prepareEdge(Edge edge) {
return prepareEdge(
edge.getId(),
edge.getVertexId(Direction.OUT),
edge.getVertexId(Direction.IN),
edge.getLabel(),
edge.getTimestamp(),
edge.getVisibility()
);
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
@Override
protected boolean isIncluded(Edge o) {
String entityVertexId = o.getOtherVertexId(workspaceVertex.getId());
return entityVertexId.equalsIgnoreCase(vertexId);
}
};
代码示例来源:origin: org.visallo/visallo-core
Authorizations authorizations
) {
Vertex inVertex = edge.getVertex(Direction.IN, authorizations);
addSourceInfoToVertex(
inVertex,
propertyName,
propertyVisibility,
edge.getId(),
snippet,
textPropertyKey,
代码示例来源:origin: org.vertexium/vertexium-core
/**
* Get the attach vertex on either side of the edge.
*
* @param direction The side of the edge to get the vertex from (IN or OUT).
* @param fetchHints Hint on what should be fetched from the datastore.
* @return The vertex.
*/
default Vertex getVertex(Direction direction, FetchHints fetchHints, Authorizations authorizations) {
String vertexId = getVertexId(direction);
return getGraph().getVertex(vertexId, fetchHints, authorizations);
}
代码示例来源:origin: org.vertexium/vertexium-core
/**
* Get the attach vertex on either side of the edge.
*
* @param direction The side of the edge to get the vertex from (IN or OUT).
* @return The vertex.
*/
default Vertex getVertex(Direction direction, Authorizations authorizations) {
return getVertex(direction, getGraph().getDefaultFetchHints(), authorizations);
}
代码示例来源:origin: org.vertexium/vertexium-test
assertEquals(LABEL_LABEL1, e.getLabel());
Assert.assertEquals(1, count(e.getProperties()));
assertEquals("valueA", e.getPropertyValues("propA").iterator().next());
Assert.assertEquals(1, count(v1.getEdges(Direction.OUT, AUTHORIZATIONS_A)));
Assert.assertEquals(LABEL_LABEL1, IterableUtils.single(v1.getEdgesSummary(AUTHORIZATIONS_A).getOutEdgeLabels()));
e.prepareMutation()
.alterEdgeLabel(LABEL_LABEL2)
.save(AUTHORIZATIONS_A);
graph.flush();
e = graph.getEdge("e1", AUTHORIZATIONS_A);
assertEquals(LABEL_LABEL2, e.getLabel());
Assert.assertEquals(1, count(e.getProperties()));
assertEquals("valueA", e.getPropertyValues("propA").iterator().next());
v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
Assert.assertEquals(1, count(v1.getEdges(Direction.OUT, AUTHORIZATIONS_A)));
graph.prepareEdge(e.getId(), e.getVertexId(Direction.OUT), e.getVertexId(Direction.IN), e.getLabel(), e.getVisibility())
.alterEdgeLabel("label3")
.save(AUTHORIZATIONS_A);
graph.flush();
e = graph.getEdge("e1", AUTHORIZATIONS_A);
assertEquals("label3", e.getLabel());
Assert.assertEquals(1, count(e.getProperties()));
assertEquals("valueA", e.getPropertyValues("propA").iterator().next());
v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
Assert.assertEquals(1, count(v1.getEdges(Direction.OUT, AUTHORIZATIONS_A)));
代码示例来源:origin: visallo/vertexium
void addInEdge(Edge edge) {
if (this.inEdges instanceof EdgesWithEdgeInfo) {
((EdgesWithEdgeInfo) this.inEdges).add(edge.getId(), new org.vertexium.accumulo.iterator.model.EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.OUT)));
} else {
throw new VertexiumException("Cannot add edge");
}
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
public void alterEdgeLabel(Edge edge, String newEdgeLabel) {
ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
Mutation m = createAlterEdgeLabelMutation(edge, newEdgeLabel, edgeColumnVisibility);
saveEdgeMutation(m);
saveEdgeInfoOnVertex(
edge.getId(),
edge.getVertexId(Direction.OUT),
edge.getVertexId(Direction.IN),
newEdgeLabel,
edgeColumnVisibility
);
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
checkNotNull(edge);
Span trace = Trace.start("markEdgeHidden");
trace.data("edgeId", edge.getId());
try {
Vertex out = edge.getVertex(Direction.OUT, authorizations);
if (out == null) {
throw new VertexiumException(String.format("Unable to mark edge hidden %s, can't find out vertex %s", edge.getId(), edge.getVertexId(Direction.OUT)));
Vertex in = edge.getVertex(Direction.IN, authorizations);
if (in == null) {
throw new VertexiumException(String.format("Unable to mark edge hidden %s, can't find in vertex %s", edge.getId(), edge.getVertexId(Direction.IN)));
outMutation.put(AccumuloVertex.CF_OUT_EDGE_HIDDEN, new Text(edge.getId()), columnVisibility, AccumuloElement.HIDDEN_VALUE);
inMutation.put(AccumuloVertex.CF_IN_EDGE_HIDDEN, new Text(edge.getId()), columnVisibility, AccumuloElement.HIDDEN_VALUE);
addMutations(VertexiumObjectType.EDGE, getMarkHiddenRowMutation(edge.getId(), columnVisibility));
代码示例来源:origin: org.vertexium/vertexium-test
graph.flush();
assertNotNull(addedEdge);
assertEquals("e1", addedEdge.getId());
assertEquals(LABEL_LABEL1, addedEdge.getLabel());
assertEquals("v1", addedEdge.getVertexId(Direction.OUT));
assertEquals(v1, addedEdge.getVertex(Direction.OUT, AUTHORIZATIONS_A));
assertEquals("v2", addedEdge.getVertexId(Direction.IN));
assertEquals(v2, addedEdge.getVertex(Direction.IN, AUTHORIZATIONS_A));
assertEquals(VISIBILITY_A, addedEdge.getVisibility());
EdgeVertices addedEdgeVertices = addedEdge.getVertices(AUTHORIZATIONS_A);
assertEquals(v1, addedEdgeVertices.getOutVertex());
assertEquals(v2, addedEdgeVertices.getInVertex());
assertEquals("e1", e.getId());
assertEquals(LABEL_LABEL1, e.getLabel());
assertEquals("v1", e.getVertexId(Direction.OUT));
assertEquals(v1, e.getVertex(Direction.OUT, AUTHORIZATIONS_A));
assertEquals("v2", e.getVertexId(Direction.IN));
assertEquals(v2, e.getVertex(Direction.IN, AUTHORIZATIONS_A));
assertEquals(VISIBILITY_A, e.getVisibility());
代码示例来源:origin: org.visallo/visallo-core
public static JSONObject toJsonEdge(Edge edge, String workspaceId) {
try {
JSONObject json = toJsonElement(edge, workspaceId);
json.put("label", edge.getLabel());
json.put("outVertexId", edge.getVertexId(Direction.OUT));
json.put("inVertexId", edge.getVertexId(Direction.IN));
return json;
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.visallo/visallo-core
protected void broadcastEdgeDeletion(Edge edge) {
JSONObject dataJson = new JSONObject();
if (edge != null) {
dataJson.put("edgeId", edge.getId());
dataJson.put("outVertexId", edge.getVertexId(Direction.OUT));
dataJson.put("inVertexId", edge.getVertexId(Direction.IN));
}
JSONObject json = new JSONObject();
json.put("type", "edgeDeletion");
json.put("data", dataJson);
broadcastJson(json);
}
代码示例来源:origin: org.visallo/visallo-web
@Handle
public ClientApiEdge handle(
@Required(name = "graphEdgeId") String graphEdgeId,
@ActiveWorkspaceId String workspaceId,
Authorizations authorizations
) throws Exception {
Edge edge = graph.getEdge(graphEdgeId, authorizations);
if (edge == null) {
throw new VisalloResourceNotFoundException("Could not find edge: " + graphEdgeId);
}
Vertex outVertex = edge.getVertex(Direction.OUT, authorizations);
if (outVertex == null) {
throw new VisalloResourceNotFoundException("Could not find outVertex: " + edge.getVertexId(Direction.OUT));
}
Vertex inVertex = edge.getVertex(Direction.IN, authorizations);
if (inVertex == null) {
throw new VisalloResourceNotFoundException("Could not find inVertex: " + edge.getVertexId(Direction.IN));
}
return ClientApiConverter.toClientApiEdgeWithVertexData(edge, outVertex, inVertex, workspaceId, authorizations);
}
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
private Mutation createAlterEdgeLabelMutation(Edge edge, String newEdgeLabel, ColumnVisibility edgeColumnVisibility) {
String edgeRowKey = edge.getId();
Mutation m = new Mutation(edgeRowKey);
m.putDelete(AccumuloEdge.CF_SIGNAL, new Text(edge.getLabel()), edgeColumnVisibility, currentTimeMillis());
m.put(AccumuloEdge.CF_SIGNAL, new Text(newEdgeLabel), edgeColumnVisibility, currentTimeMillis(), ElementMutationBuilder.EMPTY_VALUE);
return m;
}
代码示例来源:origin: org.vertexium/vertexium-cypher
private String columnEdgeToString(VertexiumCypherQueryContext ctx, Edge edge) {
StringBuilder result = new StringBuilder();
result.append("[");
result.append(":");
result.append(edge.getLabel());
if (count(edge.getProperties()) > 0) {
result.append(" ");
result.append(elementPropertiesToString(ctx, edge));
}
result.append("]");
return result.toString();
}
代码示例来源:origin: org.vertexium/vertexium-core
@Override
protected EdgeVertexPair convert(Edge edge) {
String otherVertexId = edge.getOtherVertexId(sourceVertexId);
Vertex otherVertex = vertices.get(otherVertexId);
if (otherVertex == null) {
throw new VertexiumException("Found an edge " + edge.getId() + ", but could not find the vertex on the other end: " + otherVertexId);
}
return new EdgeVertexPair(edge, otherVertex);
}
};
代码示例来源:origin: visallo/vertexium
private Direction getDirection(String previousVertexId, Edge element) {
if (element.getVertexId(Direction.OUT).equals(previousVertexId)) {
return Direction.OUT;
} else {
return Direction.IN;
}
}
代码示例来源:origin: org.vertexium/vertexium-test
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
e1.addPropertyValue("k1", "n1", "value1", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v2, v1, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
assertNotNull(e1_none);
assertThrowsException(e1_none::getProperties);
assertEquals("v1", e1_none.getVertexId(Direction.OUT));
assertEquals("v2", e1_none.getVertexId(Direction.IN));
assertEquals(1, IterableUtils.count(e1_default.getProperties()));
assertEquals("v1", e1_default.getVertexId(Direction.OUT));
assertEquals("v2", e1_default.getVertexId(Direction.IN));
assertEquals(1, IterableUtils.count(e1_properties.getProperties()));
assertEquals("v1", e1_properties.getVertexId(Direction.OUT));
assertEquals("v2", e1_properties.getVertexId(Direction.IN));
代码示例来源:origin: org.vertexium/vertexium-blueprints
@Override
public String getLabel() {
return getVertexiumElement().getLabel();
}
代码示例来源:origin: org.vertexium/vertexium-test
Assert.assertEquals(1, count(e.getProperties()));
assertEquals("valueA", e.getPropertyValues("propA").iterator().next());
Property propA = e.getProperty("", "propA");
assertNotNull(propA);
e.markPropertyHidden(propA, VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
graph.flush();
Assert.assertEquals(0, count(e.getProperties()));
Assert.assertEquals(0, count(e.getPropertyValues("propA")));
e.setProperty(propA.getName(), "valueA_changed", VISIBILITY_B, AUTHORIZATIONS_A_AND_B);
graph.flush();
Assert.assertEquals(1, count(e.getProperties()));
assertEquals("valueA_changed", e.getPropertyValues("propA").iterator().next());
e.markPropertyVisible(propA, VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
graph.flush();
Assert.assertEquals(2, count(e.getProperties()));
Assert.assertEquals(2, count(e.getPropertyValues("propA")));
List<Object> propertyValues = IterableUtils.toList(e.getPropertyValues("propA"));
assertTrue(propertyValues.contains("valueA"));
assertTrue(propertyValues.contains("valueA_changed"));
内容来源于网络,如有侵权,请联系作者删除!