本文整理了Java中org.vertexium.Graph.deleteVertex()
方法的一些代码示例,展示了Graph.deleteVertex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.deleteVertex()
方法的具体详情如下:
包路径:org.vertexium.Graph
类名称:Graph
方法名:deleteVertex
[英]Permanently deletes a vertex from the graph.
[中]从图形中永久删除顶点。
代码示例来源:origin: org.vertexium/vertexium-cypher
public void deleteVertex(Vertex vertex) {
getGraph().deleteVertex(vertex, getAuthorizations());
}
代码示例来源:origin: visallo/vertexium
public void deleteVertex(Vertex vertex) {
getGraph().deleteVertex(vertex, getAuthorizations());
}
代码示例来源:origin: org.vertexium/vertexium-blueprints
@Override
public void removeVertex(Vertex vertex) {
org.vertexium.Vertex sgVertex = VertexiumBlueprintsConvert.toVertexium(vertex);
getGraph().deleteVertex(sgVertex, getAuthorizationsProvider().getAuthorizations());
}
代码示例来源:origin: visallo/vertexium
public void delete() {
getGraph().deleteVertex(getV(), getAuthorizations());
getGraph().flush();
}
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
private void internalDeleteObject(Vertex vertex, String workspaceId) {
Authorizations authorizations = getAuthorizations(workspaceId);
Iterable<EdgeInfo> edges = vertex.getEdgeInfos(Direction.BOTH, authorizations);
for (EdgeInfo edge : edges) {
graph.deleteEdge(edge.getEdgeId(), authorizations);
}
graph.deleteVertex(vertex.getId(), authorizations);
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
@Override
public void delete(String longRunningProcessId, User authUser) {
Authorizations authorizations = getAuthorizations(authUser);
Vertex vertex = this.graph.getVertex(longRunningProcessId, authorizations);
JSONObject json = null;
if (vertex != null) {
json = LongRunningProcessProperties.QUEUE_ITEM_JSON_PROPERTY.getPropertyValue(vertex);
}
this.graph.deleteVertex(vertex, authorizations);
this.graph.flush();
if (json != null) {
workQueueRepository.broadcastLongRunningProcessDeleted(json);
}
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
@Override
public void deleteSearch(final String id, User user) {
checkNotNull(user, "User is required");
Authorizations authorizations = authorizationRepository.getGraphAuthorizations(
user,
VISIBILITY_STRING,
UserRepository.VISIBILITY_STRING
);
Vertex searchVertex = graph.getVertex(id, authorizations);
checkNotNull(searchVertex, "Could not find search with id " + id);
if (isSearchGlobal(id, authorizations)) {
if (!privilegeRepository.hasPrivilege(user, Privilege.SEARCH_SAVE_GLOBAL)) {
throw new VisalloAccessDeniedException(
"User does not have the privilege to delete a global search", user, id);
}
} else if (!isSearchPrivateToUser(id, user, authorizations)) {
throw new VisalloAccessDeniedException("User does not own this this search", user, id);
}
graph.deleteVertex(searchVertex, authorizations);
graph.flush();
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
public void deleteProductAncillaryVertex(String workspaceId, String vertexId, User user, String sourceGuid) {
Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations(
user,
VISIBILITY_STRING,
VISIBILITY_PRODUCT_STRING,
workspaceId
);
List<String> productIds = new ArrayList<>();
try (GraphUpdateContext ctx = graphRepository.beginGraphUpdate(Priority.NORMAL, user, authorizations)) {
Graph graph = ctx.getGraph();
Vertex annotation = getGraph().getVertex(vertexId, authorizations);
annotation.getEdgeInfos(Direction.BOTH, authorizations).forEach(edgeInfo -> {
if (WorkspaceProperties.PRODUCT_TO_ENTITY_RELATIONSHIP_IRI.equals(edgeInfo.getLabel())) {
productIds.add(edgeInfo.getVertexId());
}
graph.deleteEdge(edgeInfo.getEdgeId(), authorizations);
});
graph.deleteVertex(annotation, authorizations);
}
for (String productId : productIds) {
getWorkQueueRepository().broadcastWorkProductAncillaryChange(
productId, workspaceId, vertexId, user, sourceGuid
);
}
}
代码示例来源:origin: visallo/vertexium
@Test
public void testExtendedDataQueryAfterDeleteForVertex() {
graph.prepareVertex("v1", VISIBILITY_A)
.addExtendedData("table1", "row1", "name", "value 1", VISIBILITY_A)
.addExtendedData("table1", "row2", "name", "value 2", VISIBILITY_A)
.save(AUTHORIZATIONS_A);
graph.flush();
List<ExtendedDataRow> searchResultsList = toList(graph.query(AUTHORIZATIONS_A).extendedDataRows());
assertRowIdsAnyOrder(Lists.newArrayList("row1", "row2"), searchResultsList);
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
searchResultsList = toList(graph.query(AUTHORIZATIONS_A).extendedDataRows());
assertRowIdsAnyOrder(Lists.newArrayList(), searchResultsList);
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testExtendedDataQueryAfterDeleteForVertex() {
graph.prepareVertex("v1", VISIBILITY_A)
.addExtendedData("table1", "row1", "name", "value 1", VISIBILITY_A)
.addExtendedData("table1", "row2", "name", "value 2", VISIBILITY_A)
.save(AUTHORIZATIONS_A);
graph.flush();
List<ExtendedDataRow> searchResultsList = toList(graph.query(AUTHORIZATIONS_A).extendedDataRows());
assertRowIdsAnyOrder(Lists.newArrayList("row1", "row2"), searchResultsList);
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
searchResultsList = toList(graph.query(AUTHORIZATIONS_A).extendedDataRows());
assertRowIdsAnyOrder(Lists.newArrayList(), searchResultsList);
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testExtendedDataDelete() {
graph.prepareVertex("v1", VISIBILITY_A)
.addExtendedData("table1", "row1", "name", "value", VISIBILITY_A)
.save(AUTHORIZATIONS_A);
graph.flush();
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<? extends VertexiumObject> searchResults = graph.query("value", AUTHORIZATIONS_A)
.search();
assertEquals(0, searchResults.getTotalHits());
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testDeleteVertex() {
graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
Assert.assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A)));
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
Assert.assertEquals(0, count(graph.getVertices(AUTHORIZATIONS_A)));
}
代码示例来源:origin: visallo/vertexium
@Test
public void testDeleteVertex() {
graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
Assert.assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A)));
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
Assert.assertEquals(0, count(graph.getVertices(AUTHORIZATIONS_A)));
}
代码示例来源:origin: visallo/vertexium
@Test
public void testExtendedDataDelete() {
graph.prepareVertex("v1", VISIBILITY_A)
.addExtendedData("table1", "row1", "name", "value", VISIBILITY_A)
.save(AUTHORIZATIONS_A);
graph.flush();
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<? extends VertexiumObject> searchResults = graph.query("value", AUTHORIZATIONS_A)
.search();
assertEquals(0, searchResults.getTotalHits());
}
代码示例来源:origin: org.vertexium/vertexium-test
graph.deleteVertex("w1", AUTHORIZATIONS_A);
graph.flush();
代码示例来源:origin: visallo/vertexium
graph.deleteVertex("w1", AUTHORIZATIONS_A);
graph.flush();
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testDeleteVertexWithProperties() {
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("prop1", "value1", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Property prop1 = v1.getProperty("prop1");
Assert.assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A)));
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
Assert.assertEquals(0, count(graph.getVertices(AUTHORIZATIONS_A_AND_B)));
assertEvents(
new AddVertexEvent(graph, v1),
new AddPropertyEvent(graph, v1, prop1),
new DeleteVertexEvent(graph, v1)
);
}
代码示例来源:origin: visallo/vertexium
@Test
public void testDeleteVertexWithProperties() {
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("prop1", "value1", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Property prop1 = v1.getProperty("prop1");
Assert.assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A)));
graph.deleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
Assert.assertEquals(0, count(graph.getVertices(AUTHORIZATIONS_A_AND_B)));
assertEvents(
new AddVertexEvent(graph, v1),
new AddPropertyEvent(graph, v1, prop1),
new DeleteVertexEvent(graph, v1)
);
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testDeleteElement() {
Vertex v = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
v.prepareMutation()
.setProperty("prop1", "value1", VISIBILITY_A)
.save(AUTHORIZATIONS_ALL);
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertNotNull(v);
Assert.assertEquals(1, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1").vertices()));
graph.deleteVertex(v.getId(), AUTHORIZATIONS_A_AND_B);
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertNull(v);
Assert.assertEquals(0, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1").vertices()));
}
代码示例来源:origin: visallo/vertexium
@Test
public void testDeleteElement() {
Vertex v = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
v.prepareMutation()
.setProperty("prop1", "value1", VISIBILITY_A)
.save(AUTHORIZATIONS_ALL);
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertNotNull(v);
Assert.assertEquals(1, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1").vertices()));
graph.deleteVertex(v.getId(), AUTHORIZATIONS_A_AND_B);
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertNull(v);
Assert.assertEquals(0, count(graph.query(AUTHORIZATIONS_A_AND_B).has("prop1", "value1").vertices()));
}
内容来源于网络,如有侵权,请联系作者删除!