use of org.unipop.structure.UniElement in project unipop by unipop-graph.
the class RowController method fetchProperties.
@Override
public void fetchProperties(DeferredVertexQuery uniQuery) {
SelectCollector<JdbcSchema<Vertex>, Select, Vertex> collector = new SelectCollector<>(schema -> schema.getSearch(uniQuery, schema.toPredicates(uniQuery.getPredicates())), (schema, results) -> schema.parseResults(results, uniQuery));
Map<JdbcSchema<Vertex>, Select> selects = vertexSchemas.stream().filter(schema -> this.traversalFilter.filter(schema, uniQuery.getTraversal())).collect(collector);
Iterator<Vertex> searchIterator = this.search(uniQuery, selects, collector);
Map<Object, DeferredVertex> vertexMap = uniQuery.getVertices().stream().collect(Collectors.toMap(UniElement::id, Function.identity(), (a, b) -> a));
searchIterator.forEachRemaining(newVertex -> {
DeferredVertex deferredVertex = vertexMap.get(newVertex.id());
if (deferredVertex != null) {
deferredVertex.loadProperties(newVertex);
}
});
}
use of org.unipop.structure.UniElement in project unipop by unipop-graph.
the class DocumentController method fetchProperties.
@Override
public void fetchProperties(DeferredVertexQuery uniQuery) {
Map<DocumentVertexSchema, QueryBuilder> schemas = vertexSchemas.stream().filter(schema -> this.traversalFilter.filter(schema, uniQuery.getTraversal())).collect(new SearchCollector<>((schema) -> schema.getSearch(uniQuery)));
Iterator<Vertex> search = search(uniQuery, schemas);
Map<Object, DeferredVertex> vertexMap = uniQuery.getVertices().stream().collect(Collectors.toMap(UniElement::id, Function.identity(), (a, b) -> a));
search.forEachRemaining(newVertex -> {
DeferredVertex deferredVertex = vertexMap.get(newVertex.id());
if (deferredVertex != null)
deferredVertex.loadProperties(newVertex);
});
}
use of org.unipop.structure.UniElement in project unipop by unipop-graph.
the class RestController method fetchProperties.
@Override
public void fetchProperties(DeferredVertexQuery uniQuery) {
RestCollector<RestVertexSchema, BaseRequest, Vertex> collector = new RestCollector<>(schema -> schema.getSearch(uniQuery), (schema, result) -> schema.parseResults(result, uniQuery));
Map<RestVertexSchema, BaseRequest> schemas = vertexSchemas.stream().filter(schema -> this.traversalFilter.filter(schema, uniQuery.getTraversal())).collect(collector);
Iterator<Vertex> iterator = search(uniQuery, schemas, collector);
Map<Object, DeferredVertex> vertexMap = uniQuery.getVertices().stream().collect(Collectors.toMap(UniElement::id, Function.identity(), (a, b) -> a));
iterator.forEachRemaining(newVertex -> {
DeferredVertex deferredVertex = vertexMap.get(newVertex.id());
if (deferredVertex != null)
deferredVertex.loadProperties(newVertex);
});
}
Aggregations