本文整理了Java中org.vertexium.Vertex.getEdges()
方法的一些代码示例,展示了Vertex.getEdges()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getEdges()
方法的具体详情如下:
包路径:org.vertexium.Vertex
类名称:Vertex
方法名:getEdges
[英]Gets all edges with the given label attached to this vertex.
[中]
代码示例来源:origin: org.visallo/visallo-model-vertexium
protected ImmutableList<String> getDependentPropertyIris(Vertex vertex, String workspaceId) {
List<Edge> dependentProperties = Lists.newArrayList(vertex.getEdges(Direction.OUT, OntologyProperties.EDGE_LABEL_DEPENDENT_PROPERTY, getAuthorizations(workspaceId)));
dependentProperties.sort((e1, e2) -> {
Integer o1 = OntologyProperties.DEPENDENT_PROPERTY_ORDER_PROPERTY_NAME.getPropertyValue(e1, 0);
Integer o2 = OntologyProperties.DEPENDENT_PROPERTY_ORDER_PROPERTY_NAME.getPropertyValue(e2, 0);
return Integer.compare(o1, o2);
});
return ImmutableList.copyOf(dependentProperties.stream().map(e -> {
String propertyId = e.getOtherVertexId(vertex.getId());
return propertyId.substring(VertexiumOntologyRepository.ID_PREFIX_PROPERTY.length());
}).collect(Collectors.toList()));
}
代码示例来源:origin: org.visallo/visallo-core
@Override
public void cleanUpElements(Graph graph, Vertex productVertex, Authorizations authorizations) {
Iterable<Edge> productElementEdges = productVertex.getEdges(
Direction.OUT,
WorkspaceProperties.PRODUCT_TO_ENTITY_RELATIONSHIP_IRI,
authorizations
);
for (Edge productToElement : productElementEdges) {
graph.softDeleteEdge(productToElement, authorizations);
}
graph.flush();
}
代码示例来源:origin: org.vertexium/vertexium-core
private Iterable<Edge> allEdges(FetchHints fetchHints) {
Iterable<Edge> results = getSourceVertex().getEdges(getDirection(), fetchHints, getParameters().getAuthorizations());
if (getOtherVertexId() != null) {
results = new FilterIterable<Edge>(results) {
@Override
protected boolean isIncluded(Edge edge) {
return edge.getOtherVertexId(getSourceVertex().getId()).equals(getOtherVertexId());
}
};
}
return results;
}
代码示例来源:origin: visallo/vertexium
private Iterable<Edge> allEdges(FetchHints fetchHints) {
Iterable<Edge> results = getSourceVertex().getEdges(getDirection(), fetchHints, getParameters().getAuthorizations());
if (getOtherVertexId() != null) {
results = new FilterIterable<Edge>(results) {
@Override
protected boolean isIncluded(Edge edge) {
return edge.getOtherVertexId(getSourceVertex().getId()).equals(getOtherVertexId());
}
};
}
return results;
}
代码示例来源:origin: org.visallo/visallo-web-product-graph
@Override
public void cleanUpElements(
Graph graph,
Vertex productVertex,
Authorizations authorizations
) {
Iterable<Edge> productElementEdges = productVertex.getEdges(
Direction.OUT,
WorkspaceProperties.PRODUCT_TO_ENTITY_RELATIONSHIP_IRI,
authorizations
);
for (Edge productToElement : productElementEdges) {
if (GraphProductOntology.NODE_CHILDREN.hasProperty(productToElement)) {
String otherElementId = productToElement.getOtherVertexId(productVertex.getId());
graph.softDeleteVertex(otherElementId, authorizations);
} else {
graph.softDeleteEdge(productToElement, authorizations);
}
}
graph.flush();
}
代码示例来源:origin: org.vertexium/vertexium-test
@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, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v2, LABEL_LABEL2, VISIBILITY_B, AUTHORIZATIONS_B);
graph.flush();
Iterable<Edge> aEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A);
Assert.assertEquals(1, count(aEdges));
assertEquals(LABEL_LABEL1, IterableUtils.single(aEdges).getLabel());
Iterable<Edge> bEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_B);
Assert.assertEquals(1, count(bEdges));
assertEquals(LABEL_LABEL2, IterableUtils.single(bEdges).getLabel());
Iterable<Edge> allEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A_AND_B);
Assert.assertEquals(2, count(allEdges));
}
代码示例来源:origin: visallo/vertexium
@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, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v2, LABEL_LABEL2, VISIBILITY_B, AUTHORIZATIONS_B);
graph.flush();
Iterable<Edge> aEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A);
Assert.assertEquals(1, count(aEdges));
assertEquals(LABEL_LABEL1, IterableUtils.single(aEdges).getLabel());
Iterable<Edge> bEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_B);
Assert.assertEquals(1, count(bEdges));
assertEquals(LABEL_LABEL2, IterableUtils.single(bEdges).getLabel());
Iterable<Edge> allEdges = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getEdges(Direction.BOTH, AUTHORIZATIONS_A_AND_B);
Assert.assertEquals(2, count(allEdges));
}
代码示例来源:origin: org.vertexium/vertexium-cypher
private Stream<Edge> findEdges(
VertexiumCypherQueryContext ctx,
String name,
ListMultimap<String, CypherAstBase> propertiesMap,
Vertex startingVertex,
Direction direction,
List<String> labelNames
) {
if (name == null && propertiesMap.size() == 0) {
return stream(startingVertex.getEdgeInfos(direction, labelNamesToArray(labelNames), ctx.getAuthorizations()))
.map(edgeInfo -> new EdgeInfoEdge(ctx.getGraph(), startingVertex.getId(), edgeInfo, ctx.getFetchHints(), ctx.getAuthorizations()));
}
return stream(startingVertex.getEdges(direction, labelNamesToArray(labelNames), ctx.getFetchHints(), ctx.getAuthorizations()));
}
代码示例来源:origin: visallo/vertexium
private Stream<Edge> findEdges(
VertexiumCypherQueryContext ctx,
String name,
ListMultimap<String, CypherAstBase> propertiesMap,
Vertex startingVertex,
Direction direction,
List<String> labelNames
) {
if (name == null && propertiesMap.size() == 0) {
return stream(startingVertex.getEdgeInfos(direction, labelNamesToArray(labelNames), ctx.getAuthorizations()))
.map(edgeInfo -> new EdgeInfoEdge(ctx.getGraph(), startingVertex.getId(), edgeInfo, ctx.getFetchHints(), ctx.getAuthorizations()));
}
return stream(startingVertex.getEdges(direction, labelNamesToArray(labelNames), ctx.getFetchHints(), ctx.getAuthorizations()));
}
代码示例来源:origin: visallo/vertexium
@Override
public void deleteVertex(Vertex vertex, Authorizations authorizations) {
if (!((InMemoryVertex) vertex).canRead(authorizations)) {
return;
}
List<Edge> edgesToDelete = IterableUtils.toList(vertex.getEdges(Direction.BOTH, authorizations));
for (Edge edgeToDelete : edgesToDelete) {
deleteEdge(edgeToDelete, authorizations);
}
deleteAllExtendedDataForElement(vertex, authorizations);
this.vertices.remove(vertex.getId());
getSearchIndex().deleteElement(this, vertex, authorizations);
if (hasEventListeners()) {
fireGraphEvent(new DeleteVertexEvent(this, vertex));
}
}
代码示例来源:origin: visallo/vertexium
@Override
public void markVertexHidden(Vertex vertex, Visibility visibility, Authorizations authorizations) {
if (!((InMemoryVertex) vertex).canRead(authorizations)) {
return;
}
List<Edge> edgesToMarkHidden = IterableUtils.toList(vertex.getEdges(Direction.BOTH, authorizations));
for (Edge edgeToMarkHidden : edgesToMarkHidden) {
markEdgeHidden(edgeToMarkHidden, visibility, authorizations);
}
this.vertices.getTableElement(vertex.getId()).appendMarkHiddenMutation(visibility);
refreshVertexInMemoryTableElement(vertex);
getSearchIndex().markElementHidden(this, vertex, visibility, authorizations);
if (hasEventListeners()) {
fireGraphEvent(new MarkHiddenVertexEvent(this, vertex));
}
}
代码示例来源:origin: visallo/vertexium
@Override
public void markVertexVisible(Vertex vertex, Visibility visibility, Authorizations authorizations) {
if (!((InMemoryVertex) vertex).canRead(authorizations)) {
return;
}
List<Edge> edgesToMarkVisible = IterableUtils.toList(vertex.getEdges(Direction.BOTH, FetchHints.ALL_INCLUDING_HIDDEN, authorizations));
for (Edge edgeToMarkVisible : edgesToMarkVisible) {
markEdgeVisible(edgeToMarkVisible, visibility, authorizations);
}
this.vertices.getTableElement(vertex.getId()).appendMarkVisibleMutation(visibility);
refreshVertexInMemoryTableElement(vertex);
getSearchIndex().markElementVisible(this, vertex, visibility, authorizations);
if (hasEventListeners()) {
fireGraphEvent(new MarkVisibleVertexEvent(this, vertex));
}
}
代码示例来源:origin: visallo/vertexium
@Override
public void markVertexHidden(Vertex vertex, Visibility visibility, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("softDeleteVertex");
trace.data("vertexId", vertex.getId());
try {
ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(visibility);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, authorizations)) {
markEdgeHidden(edge, visibility, authorizations);
}
addMutations(VertexiumObjectType.VERTEX, getMarkHiddenRowMutation(vertex.getId(), columnVisibility));
getSearchIndex().markElementHidden(this, vertex, visibility, authorizations);
if (hasEventListeners()) {
queueEvent(new MarkHiddenVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: visallo/vertexium
@Override
public void deleteVertex(Vertex vertex, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("deleteVertex");
trace.data("vertexId", vertex.getId());
try {
getSearchIndex().deleteElement(this, vertex, authorizations);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, authorizations)) {
deleteEdge(edge, authorizations);
}
deleteAllExtendedDataForElement(vertex, authorizations);
addMutations(VertexiumObjectType.VERTEX, getDeleteRowMutation(vertex.getId()));
if (hasEventListeners()) {
queueEvent(new DeleteVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
@Override
public void deleteVertex(Vertex vertex, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("deleteVertex");
trace.data("vertexId", vertex.getId());
try {
getSearchIndex().deleteElement(this, vertex, authorizations);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, authorizations)) {
deleteEdge(edge, authorizations);
}
deleteAllExtendedDataForElement(vertex, authorizations);
addMutations(VertexiumObjectType.VERTEX, getDeleteRowMutation(vertex.getId()));
if (hasEventListeners()) {
queueEvent(new DeleteVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
@Override
public void markVertexHidden(Vertex vertex, Visibility visibility, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("softDeleteVertex");
trace.data("vertexId", vertex.getId());
try {
ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(visibility);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, authorizations)) {
markEdgeHidden(edge, visibility, authorizations);
}
addMutations(VertexiumObjectType.VERTEX, getMarkHiddenRowMutation(vertex.getId(), columnVisibility));
getSearchIndex().markElementHidden(this, vertex, visibility, authorizations);
if (hasEventListeners()) {
queueEvent(new MarkHiddenVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
@Override
public void markVertexVisible(Vertex vertex, Visibility visibility, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("softDeleteVertex");
trace.data("vertexId", vertex.getId());
try {
ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(visibility);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, FetchHints.ALL_INCLUDING_HIDDEN, authorizations)) {
markEdgeVisible(edge, visibility, authorizations);
}
addMutations(VertexiumObjectType.VERTEX, getMarkVisibleRowMutation(vertex.getId(), columnVisibility));
getSearchIndex().markElementVisible(this, vertex, visibility, authorizations);
if (hasEventListeners()) {
queueEvent(new MarkVisibleVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: visallo/vertexium
@Override
public void markVertexVisible(Vertex vertex, Visibility visibility, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("softDeleteVertex");
trace.data("vertexId", vertex.getId());
try {
ColumnVisibility columnVisibility = visibilityToAccumuloVisibility(visibility);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, FetchHints.ALL_INCLUDING_HIDDEN, authorizations)) {
markEdgeVisible(edge, visibility, authorizations);
}
addMutations(VertexiumObjectType.VERTEX, getMarkVisibleRowMutation(vertex.getId(), columnVisibility));
getSearchIndex().markElementVisible(this, vertex, visibility, authorizations);
if (hasEventListeners()) {
queueEvent(new MarkVisibleVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: visallo/vertexium
@Override
public void softDeleteVertex(Vertex vertex, Long timestamp, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("softDeleteVertex");
trace.data("vertexId", vertex.getId());
try {
if (timestamp == null) {
timestamp = IncreasingTime.currentTimeMillis();
}
getSearchIndex().deleteElement(this, vertex, authorizations);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, authorizations)) {
softDeleteEdge(edge, timestamp, authorizations);
}
addMutations(VertexiumObjectType.VERTEX, getSoftDeleteRowMutation(vertex.getId(), timestamp));
if (hasEventListeners()) {
queueEvent(new SoftDeleteVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
@Override
public void softDeleteVertex(Vertex vertex, Long timestamp, Authorizations authorizations) {
checkNotNull(vertex, "vertex cannot be null");
Span trace = Trace.start("softDeleteVertex");
trace.data("vertexId", vertex.getId());
try {
if (timestamp == null) {
timestamp = IncreasingTime.currentTimeMillis();
}
getSearchIndex().deleteElement(this, vertex, authorizations);
// Delete all edges that this vertex participates.
for (Edge edge : vertex.getEdges(Direction.BOTH, authorizations)) {
softDeleteEdge(edge, timestamp, authorizations);
}
addMutations(VertexiumObjectType.VERTEX, getSoftDeleteRowMutation(vertex.getId(), timestamp));
if (hasEventListeners()) {
queueEvent(new SoftDeleteVertexEvent(this, vertex));
}
} finally {
trace.stop();
}
}
内容来源于网络,如有侵权,请联系作者删除!