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

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

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

Graph.flush介绍

[英]Flushes any pending mutations to the graph.
[中]将任何挂起的突变刷新到图形中。

代码示例

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

private void benchmarkFindVerticesById(Random random, int vertexCount, int findVerticesByIdCount) {
  double startTime = System.currentTimeMillis();
  for (int i = 0; i < findVerticesByIdCount; i++) {
    String vertexId = "v" + random.nextInt(vertexCount);
    graph.getVertex(vertexId, AUTHORIZATIONS_ALL);
  }
  graph.flush();
  double endTime = System.currentTimeMillis();
  LOGGER.info("find vertices by id in %.3fs", (endTime - startTime) / 1000);
}

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

@Override
public void clearCache(String workspaceId) {
  checkNotNull(workspaceId, "Workspace should not be null");
  LOGGER.info("clearing ontology cache for workspace %s", workspaceId);
  super.clearCache(workspaceId);
  graph.flush();
}

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

@Override
public void clearCache() {
  LOGGER.info("clearing ontology cache");
  super.clearCache();
  graph.flush();
}

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

@Override
protected void addEntityGlyphIconToEntityConcept(Concept entityConcept, byte[] rawImg, Authorizations authorizations) {
  StreamingPropertyValue raw = new StreamingPropertyValue(new ByteArrayInputStream(rawImg), byte[].class);
  raw.searchIndex(false);
  entityConcept.setProperty(OntologyProperties.GLYPH_ICON.getPropertyName(), raw, getSystemUser(), authorizations);
  graph.flush();
}

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

@Override
public void addIntent(String intent, User user, Authorizations authorizations) {
  Visibility visibility = OntologyRepository.VISIBILITY.getVisibility();
  Metadata metadata = createPropertyMetadata(user, new Date(), visibility);
  OntologyProperties.INTENT.addPropertyValue(vertex, intent, intent, metadata, visibility, authorizations);
  vertex.getGraph().flush();
}

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

@Override
public void removeProperty(String name, Authorizations authorizations) {
  removeProperty(ElementMutation.DEFAULT_KEY, name, authorizations);
  getVertex().getGraph().flush();
}

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

@Override
public void removeIntent(String intent, Authorizations authorizations) {
  OntologyProperties.INTENT.removeProperty(vertex, intent, authorizations);
  getVertex().getGraph().flush();
}

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

@Override
public void removeIntent(String intent, Authorizations authorizations) {
  OntologyProperties.INTENT.removeProperty(vertex, intent, authorizations);
  getVertex().getGraph().flush();
}

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

public void updateEntitiesOnWorkspace(
    String workspaceId,
    Collection<String> vertexIds,
    User user
) {
  Workspace workspace = workspaceRepository.findById(workspaceId, user);
  workspaceRepository.updateEntitiesOnWorkspace(workspace, vertexIds, user);
  workQueueRepository.pushUserCurrentWorkspaceChange(user, workspaceId);
  graph.flush();
}

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

@Test
public void testLargeFieldValuesThatAreMarkedWithExactMatch() {
  graph.defineProperty("field1").dataType(String.class).textIndexHint(TextIndexHint.EXACT_MATCH).define();
  StringBuilder largeText = new StringBuilder();
  for (int i = 0; i < 10000; i++) {
    largeText.append("test ");
  }
  graph.prepareVertex("v1", VISIBILITY_EMPTY)
      .addPropertyValue("", "field1", largeText.toString(), VISIBILITY_EMPTY)
      .save(AUTHORIZATIONS_EMPTY);
  graph.flush();
}

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

@Override
public void setDisplayName(User user, String displayName) {
  Vertex userVertex = findByIdUserVertex(user.getUserId());
  UserVisalloProperties.DISPLAY_NAME.setProperty(
      userVertex,
      displayName,
      VISIBILITY.getVisibility(),
      authorizations
  );
  graph.flush();
}

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

