use of org.vertexium.cypher.ast.model.CypherAstBase in project vertexium by visallo.
the class GraphGlue method parseParameterValue.
private Object parseParameterValue(String valueString) {
valueString = valueString.trim();
CypherAstBase expression = CypherAstParser.getInstance().parseExpression(valueString);
return ctx.getExpressionExecutor().executeExpression(ctx, expression, null);
}
use of org.vertexium.cypher.ast.model.CypherAstBase in project vertexium by visallo.
the class LabelsFunction method invoke.
@Override
public Object invoke(VertexiumCypherQueryContext ctx, CypherAstBase[] arguments, ExpressionScope scope) {
CypherAstBase lookup = arguments[0];
Object item = ctx.getExpressionExecutor().executeExpression(ctx, lookup, scope);
if (item == null) {
throw new VertexiumException("Could not find Vertex using " + lookup);
}
if (item instanceof Vertex) {
Vertex vertex = (Vertex) item;
return ctx.getVertexLabels(vertex);
}
if (item instanceof Edge) {
Edge edge = (Edge) item;
return Lists.newArrayList(edge.getLabel());
}
throw new VertexiumCypherTypeErrorException(item, Vertex.class, Edge.class);
}
use of org.vertexium.cypher.ast.model.CypherAstBase in project vertexium by visallo.
the class ExistsFunction method invoke.
@Override
public Object invoke(VertexiumCypherQueryContext ctx, CypherAstBase[] arguments, ExpressionScope scope) {
CypherAstBase lookup = arguments[0];
Object value = ctx.getExpressionExecutor().executeExpression(ctx, lookup, scope);
return value != null;
}
Aggregations