org.vertexium.Graph.softDeleteVertex()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.vertexium.Graph.softDeleteVertex()方法的一些代码示例,展示了Graph.softDeleteVertex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.softDeleteVertex()方法的具体详情如下:
包路径:org.vertexium.Graph
类名称:Graph
方法名:softDeleteVertex

Graph.softDeleteVertex介绍

[英]Soft deletes a vertex from the graph.
[中]Soft从图形中删除顶点。

代码示例

代码示例来源:origin: org.visallo/visallo-core

public void delete(Vertex termMention, Authorizations authorizations) {
  Authorizations authorizationsWithTermMention = getAuthorizations(authorizations);
  graph.softDeleteVertex(termMention, authorizationsWithTermMention);
}

代码示例来源:origin: org.visallo/visallo-core

public void removeSourceInfoEdgeFromVertex(
    String vertexId,
    String sourceInfoElementId,
    String propertyKey,
    String propertyName,
    VisalloVisibility visalloVisibility,
    Authorizations authorizations
) {
  Vertex termMention = findTermMention(
      vertexId,
      sourceInfoElementId,
      propertyKey,
      propertyName,
      visalloVisibility.getVisibility(),
      authorizations
  );
  if (termMention != null) {
    graph.softDeleteVertex(termMention, authorizations);
  }
}

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
protected void internalDelete(User user) {
  Vertex userVertex = findByIdUserVertex(user.getUserId());
  graph.softDeleteVertex(userVertex, authorizations);
  graph.flush();
}

代码示例来源:origin: org.visallo/visallo-web-product-graph

ctx.getGraph().softDeleteVertex(childId, authorizations);
  } else {
    ctx.getGraph().softDeleteEdge(childEdgeId, authorizations);
ctx.getGraph().softDeleteVertex(id, authorizations);

代码示例来源:origin: org.visallo/visallo-web-product-graph

ctx.getGraph().softDeleteVertex(parentId, authorizations);

代码示例来源: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.visallo/visallo-model-vertexium

@Override
public void deleteDashboard(String workspaceId, String dashboardId, User user) {
  LOGGER.debug("deleteDashboard(dashboardId: %s, userId: %s)", dashboardId, user.getUserId());
  if (!hasWritePermissions(workspaceId, user)) {
    throw new VisalloAccessDeniedException(
        "user " + user.getUserId() + " does not have write access to workspace " + workspaceId,
        user,
        workspaceId
    );
  }
  Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations(
      user,
      VISIBILITY_STRING,
      workspaceId
  );
  Vertex dashboardVertex = getGraph().getVertex(dashboardId, authorizations);
  Iterable<Vertex> dashboardItemVertices = dashboardVertex.getVertices(
      Direction.OUT,
      WorkspaceProperties.DASHBOARD_TO_DASHBOARD_ITEM_RELATIONSHIP_IRI,
      authorizations
  );
  for (Vertex dashboardItemVertex : dashboardItemVertices) {
    getGraph().softDeleteVertex(dashboardItemVertex, authorizations);
  }
  getGraph().softDeleteVertex(dashboardVertex, authorizations);
  getGraph().flush();
}

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
public void deleteDashboardItem(String workspaceId, String dashboardItemId, User user) {
  LOGGER.debug("deleteDashboardItem(dashboardItemId: %s, userId: %s)", dashboardItemId, user.getUserId());
  if (!hasWritePermissions(workspaceId, user)) {
    throw new VisalloAccessDeniedException(
        "user " + user.getUserId() + " does not have write access to workspace " + workspaceId,
        user,
        workspaceId
    );
  }
  Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations(
      user,
      VISIBILITY_STRING,
      workspaceId
  );
  getGraph().softDeleteVertex(dashboardItemId, authorizations);
  getGraph().flush();
}

代码示例来源:origin: org.visallo/visallo-model-vertexium

SandboxStatus sandboxStatus = SandboxStatus.getFromVisibilityString(v.getVisibility().getVisibilityString(), workspace.getWorkspaceId());
  if (sandboxStatus == SandboxStatus.PRIVATE) {
    getGraph().softDeleteVertex(v, authorizations);
getGraph().softDeleteVertex(workspaceVertex, authorizations);

代码示例来源:origin: org.visallo/visallo-core

if (action == ClientApiPublishItem.Action.DELETE || WorkspaceDiffHelper.isPublicDelete(vertex, authorizations)) {
  long beforeDeletionTimestamp = System.currentTimeMillis() - 1;
  graph.softDeleteVertex(vertex, authorizations);
  graph.flush();
  workQueueRepository.pushPublishedVertexDeletion(vertex, beforeDeletionTimestamp, Priority.HIGH);

代码示例来源:origin: org.vertexium/vertexium-test

graph.softDeleteVertex(v1, AUTHORIZATIONS_A);
graph.flush();
assertEquals(0, count(v1.getProperties()));
graph.softDeleteVertex(v1, AUTHORIZATIONS_A);
graph.flush();
assertEquals(VISIBILITY_A_AND_B.getVisibilityString(), v1.getVisibility().getVisibilityString());
graph.softDeleteVertex(v1, AUTHORIZATIONS_A_AND_B);
graph.flush();

代码示例来源:origin: visallo/vertexium

graph.softDeleteVertex(v1, AUTHORIZATIONS_A);
graph.flush();
assertEquals(0, count(v1.getProperties()));
graph.softDeleteVertex(v1, AUTHORIZATIONS_A);
graph.flush();
assertEquals(VISIBILITY_A_AND_B.getVisibilityString(), v1.getVisibility().getVisibilityString());
graph.softDeleteVertex(v1, AUTHORIZATIONS_A_AND_B);
graph.flush();

代码示例来源:origin: org.visallo/visallo-model-vertexium

public void deleteProduct(String workspaceId, String productId, User user) {
  LOGGER.debug("deleteProduct(productId: %s, userId: %s)", productId, user.getUserId());
  if (!hasWritePermissions(workspaceId, user)) {
    throw new VisalloAccessDeniedException(
        "user " + user.getUserId() + " does not have write access to workspace " + workspaceId,
        user,
        workspaceId
    );
  }
  fireWorkspaceBeforeDeleteProduct(workspaceId, productId, user);
  Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations(
      user,
      VISIBILITY_STRING,
      workspaceId
  );
  Vertex productVertex = getGraph().getVertex(productId, authorizations);
  String kind = WorkspaceProperties.PRODUCT_KIND.getPropertyValue(productVertex);
  WorkProductService workProductService = getWorkProductServiceByKind(kind);
  if (workProductService instanceof WorkProductServiceHasElements) {
    ((WorkProductServiceHasElements) workProductService).cleanUpElements(getGraph(), productVertex, authorizations);
  }
  getGraph().softDeleteVertex(productId, authorizations);
  getGraph().flush();
  Workspace ws = findById(workspaceId, user);
  ClientApiWorkspace userWorkspace = toClientApi(ws, user, authorizations);
  getWorkQueueRepository().broadcastWorkProductDelete(productId, userWorkspace);
}

代码示例来源:origin: org.visallo/visallo-core

graph.softDeleteVertex(vertex, authorizations);
graph.flush();
this.workQueueRepository.pushVertexDeletion(vertex, beforeActionTimestamp, Priority.HIGH);

代码示例来源:origin: visallo/vertexium

assertEquals(1, v2.getEdgesSummary(AUTHORIZATIONS_A).getCountOfEdges());
graph.softDeleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A)));
assertResultsCount(3, graph.query(AUTHORIZATIONS_A).has("name1", "value1").vertices());
graph.softDeleteVertex("v3", AUTHORIZATIONS_A);
graph.flush();
assertEquals(3, count(graph.getVertices(AUTHORIZATIONS_A)));