public void lrpUpdate(Vertex vertex, Graph graph, Authorizations authorizations) {
  Date updateDate = new Date();
  Long waitTimeMs = updateDate.getTime() - PingOntology.CREATE_DATE.getPropertyValueRequired(vertex).getTime();
  ElementMutation<Vertex> mutation = vertex.prepareMutation();
  PingOntology.LONG_RUNNING_PROCESS_DATE.setProperty(mutation, updateDate, VISIBILITY);
  PingOntology.LONG_RUNNING_PROCESS_HOSTNAME.setProperty(mutation, getHostname(), VISIBILITY);
  PingOntology.LONG_RUNNING_PROCESS_HOST_ADDRESS.setProperty(mutation, getHostAddress(), VISIBILITY);
  PingOntology.LONG_RUNNING_PROCESS_WAIT_TIME_MS.setProperty(mutation, waitTimeMs, VISIBILITY);
  mutation.save(authorizations);
  graph.flush();
}

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

@Override
public void updatePropertyDependentIris(OntologyProperty property, Collection<String> newDependentPropertyIris, User user, String workspaceId) {
  VertexiumOntologyProperty vertexiumProperty = (VertexiumOntologyProperty) property;
  if (!isPublic(workspaceId) || property.getSandboxStatus() == SandboxStatus.PRIVATE) {
    throw new UnsupportedOperationException("Sandboxed updating of dependent iris is not currently supported for properties");
  }
  saveDependentProperties(vertexiumProperty.getVertex().getId(), newDependentPropertyIris, user, workspaceId);
  graph.flush();
  vertexiumProperty.setDependentProperties(newDependentPropertyIris);
}

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

@Override
public void setProperty(String name, Object value, User user, Authorizations authorizations) {
  Visibility visibility = OntologyRepository.VISIBILITY.getVisibility();
  Metadata metadata = createPropertyMetadata(user, new Date(), visibility);
  getVertex().setProperty(name, value, metadata, OntologyRepository.VISIBILITY.getVisibility(), authorizations);
  getVertex().getGraph().flush();
}

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

@Override
public void setPassword(User user, byte[] salt, byte[] passwordHash) {
  Vertex userVertex = findByIdUserVertex(user.getUserId());
  UserVisalloProperties.PASSWORD_SALT.setProperty(userVertex, salt, VISIBILITY.getVisibility(), authorizations);
  UserVisalloProperties.PASSWORD_HASH.setProperty(
      userVertex,
      passwordHash,
      VISIBILITY.getVisibility(),
      authorizations
  );
  graph.flush();
}

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

@Override
public void setProperty(String name, Object value, User user, Authorizations authorizations) {
  Visibility visibility = OntologyRepository.VISIBILITY.getVisibility();
  Metadata metadata = new Metadata();
  VisalloProperties.MODIFIED_DATE_METADATA.setMetadata(metadata, new Date(), visibility);
  if (user != null) {
    VisalloProperties.MODIFIED_BY_METADATA.setMetadata(metadata, user.getUserId(), visibility);
  }
  getVertex().setProperty(name, value, metadata, visibility, authorizations);
  getVertex().getGraph().flush();
}

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

@Test
public void testGetSingleVertexWithSameRowPrefix() {
  graph.addVertex("prefix", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
  graph.addVertex("prefixA", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
  graph.flush();
  Vertex v = graph.getVertex("prefix", AUTHORIZATIONS_EMPTY);
  assertEquals("prefix", v.getId());
  v = graph.getVertex("prefixA", AUTHORIZATIONS_EMPTY);
  assertEquals("prefixA", v.getId());
}

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

@Test
public void testStreamingPropertyValueReadAsString() {
  graph.prepareVertex("v1", VISIBILITY_EMPTY)
      .setProperty("spv", StreamingPropertyValue.create("Hello World"), VISIBILITY_EMPTY)
      .save(AUTHORIZATIONS_EMPTY);
  graph.flush();
  Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_EMPTY);
  assertEquals("Hello World", ((StreamingPropertyValue) v1.getPropertyValue("spv")).readToString());
  assertEquals("Wor", ((StreamingPropertyValue) v1.getPropertyValue("spv")).readToString(6, 3));
  assertEquals("", ((StreamingPropertyValue) v1.getPropertyValue("spv")).readToString("Hello World".length(), 1));
  assertEquals("Hello World", ((StreamingPropertyValue) v1.getPropertyValue("spv")).readToString(0, 100));
}

相关文章