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

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


{
    public Expr expression = null ;
    public int direction = 0 ;

    public SortCondition(Var var, int dir)
    { this(new ExprVar(var),dir) ; }
View Full Code Here


{
    public static Expr nodeToExpr(Node n)
    {
        if ( n.isVariable() )
            return new ExprVar(n) ;
        return NodeValue.makeNode(n) ;
    }
View Full Code Here

                // which are ways of accessing the names in the dataset.
                return new OpDatasetNames(opGraph.getNode()) ;
            }
           
            if ( actualName != rewriteName )
                op = OpAssign.assign(op, Var.alloc(actualName), new ExprVar(rewriteName)) ;

            // Drop (graph...) because inside nodes
            // have been converted to quads.
            return op ;
        }
View Full Code Here

    }
   
    public void addOrderBy(String varName, int direction)
    {
        varName = Var.canonical(varName) ;
        SortCondition sc = new SortCondition(new ExprVar(varName), direction) ;
        addOrderBy(sc) ;
    }
View Full Code Here

    }
   
    public void addOrderBy(String varName, int direction)
    {
        varName = Var.canonical(varName) ;
        SortCondition sc = new SortCondition(new ExprVar(varName), direction) ;
        addOrderBy(sc) ;
    }
View Full Code Here

  private static ExprList createArgs( List<Node> variables )
  {
    ExprList retval = new ExprList();
    for (Node n : variables )
    {
      retval.add( new ExprVar( n ));
    }
    return retval;
  }
View Full Code Here

        Assert.assertNotNull(factory);
    }
   
    @Test
    public void test_user_defined_function_factory_add_01() {
        Expr e = new E_Multiply(new ExprVar("x"), new ExprVar("x"));
        UserDefinedFunctionFactory.getFactory().add("http://example/square", e, new ArrayList<>(e.getVarsMentioned()));
        Assert.assertTrue(UserDefinedFunctionFactory.getFactory().isRegistered("http://example/square"));
        Assert.assertEquals(e, UserDefinedFunctionFactory.getFactory().get("http://example/square").getBaseExpr());
    }
View Full Code Here

        Assert.assertEquals(e, UserDefinedFunctionFactory.getFactory().get("http://example/square").getBaseExpr());
    }
   
    @Test
    public void test_user_defined_function_factory_add_02() {
        Expr e1 = new E_Multiply(new ExprVar("x"), new ExprVar("x"));
        Expr e2 = new E_Multiply(new ExprVar("y"), new ExprVar("y"));
       
        UserDefinedFunctionFactory.getFactory().add("http://example/square", e1, new ArrayList<>(e1.getVarsMentioned()));
        Assert.assertTrue(UserDefinedFunctionFactory.getFactory().isRegistered("http://example/square"));
        Assert.assertEquals(e1, UserDefinedFunctionFactory.getFactory().get("http://example/square").getBaseExpr());
       
View Full Code Here

        Assert.assertEquals(e2, UserDefinedFunctionFactory.getFactory().get("http://example/square").getBaseExpr());
    }
   
    @Test
    public void test_user_defined_function_factory_add_03() throws ParseException {
        Expr e = new E_Multiply(new ExprVar("x"), new ExprVar("x"));
       
        //Instead of registering the pre-built expression register using a string for the expression
        UserDefinedFunctionFactory.getFactory().add("http://example/square", "?x * ?x", new ArrayList<>(e.getVarsMentioned()));
       
        Assert.assertTrue(UserDefinedFunctionFactory.getFactory().isRegistered("http://example/square"));
View Full Code Here

        UserDefinedFunctionFactory.getFactory().setPreserveDependencies(false);
    }

    @Test
    public void test_function_expansion_01() {
        Expr e = new ExprVar("x");
        UserDefinedFunctionFactory.getFactory().add("http://example/simple", e, new ArrayList<>(e.getVarsMentioned()));
       
        UserDefinedFunction f = (UserDefinedFunction) UserDefinedFunctionFactory.getFactory().create("http://example/simple");
        f.build("http://example/simple", new ExprList(new NodeValueBoolean(true)));
       
        Expr actual = f.getActualExpr();
        Assert.assertFalse(e.equals(actual));
        Assert.assertEquals(0, actual.getVarsMentioned().size());
        Assert.assertEquals(new NodeValueBoolean(true), actual);
    }
View Full Code Here

TOP

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

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.