代码示例来源:origin: org.vertexium/vertexium-test

assertEquals(1, v2.getEdgesSummary(AUTHORIZATIONS_A).getCountOfEdges());
graph.softDeleteVertex("v1", AUTHORIZATIONS_A);
graph.flush();
assertEquals(1, count(graph.getVertices(AUTHORIZATIONS_A)));
assertResultsCount(3, graph.query(AUTHORIZATIONS_A).has("name1", "value1").vertices());
graph.softDeleteVertex("v3", AUTHORIZATIONS_A);
graph.flush();
assertEquals(3, count(graph.getVertices(AUTHORIZATIONS_A)));

代码示例来源:origin: org.vertexium/vertexium-test

@Test
public void testGetSoftDeletedElementWithFetchHintsAndTimestamp() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
  Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  graph.flush();
  long beforeDeleteTime = IncreasingTime.currentTimeMillis();
  graph.softDeleteEdge(e1, AUTHORIZATIONS_A);
  graph.softDeleteVertex(v1, AUTHORIZATIONS_A);
  graph.flush();
  assertNull(graph.getEdge(e1.getId(), AUTHORIZATIONS_A));
  assertNull(graph.getEdge(e1.getId(), graph.getDefaultFetchHints(), AUTHORIZATIONS_A));
  assertNull(graph.getEdge(e1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A));
  assertNull(graph.getVertex(v1.getId(), AUTHORIZATIONS_A));
  assertNull(graph.getVertex(v1.getId(), graph.getDefaultFetchHints(), AUTHORIZATIONS_A));
  assertNull(graph.getVertex(v1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A));
  assertNotNull(graph.getEdge(e1.getId(), graph.getDefaultFetchHints(), beforeDeleteTime, AUTHORIZATIONS_A));
  assertNotNull(graph.getEdge(e1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, beforeDeleteTime, AUTHORIZATIONS_A));
  assertNotNull(graph.getVertex(v1.getId(), graph.getDefaultFetchHints(), beforeDeleteTime, AUTHORIZATIONS_A));
  assertNotNull(graph.getVertex(v1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, beforeDeleteTime, AUTHORIZATIONS_A));
}

代码示例来源:origin: visallo/vertexium

@Test
public void testGetSoftDeletedElementWithFetchHintsAndTimestamp() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
  Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  graph.flush();
  long beforeDeleteTime = IncreasingTime.currentTimeMillis();
  graph.softDeleteEdge(e1, AUTHORIZATIONS_A);
  graph.softDeleteVertex(v1, AUTHORIZATIONS_A);
  graph.flush();
  assertNull(graph.getEdge(e1.getId(), AUTHORIZATIONS_A));
  assertNull(graph.getEdge(e1.getId(), graph.getDefaultFetchHints(), AUTHORIZATIONS_A));
  assertNull(graph.getEdge(e1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A));
  assertNull(graph.getVertex(v1.getId(), AUTHORIZATIONS_A));
  assertNull(graph.getVertex(v1.getId(), graph.getDefaultFetchHints(), AUTHORIZATIONS_A));
  assertNull(graph.getVertex(v1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A));
  assertNotNull(graph.getEdge(e1.getId(), graph.getDefaultFetchHints(), beforeDeleteTime, AUTHORIZATIONS_A));
  assertNotNull(graph.getEdge(e1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, beforeDeleteTime, AUTHORIZATIONS_A));
  assertNotNull(graph.getVertex(v1.getId(), graph.getDefaultFetchHints(), beforeDeleteTime, AUTHORIZATIONS_A));
  assertNotNull(graph.getVertex(v1.getId(), FetchHints.ALL_INCLUDING_HIDDEN, beforeDeleteTime, AUTHORIZATIONS_A));
}

相关文章