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

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

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

Graph.getVerticesWithPrefix介绍

[英]Gets vertices from the graph given the prefix.
[中]从给定前缀的图形中获取顶点。

代码示例

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

@Override
public Iterable<Concept> getConceptsWithProperties(String workspaceId) {
  Authorizations authorizations = getAuthorizations(workspaceId);
  return transformConcepts(graph.getVerticesWithPrefix(ID_PREFIX_CONCEPT, authorizations), workspaceId);
}

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

@Override
public Iterable<Relationship> getRelationships(String workspaceId) {
  Iterable<Vertex> vertices = graph.getVerticesWithPrefix(ID_PREFIX_RELATIONSHIP, getAuthorizations(workspaceId));
  return transformRelationships(vertices, workspaceId);
}

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

@Override
public Iterable<OntologyProperty> getProperties(String workspaceId) {
  Iterable<Vertex> vertices = graph.getVerticesWithPrefix(ID_PREFIX_PROPERTY, getAuthorizations(workspaceId));
  return transformProperties(vertices, workspaceId);
}

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

@Test
public void testGetVerticesWithPrefix() {
  graph.addVertex("a", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.addVertex("aa", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.addVertex("az", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.addVertex("b", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.flush();
  List<Vertex> vertices = sortById(toList(graph.getVerticesWithPrefix("a", AUTHORIZATIONS_ALL)));
  assertVertexIds(vertices, "a", "aa", "az");
  vertices = sortById(toList(graph.getVerticesWithPrefix("b", AUTHORIZATIONS_ALL)));
  assertVertexIds(vertices, "b");
  vertices = sortById(toList(graph.getVerticesWithPrefix("c", AUTHORIZATIONS_ALL)));
  assertVertexIds(vertices);
}

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

@Test
public void testGetVerticesWithPrefix() {
  graph.addVertex("a", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.addVertex("aa", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.addVertex("az", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.addVertex("b", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  graph.flush();
  List<Vertex> vertices = sortById(toList(graph.getVerticesWithPrefix("a", AUTHORIZATIONS_ALL)));
  assertVertexIds(vertices, "a", "aa", "az");
  vertices = sortById(toList(graph.getVerticesWithPrefix("b", AUTHORIZATIONS_ALL)));
  assertVertexIds(vertices, "b");
  vertices = sortById(toList(graph.getVerticesWithPrefix("c", AUTHORIZATIONS_ALL)));
  assertVertexIds(vertices);
}

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

public Object get(String vertexId) {
    if (vertexId.endsWith("*")) {
      String vertexIdPrefix = vertexId.substring(0, vertexId.length() - 1);
      Iterable<Vertex> vertices = getGraph().getVerticesWithPrefix(vertexIdPrefix, getGraph().getDefaultFetchHints(), getTime(), getAuthorizations());
      List<String> results = new ArrayList<>();
      for (Vertex v : vertices) {
        results.add(v.getId());
      }
      return new LazyVertexList(results);
    } else {
      Vertex v = getGraph().getVertex(vertexId, getGraph().getDefaultFetchHints(), getTime(), getAuthorizations());
      if (v == null) {
        return null;
      }
      return new LazyVertex(vertexId);
    }
  }
}

代码示例来源:origin: org.visallo/visallo-tools-migration-predefined-to-dynamic-ontology

@Override
  protected void afterMigrate(Graph graph) {
    if (graph instanceof GraphWithSearchIndex) {
      LOGGER.info("Re-indexing ontology elements...");

      VisalloBootstrap bootstrap = VisalloBootstrap.bootstrap(getConfiguration());
      SearchIndex searchIndex = ((GraphWithSearchIndex) graph).getSearchIndex();
      Authorizations authorizations = graph.createAuthorizations(VisalloVisibility.SUPER_USER_VISIBILITY_STRING, OntologyRepository.VISIBILITY_STRING);
      graph.getVerticesWithPrefix(VertexiumOntologyRepository.ID_PREFIX, authorizations).forEach(vertex -> {
        LOGGER.debug("Adding vertex %s to search index.", vertex.getId());
        searchIndex.addElement(graph, vertex, authorizations);
      });
      searchIndex.flush(graph);
    }
  }
}

相关文章

微信公众号

最新文章

更多