Search in sources :

Example 16 with NodeValueInteger

use of org.apache.jena.sparql.expr.nodevalue.NodeValueInteger in project jena by apache.

the class TestOptimizer method combine_assign_01.

@Test
public void combine_assign_01() {
    Op assign = OpAssign.create(OpTable.unit(), new VarExprList(Var.alloc("x"), new NodeValueInteger(1)));
    assign = OpAssign.create(assign, new VarExprList(Var.alloc("y"), new NodeValueInteger(2)));
    String opExpectedString = StrUtils.strjoinNL("(assign ((?x 1) (?y 2))", "  (table unit))");
    check(assign, new TransformExtendCombine(), opExpectedString);
}
Also used : Op(org.apache.jena.sparql.algebra.Op) NodeValueInteger(org.apache.jena.sparql.expr.nodevalue.NodeValueInteger) VarExprList(org.apache.jena.sparql.core.VarExprList) Test(org.junit.Test)

Example 17 with NodeValueInteger

use of org.apache.jena.sparql.expr.nodevalue.NodeValueInteger in project jena by apache.

the class TestOptimizer method combine_extend_03.

@Test
public void combine_extend_03() {
    // Technically illegal SPARQL here but useful to validate that the optimizer doesn't do the wrong thing
    Op extend = OpExtend.create(OpTable.unit(), new VarExprList(Var.alloc("x"), new NodeValueInteger(1)));
    extend = OpExtend.create(extend, new VarExprList(Var.alloc("x"), new NodeValueInteger(2)));
    String opExpectedString = StrUtils.strjoinNL("(extend ((?x 2))", "  (extend ((?x 1))", "    (table unit)))");
    check(extend, new TransformExtendCombine(), opExpectedString);
}
Also used : Op(org.apache.jena.sparql.algebra.Op) NodeValueInteger(org.apache.jena.sparql.expr.nodevalue.NodeValueInteger) VarExprList(org.apache.jena.sparql.core.VarExprList) Test(org.junit.Test)

Example 18 with NodeValueInteger

use of org.apache.jena.sparql.expr.nodevalue.NodeValueInteger in project jena by apache.

the class TestOptimizer method combine_assign_02.

@Test
public void combine_assign_02() {
    Op assign = OpAssign.create(OpTable.unit(), new VarExprList(Var.alloc("x"), new NodeValueInteger(1)));
    assign = OpAssign.create(assign, new VarExprList(Var.alloc("y"), new ExprVar("x")));
    String opExpectedString = StrUtils.strjoinNL("(assign ((?x 1) (?y ?x))", "  (table unit))");
    check(assign, new TransformExtendCombine(), opExpectedString);
}
Also used : ExprVar(org.apache.jena.sparql.expr.ExprVar) Op(org.apache.jena.sparql.algebra.Op) NodeValueInteger(org.apache.jena.sparql.expr.nodevalue.NodeValueInteger) VarExprList(org.apache.jena.sparql.core.VarExprList) Test(org.junit.Test)

Example 19 with NodeValueInteger

use of org.apache.jena.sparql.expr.nodevalue.NodeValueInteger in project jena by apache.

the class TestTransformPromoteTableEmpty method promote_table_empty_assignment_03.

@Test
public void promote_table_empty_assignment_03() {
    // Force algebra to have separate extends by using extendDirect()
    Op input = OpTable.empty();
    input = OpExtend.create(input, new VarExprList(Var.alloc("x"), new NodeValueInteger(1)));
    input = OpExtend.create(input, new VarExprList(Var.alloc("y"), new NodeValueInteger(2)));
    test(input, t_promote, "(table empty)");
}
Also used : Op(org.apache.jena.sparql.algebra.Op) NodeValueInteger(org.apache.jena.sparql.expr.nodevalue.NodeValueInteger) VarExprList(org.apache.jena.sparql.core.VarExprList) Test(org.junit.Test)

Aggregations

NodeValueInteger (org.apache.jena.sparql.expr.nodevalue.NodeValueInteger)19 Test (org.junit.Test)16 Op (org.apache.jena.sparql.algebra.Op)7 VarExprList (org.apache.jena.sparql.core.VarExprList)7 ExprVar (org.apache.jena.sparql.expr.ExprVar)5 ArrayList (java.util.ArrayList)3 Var (org.apache.jena.sparql.core.Var)3 E_LessThan (org.apache.jena.sparql.expr.E_LessThan)3 Expr (org.apache.jena.sparql.expr.Expr)3 UserDefinedFunction (org.apache.jena.sparql.function.user.UserDefinedFunction)3 ContractTest (org.xenei.junit.contract.ContractTest)3 WhereValidator (org.apache.jena.arq.querybuilder.WhereValidator)2 Node (org.apache.jena.graph.Node)2 NodeValue (org.apache.jena.sparql.expr.NodeValue)2 NodeValueDouble (org.apache.jena.sparql.expr.nodevalue.NodeValueDouble)2 ElementFilter (org.apache.jena.sparql.syntax.ElementFilter)2 Query (org.apache.jena.query.Query)1 NodeValueNode (org.apache.jena.sparql.expr.nodevalue.NodeValueNode)1