All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vertexium.query.DefaultMultiVertexQuery Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.query;

import org.vertexium.*;
import org.vertexium.util.IterableUtils;
import org.vertexium.util.VerticesToEdgeIdsIterable;

import java.util.EnumSet;

public class DefaultMultiVertexQuery extends QueryBase implements MultiVertexQuery {
    private final String[] vertexIds;

    public DefaultMultiVertexQuery(Graph graph, String[] vertexIds, String queryString, Authorizations authorizations) {
        super(graph, queryString, authorizations);
        this.vertexIds = vertexIds;
    }

    @Override
    public QueryResultsIterable vertices(EnumSet fetchHints) {
        Iterable vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
        return new DefaultGraphQueryIterableWithAggregations<>(getParameters(), vertices, true, true, true, getAggregations());
    }

    @Override
    public QueryResultsIterable edges(EnumSet fetchHints) {
        Iterable vertices = getGraph().getVertices(IterableUtils.toIterable(getVertexIds()), fetchHints, getParameters().getAuthorizations());
        Iterable edgeIds = new VerticesToEdgeIdsIterable(vertices, getParameters().getAuthorizations());
        Iterable edges = getGraph().getEdges(edgeIds, fetchHints, getParameters().getAuthorizations());
        return new DefaultGraphQueryIterableWithAggregations<>(getParameters(), edges, true, true, true, getAggregations());
    }

    public String[] getVertexIds() {
        return vertexIds;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy