org.vertexium.query.DefaultGraphQuery Maven / Gradle / Ivy
package org.vertexium.query;
import org.vertexium.*;
import org.vertexium.util.VertexiumLogger;
import org.vertexium.util.VertexiumLoggerFactory;
import java.util.EnumSet;
public class DefaultGraphQuery extends GraphQueryBase {
private static final VertexiumLogger LOGGER = VertexiumLoggerFactory.getLogger(DefaultGraphQuery.class);
public DefaultGraphQuery(Graph graph, String queryString, Authorizations authorizations) {
super(graph, queryString, authorizations);
}
@Override
public QueryResultsIterable vertices(EnumSet fetchHints) {
LOGGER.warn("scanning all vertices! create your own GraphQuery.");
return new DefaultGraphQueryIterableWithAggregations<>(
getParameters(),
this.getIterableFromElementType(ElementType.VERTEX, fetchHints),
true,
true,
true,
getAggregations()
);
}
@Override
public QueryResultsIterable edges(EnumSet fetchHints) {
LOGGER.warn("scanning all edges! create your own GraphQuery.");
return new DefaultGraphQueryIterableWithAggregations<>(
getParameters(),
this.getIterableFromElementType(ElementType.EDGE, fetchHints),
true,
true,
true,
getAggregations()
);
}
@SuppressWarnings("unchecked")
private Iterable getIterableFromElementType(ElementType elementType, EnumSet fetchHints) throws VertexiumException {
switch (elementType) {
case VERTEX:
return (Iterable) getGraph().getVertices(fetchHints, getParameters().getAuthorizations());
case EDGE:
return (Iterable) getGraph().getEdges(fetchHints, getParameters().getAuthorizations());
default:
throw new VertexiumException("Unexpected element type: " + elementType);
}
}
@Override
public boolean isAggregationSupported(Aggregation aggregation) {
if (DefaultGraphQueryIterableWithAggregations.isAggregationSupported(aggregation)) {
return true;
}
return super.isAggregationSupported(aggregation);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy