Search in sources :

Example 56 with Expr

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

the class VarExprList method addAll.

public void addAll(VarExprList other) {
    for (Var v : other.vars) {
        Expr e = other.getExpr(v);
        add(v, e);
    }
}
Also used : Expr(org.apache.jena.sparql.expr.Expr)

Example 57 with Expr

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

the class TestVarRename method renameExpr.

private void renameExpr(String inputStr, String expectedStr, String... varNames) {
    Set<Var> s = set(varNames);
    Expr exOrig = SSE.parseExpr(inputStr);
    Expr exExpected = SSE.parseExpr(expectedStr);
    Expr exprActual = Rename.renameVars(exOrig, s);
    if (DEV && !exExpected.equals(exprActual)) {
        System.err.println("**** Test: " + name.getMethodName());
        System.err.println("::Expected::");
        System.err.println(exExpected);
        System.err.println("::Got::");
        System.err.println(exprActual);
    }
    assertEquals(exExpected, exprActual);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) Var(org.apache.jena.sparql.core.Var)

Example 58 with Expr

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

the class TestSSE_Builder method testBuildExpr_01.

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

Example 59 with Expr

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

the class BuilderOp method scBuilder.

SortCondition scBuilder(Item item) {
    int direction = Query.ORDER_DEFAULT;
    if (item.isTagged("asc") || item.isTagged("desc")) {
        BuilderLib.checkList(item);
        BuilderLib.checkLength(2, item.getList(), "Direction corrupt");
        if (item.isTagged("asc"))
            direction = Query.ORDER_ASCENDING;
        else
            direction = Query.ORDER_DESCENDING;
        item = item.getList().get(1);
    }
    Expr expr = BuilderExpr.buildExpr(item);
    if (expr.isVariable())
        return new SortCondition(expr.getExprVar().asVar(), direction);
    else
        return new SortCondition(expr, direction);
}
Also used : SortCondition(org.apache.jena.query.SortCondition) Expr(org.apache.jena.sparql.expr.Expr)

Example 60 with Expr

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

the class ApplyElementTransformVisitor method visit.

@Override
public void visit(ElementBind el) {
    Var v = el.getVar();
    Var v1 = TransformElementLib.applyVar(v, exprTransform);
    Expr expr = el.getExpr();
    Expr expr1 = ExprTransformer.transform(exprTransform, expr);
    Element el2 = transform.transform(el, v1, expr1);
    push(el2);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) Var(org.apache.jena.sparql.core.Var)

Aggregations

Expr (org.apache.jena.sparql.expr.Expr)83 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)6 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 Query (org.apache.jena.query.Query)3 SortCondition (org.apache.jena.query.SortCondition)3 ExprAggregator (org.apache.jena.sparql.expr.ExprAggregator)3