use of org.apache.atlas.query.Expressions.Expression in project incubator-atlas by apache.
the class EntityDiscoveryService method toGremlinQuery.
private GremlinQuery toGremlinQuery(String query, int limit, int offset) throws AtlasBaseException {
QueryParams params = validateSearchParams(limit, offset);
Either<NoSuccess, Expression> either = QueryParser.apply(query, params);
if (either.isLeft()) {
throw new AtlasBaseException(DISCOVERY_QUERY_FAILED, query);
}
Expression expression = either.right().get();
Expression validExpression = QueryProcessor.validate(expression);
GremlinQuery gremlinQuery = new GremlinTranslator(validExpression, graphPersistenceStrategy).translate();
if (LOG.isDebugEnabled()) {
LOG.debug("Translated Gremlin Query: {}", gremlinQuery.queryStr());
}
return gremlinQuery;
}
Aggregations