Package com.hp.hpl.jena.sparql.expr

Examples of com.hp.hpl.jena.sparql.expr.E_Add


        //Test that with preserveDependencies set to false (the default) that the definition is expanded appropriately
        //when the outer function has differing numbers of arguments
        List<Var> args = new ArrayList<Var>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new E_Function("http://example/single", new ExprList(new ExprVar("x"))), new ExprVar("y"));
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, args);
       
        UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/add");
        Expr base = def.getBaseExpr();
        Assert.assertTrue(base instanceof E_Add);
        E_Add actual = (E_Add)base;
        Assert.assertTrue(actual.getArg1() instanceof ExprVar);
        Assert.assertTrue(actual.getArg2() instanceof ExprVar);
        Assert.assertEquals("x", actual.getArg1().getVarName());
        Assert.assertEquals("y", actual.getArg2().getVarName());
    }
View Full Code Here


        //Test that with preserveDependencies set to false (the default) that the definition is expanded appropriately
        //when the outer function has differing numbers of arguments
        List<Var> args = new ArrayList<Var>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new E_Function("http://example/single", new ExprList(new ExprVar("y"))), new ExprVar("y"));
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, args);
       
        UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/add");
        Expr base = def.getBaseExpr();
        Assert.assertTrue(base instanceof E_Add);
        E_Add actual = (E_Add)base;
        Assert.assertTrue(actual.getArg1() instanceof ExprVar);
        Assert.assertTrue(actual.getArg2() instanceof ExprVar);
        Assert.assertEquals("y", actual.getArg1().getVarName());
        Assert.assertEquals("y", actual.getArg2().getVarName());
    }
View Full Code Here

    @Test(expected=ExprBuildException.class)
    public void test_function_expansion_bad_01() {
        List<Var> args = new ArrayList<Var>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new ExprVar("x"), new ExprVar("y"));
       
        //It's an error to use a variable which is not mentioned in the argument list
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, new ArrayList<Var>());
    }
View Full Code Here

        //Test that with preserveDependencies set to false (the default) that the definition is expanded appropriately
        //when the outer function has differing numbers of arguments
        List<Var> args = new ArrayList<>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new E_Function("http://example/single", new ExprList(new ExprVar("x"))), new ExprVar("y"));
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, args);
       
        UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/add");
        Expr base = def.getBaseExpr();
        Assert.assertTrue(base instanceof E_Add);
        E_Add actual = (E_Add)base;
        Assert.assertTrue(actual.getArg1() instanceof ExprVar);
        Assert.assertTrue(actual.getArg2() instanceof ExprVar);
        Assert.assertEquals("x", actual.getArg1().getVarName());
        Assert.assertEquals("y", actual.getArg2().getVarName());
    }
View Full Code Here

        //Test that with preserveDependencies set to false (the default) that the definition is expanded appropriately
        //when the outer function has differing numbers of arguments
        List<Var> args = new ArrayList<>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new E_Function("http://example/single", new ExprList(new ExprVar("y"))), new ExprVar("y"));
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, args);
       
        UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/add");
        Expr base = def.getBaseExpr();
        Assert.assertTrue(base instanceof E_Add);
        E_Add actual = (E_Add)base;
        Assert.assertTrue(actual.getArg1() instanceof ExprVar);
        Assert.assertTrue(actual.getArg2() instanceof ExprVar);
        Assert.assertEquals("y", actual.getArg1().getVarName());
        Assert.assertEquals("y", actual.getArg2().getVarName());
    }
View Full Code Here

    @Test(expected=ExprBuildException.class)
    public void test_function_expansion_bad_01() {
        List<Var> args = new ArrayList<>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new ExprVar("x"), new ExprVar("y"));
       
        //It's an error to use a variable which is not mentioned in the argument list
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, new ArrayList<Var>());
    }
View Full Code Here

        //Test that with preserveDependencies set to false (the default) that the definition is expanded appropriately
        //when the outer function has differing numbers of arguments
        List<Var> args = new ArrayList<Var>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new E_Function("http://example/single", new ExprList(new ExprVar("x"))), new ExprVar("y"));
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, args);
       
        UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/add");
        Expr base = def.getBaseExpr();
        Assert.assertTrue(base instanceof E_Add);
        E_Add actual = (E_Add)base;
        Assert.assertTrue(actual.getArg1() instanceof ExprVar);
        Assert.assertTrue(actual.getArg2() instanceof ExprVar);
        Assert.assertEquals("x", actual.getArg1().getVarName());
        Assert.assertEquals("y", actual.getArg2().getVarName());
    }
View Full Code Here

        //Test that with preserveDependencies set to false (the default) that the definition is expanded appropriately
        //when the outer function has differing numbers of arguments
        List<Var> args = new ArrayList<Var>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new E_Function("http://example/single", new ExprList(new ExprVar("y"))), new ExprVar("y"));
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, args);
       
        UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/add");
        Expr base = def.getBaseExpr();
        Assert.assertTrue(base instanceof E_Add);
        E_Add actual = (E_Add)base;
        Assert.assertTrue(actual.getArg1() instanceof ExprVar);
        Assert.assertTrue(actual.getArg2() instanceof ExprVar);
        Assert.assertEquals("y", actual.getArg1().getVarName());
        Assert.assertEquals("y", actual.getArg2().getVarName());
    }
View Full Code Here

    @Test(expected=ExprBuildException.class)
    public void test_function_expansion_bad_01() {
        List<Var> args = new ArrayList<Var>();
        args.add(Var.alloc("x"));
        args.add(Var.alloc("y"));
        Expr add = new E_Add(new ExprVar("x"), new ExprVar("y"));
       
        //It's an error to use a variable which is not mentioned in the argument list
        UserDefinedFunctionFactory.getFactory().add("http://example/add", add, new ArrayList<Var>());
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.expr.E_Add

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.