本文整理了Java中org.vertexium.Graph.getVertices()
方法的一些代码示例,展示了Graph.getVertices()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getVertices()
方法的具体详情如下:
包路径:org.vertexium.Graph
类名称:Graph
方法名:getVertices
[英]Gets all vertices matching the given ids on the graph. The order of the returned vertices is not guaranteed Graph#getVerticesInOrder(Iterable,Authorizations). Vertices are not kept in memory during the iteration.
[中]获取与图上给定ID匹配的所有顶点。返回顶点的顺序不保证图#getVerticesInOrder(Iterable,Authorizations)。迭代期间,顶点不会保留在内存中。
代码示例来源:origin: org.visallo/visallo-model-vertexium
private Map<String, String> buildVertexIdToIriMap(Iterable<String> vertexIds, Authorizations authorizations) {
Iterable<Vertex> vertices = graph.getVertices(vertexIds, EnumSet.of(FetchHint.PROPERTIES), authorizations);
try {
return StreamSupport.stream(vertices.spliterator(), false)
.collect(Collectors.toMap(Vertex::getId, OntologyProperties.ONTOLOGY_TITLE::getPropertyValue));
} finally {
CloseableUtils.closeQuietly(vertices);
}
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
@Override
public Iterable<Relationship> getRelationships(Iterable<String> ids, String workspaceId) {
Iterable<Vertex> vertices = graph.getVertices(ids, getAuthorizations(workspaceId));
return transformRelationships(vertices, workspaceId);
}
代码示例来源:origin: org.visallo/visallo-model-vertexium
@Override
public Iterable<OntologyProperty> getProperties(Iterable<String> ids, String workspaceId) {
Iterable<Vertex> vertices = graph.getVertices(ids, getAuthorizations(workspaceId));
return transformProperties(vertices, workspaceId);
}
代码示例来源:origin: org.vertexium/vertexium-core
/**
* Gets both in and out vertices of this edge.
*/
default EdgeVertices getVertices(FetchHints fetchHints, Authorizations authorizations) {
List<String> ids = new ArrayList<>();
ids.add(getVertexId(Direction.OUT));
ids.add(getVertexId(Direction.IN));
Map<String, Vertex> vertices = IterableUtils.toMapById(getGraph().getVertices(ids, fetchHints, authorizations));
return new EdgeVertices(
vertices.get(getVertexId(Direction.OUT)),
vertices.get(getVertexId(Direction.IN))
);
}
代码示例来源:origin: org.vertexium/vertexium-blueprints
@Override
public Iterable<Vertex> getVertices() {
final Authorizations authorizations = getAuthorizationsProvider().getAuthorizations();
return new ConvertingIterable<org.vertexium.Vertex, Vertex>(getGraph().getVertices(getFetchHints(), authorizations)) {
@Override
protected Vertex convert(org.vertexium.Vertex vertex) {
return VertexiumBlueprintsVertex.create(VertexiumBlueprintsGraph.this, vertex, authorizations);
}
};
}
代码示例来源: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: 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.vertexium/vertexium-blueprints
@Override
public Iterable<Vertex> vertices() {
if (!hasFilter) {
return VertexiumBlueprintsConvert.toBlueprintsVertices(graph, graph.getGraph().getVertices(graph.getFetchHints(), authorizations), authorizations);
}
Iterable<org.vertexium.Vertex> vertices = q.vertices(graph.getFetchHints());
return VertexiumBlueprintsConvert.toBlueprintsVertices(graph, vertices, authorizations);
}
}
代码示例来源:origin: org.visallo/visallo-web-structured-ingest-core
@Test
public void testAddRowDryRun() throws Exception {
doParse(true, true, 0, new String[]{"John Smith", "3/13/2015", "yes"});
Iterable<Vertex> vertices = getGraph().getVertices(authorizations);
assertEquals("Expected no new vertices to be created", 1, Iterables.size(vertices)); // CSV only
}
代码示例来源:origin: org.visallo/visallo-web-structured-ingest-core
@Test
public void testAddRowWithTooManyErrors() throws Exception {
parserHandler.maxParseErrors = 1;
doParse(true, false, 1, new String[]{"John Smith", "3/13/2015", "you bet"});
Iterable<Vertex> vertices = getGraph().getVertices(authorizations);
assertEquals("Expected no new vertices to be created", 1, Iterables.size(vertices)); // CSV only
}
代码示例来源:origin: org.visallo/visallo-web-structured-ingest-core
@Test
public void testAddRowMaxErrorsDisabled() throws Exception {
parserHandler.maxParseErrors = -1;
for (int i = 0; i < 100; i++) {
parserHandler.parseErrors.errors.add(new ClientApiParseErrors.ParseError());
}
doParse(true, true, 101, new String[]{"John Smith", "3/13/2015", "you bet"});
Iterable<Vertex> vertices = getGraph().getVertices(authorizations);
assertEquals("Expected no new vertices to be created", 1, Iterables.size(vertices)); // CSV only
}
代码示例来源:origin: visallo/vertexium
@SuppressWarnings("unchecked")
private <T extends Element> Iterable<T> getIterableFromElementType(ElementType elementType, FetchHints fetchHints) throws VertexiumException {
switch (elementType) {
case VERTEX:
return (Iterable<T>) getGraph().getVertices(fetchHints, getParameters().getAuthorizations());
case EDGE:
return (Iterable<T>) getGraph().getEdges(fetchHints, getParameters().getAuthorizations());
default:
throw new VertexiumException("Unexpected element type: " + elementType);
}
}
代码示例来源:origin: org.vertexium/vertexium-core
@Override
public QueryResultsIterable<Vertex> vertices(FetchHints fetchHints) {
Iterable<Vertex> vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
return new DefaultGraphQueryIterableWithAggregations<>(getParameters(), vertices, true, true, true, getAggregations());
}
代码示例来源:origin: org.vertexium/vertexium-core
@SuppressWarnings("unchecked")
private <T extends Element> Iterable<T> getIterableFromElementType(ElementType elementType, FetchHints fetchHints) throws VertexiumException {
switch (elementType) {
case VERTEX:
return (Iterable<T>) getGraph().getVertices(fetchHints, getParameters().getAuthorizations());
case EDGE:
return (Iterable<T>) getGraph().getEdges(fetchHints, getParameters().getAuthorizations());
default:
throw new VertexiumException("Unexpected element type: " + elementType);
}
}
代码示例来源:origin: visallo/vertexium
@Override
public QueryResultsIterable<Vertex> vertices(FetchHints fetchHints) {
Iterable<Vertex> vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
return new DefaultGraphQueryIterableWithAggregations<>(getParameters(), vertices, true, true, true, getAggregations());
}
代码示例来源:origin: org.vertexium/vertexium-core
@Override
protected QueryResultsIterable<? extends VertexiumObject> extendedData(FetchHints fetchHints) {
Iterable<Vertex> vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
Iterable<String> edgeIds = new VerticesToEdgeIdsIterable(vertices, getParameters().getAuthorizations());
Iterable<Edge> edges = getGraph().getEdges(edgeIds, fetchHints, getParameters().getAuthorizations());
return extendedData(fetchHints, new JoinIterable<>(vertices, edges));
}
代码示例来源:origin: visallo/vertexium
@Override
protected QueryResultsIterable<? extends VertexiumObject> extendedData(FetchHints fetchHints) {
Iterable<Vertex> vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
Iterable<String> edgeIds = new VerticesToEdgeIdsIterable(vertices, getParameters().getAuthorizations());
Iterable<Edge> edges = getGraph().getEdges(edgeIds, fetchHints, getParameters().getAuthorizations());
return extendedData(fetchHints, new JoinIterable<>(vertices, edges));
}
代码示例来源:origin: visallo/vertexium
@Override
public QueryResultsIterable<Edge> edges(FetchHints fetchHints) {
Iterable<Vertex> vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
Iterable<String> edgeIds = new VerticesToEdgeIdsIterable(vertices, getParameters().getAuthorizations());
Iterable<Edge> edges = getGraph().getEdges(edgeIds, fetchHints, getParameters().getAuthorizations());
return new DefaultGraphQueryIterableWithAggregations<>(getParameters(), edges, true, true, true, getAggregations());
}
代码示例来源:origin: org.vertexium/vertexium-core
@Override
public QueryResultsIterable<Edge> edges(FetchHints fetchHints) {
Iterable<Vertex> vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
Iterable<String> edgeIds = new VerticesToEdgeIdsIterable(vertices, getParameters().getAuthorizations());
Iterable<Edge> edges = getGraph().getEdges(edgeIds, fetchHints, getParameters().getAuthorizations());
return new DefaultGraphQueryIterableWithAggregations<>(getParameters(), edges, true, true, true, getAggregations());
}
代码示例来源:origin: org.visallo/visallo-web-structured-ingest-core
@Test
public void testAddRowWithErrorThatSkipsRow() throws Exception {
PropertyMapping fraudMapping = findPropertyMapping(TX_FRAUD_NAME);
fraudMapping.errorHandlingStrategy = PropertyMapping.ErrorHandlingStrategy.SKIP_ROW;
doParse(false, true, 0, new String[]{"John Smith", "3/13/2015", "you bet"});
Iterable<Vertex> vertices = getGraph().getVertices(authorizations);
assertEquals("Expected new vertices to be created", 1, Iterables.size(vertices)); // CSV, PERSON
Vertex personVertex = getGraph().getVertex("PERSON_VERTEX", authorizations);
assertNull("Should not have found new person vertex", personVertex);
Vertex txVertex = getGraph().getVertex("TX_VERTEX", authorizations);
assertNull("Should not have found the transaction vertex", txVertex);
}
内容来源于网络,如有侵权,请联系作者删除!