Search in sources :

Example 26 with Expr

use of org.apache.jena.sparql.expr.Expr in project jena by apache.

the class ApplyElementTransformVisitor method visit.

@Override
public void visit(ElementFilter el) {
    Expr expr = el.getExpr();
    Expr expr2 = transformExpr(expr, exprTransform);
    Element el2 = transform.transform(el, expr2);
    push(el2);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr)

Example 27 with Expr

use of org.apache.jena.sparql.expr.Expr in project jena by apache.

the class TestSSE_Builder method testExprForms.

private static void testExprForms(String str1, String str2) {
    Expr e1 = SSE.parseExpr(str1);
    Expr e2 = SSE.parseExpr(str2);
    assertEquals(str1 + " " + str2, e1, e2);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr)

Example 28 with Expr

use of org.apache.jena.sparql.expr.Expr in project jena by apache.

the class TestSSE_Builder method testBuildExpr_02.

@Test
public void testBuildExpr_02() {
    Expr e = SSE.parseExpr("(isNumeric ?x)");
    assertTrue(e instanceof E_IsNumeric);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) E_IsNumeric(org.apache.jena.sparql.expr.E_IsNumeric) Test(org.junit.Test)

Example 29 with Expr

use of org.apache.jena.sparql.expr.Expr in project jena by apache.

the class FunctionBase method exec.

@Override
public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
    if (args == null)
        // The contract on the function interface is that this should not happen.
        throw new ARQInternalErrorException("FunctionBase: Null args list");
    List<NodeValue> evalArgs = new ArrayList<>();
    for (Expr e : args) {
        NodeValue x = e.eval(binding, env);
        evalArgs.add(x);
    }
    NodeValue nv = exec(evalArgs);
    return nv;
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) Expr(org.apache.jena.sparql.expr.Expr) ARQInternalErrorException(org.apache.jena.sparql.ARQInternalErrorException) ArrayList(java.util.ArrayList)

Example 30 with Expr

use of org.apache.jena.sparql.expr.Expr in project jena by apache.

the class AggregatorBase method toPrefixString.

@Override
public String toPrefixString() {
    IndentedLineBuffer x = new IndentedLineBuffer();
    x.append("(");
    x.append(getName().toLowerCase(Locale.ROOT));
    x.incIndent();
    if (isDistinct)
        x.append(" distinct");
    for (Expr e : getExprList()) {
        x.append(" ");
        WriterExpr.output(x, e, null);
    }
    x.decIndent();
    x.append(")");
    return x.asString();
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) WriterExpr(org.apache.jena.sparql.sse.writers.WriterExpr) IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Aggregations

Expr (org.apache.jena.sparql.expr.Expr)82 Var (org.apache.jena.sparql.core.Var)28 ExprList (org.apache.jena.sparql.expr.ExprList)15 NodeValue (org.apache.jena.sparql.expr.NodeValue)15 Op (org.apache.jena.sparql.algebra.Op)13 ExprVar (org.apache.jena.sparql.expr.ExprVar)12 FunctionEnvBase (org.apache.jena.sparql.function.FunctionEnvBase)9 Test (org.junit.Test)9 VarExprList (org.apache.jena.sparql.core.VarExprList)8 Node (org.apache.jena.graph.Node)7 E_Random (org.apache.jena.sparql.expr.E_Random)7 ArrayList (java.util.ArrayList)5 Triple (org.apache.jena.graph.Triple)4 E_Multiply (org.apache.jena.sparql.expr.E_Multiply)4 E_Regex (org.apache.jena.sparql.expr.E_Regex)4 ContractTest (org.xenei.junit.contract.ContractTest)4 IndentedLineBuffer (org.apache.jena.atlas.io.IndentedLineBuffer)3 ExprAggregator (org.apache.jena.sparql.expr.ExprAggregator)3 InternalErrorException (org.apache.jena.atlas.lib.InternalErrorException)2 Query (org.apache.jena.query.Query)2