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

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


    }
   
    @Test public void combine_assign_02()
    {
        Op assign = OpAssign.assignDirect(OpTable.unit(), new VarExprList(Var.alloc("x"), new NodeValueInteger(1)));
        assign = OpAssign.assignDirect(assign, new VarExprList(Var.alloc("y"), new ExprVar("x")));
       
        String opExpectedString = StrUtils.strjoinNL(
                                            "(assign ((?x 1) (?y ?x))",
                                            "  (table unit))");
       
View Full Code Here


        for(int i = 0; i < 500; i++){
            unsorted.add(randomBinding(vars));
        }
       
        List<SortCondition> conditions = new ArrayList<>();
        conditions.add(new SortCondition(new ExprVar("8"), Query.ORDER_ASCENDING));
        comparator = new BindingComparator(conditions);
       
        iterator = new CallbackIterator(unsorted.iterator(), 25, null);
        iterator.setCallback(new Callback() {
            @Override
View Full Code Here

   
    NodeRelation label_fr_be  = search("table1", "label_fr_be", rels);
    NodeRelation label_en     = search("table1", "label_en", rels);
    NodeRelation label_noLang = search("table1", "label", rels);
   
    Expr filterFR    = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr"));
    Expr filterEN_TAG_EN = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeNode("en", "en", (String) null));
    Expr filterFR_BE = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr-BE"));
    Expr filter      = new E_Equals(new E_Lang(new ExprVar("o")), NodeValue.makeString(""));
   
    assertEquals("LANG(label_fr_be) = \"fr\" should be FALSE",   Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_fr_be));
    assertEquals("LANG(label_en) = \"fr\" should be FALSE",      Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_en));
    assertEquals("LANG(label_fr_be) = \"fr_be\" should be TRUE", Expression.TRUE,  TransformExprToSQLApplyer.convert(filterFR_BE, label_fr_be));
    assertEquals("LANG(label_en) = \"en\"@en should be FALSE",   Expression.FALSE, TransformExprToSQLApplyer.convert(filterEN_TAG_EN, label_en));
View Full Code Here

   
    NodeRelation label_fr_be = search("table1", "label_fr_be", rels);
    NodeRelation label_en = search("table1", "label_en", rels);
    NodeRelation label = search("table1", "label", rels);
   
    Expr filterFR    = new E_LangMatches(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr"));
    Expr filterEN    = new E_LangMatches(new E_Lang(new ExprVar("o")), NodeValue.makeString("en"));
    Expr filterFR_BE = new E_LangMatches(new E_Lang(new ExprVar("o")), NodeValue.makeString("fr-BE"));
    Expr filterALL   = new E_LangMatches(new E_Lang(new ExprVar("o")), NodeValue.makeString("*"));
   
    assertEquals("LANGMATCHES(LANG(label_fr_be), \"fr\") should be TRUE",   Expression.TRUE,  TransformExprToSQLApplyer.convert(filterFR, label_fr_be));
    assertEquals("LANGMATCHES(LANG(label_en), \"fr\") should be FALSE",     Expression.FALSE, TransformExprToSQLApplyer.convert(filterFR, label_en));
    assertEquals("LANGMATCHES(LANG(label_en), \"en\") should be TRUE",      Expression.TRUE,  TransformExprToSQLApplyer.convert(filterEN, label_en));
    assertEquals("LANGMATCHES(LANG(label_fr_BE, \"fr_BE\") should be TRUE", Expression.TRUE , TransformExprToSQLApplyer.convert(filterFR_BE, label_fr_be));
View Full Code Here

    pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
    rels = translate(pattern, "optimizer/filtertests.n3");
   
    NodeRelation intvalue = search("table2", "intvalue", rels);
   
    Expr subject = new E_IsLiteral(new ExprVar("s"));
    Expr object  = new E_IsLiteral(new ExprVar("o"));
   
    assertEquals("ISLITERAL(literal) should be TRUE",      Expression.TRUE,  TransformExprToSQLApplyer.convert(object, label));
    assertEquals("ISLITERAL(literal@lang) should be TRUE", Expression.TRUE,  TransformExprToSQLApplyer.convert(object, label_en));
    assertEquals("ISLITERAL(uri) should be FALSE",         Expression.FALSE, TransformExprToSQLApplyer.convert(subject, label));
    assertEquals("ISLITERAL(intvalue) should be TRUE",     Expression.TRUE,  TransformExprToSQLApplyer.convert(object, intvalue));
View Full Code Here

    pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
    rels = translate(pattern, "optimizer/filtertests.n3");
   
    NodeRelation intvalue = search("table2", "intvalue", rels);
   
    Expr subject = new E_IsIRI(new ExprVar("s"));
    Expr object  = new E_IsIRI(new ExprVar("o"));
   
    assertEquals("ISIRI(literal) should be FALSE",      Expression.FALSE, TransformExprToSQLApplyer.convert(object, label));
    assertEquals("ISIRI(literal@lang) should be FALSE", Expression.FALSE, TransformExprToSQLApplyer.convert(object, label_en));
    assertEquals("ISIRI(uri) should be TRUE",           Expression.TRUE,  TransformExprToSQLApplyer.convert(subject, label));
    assertEquals("ISIRI(intvalue) should be FALSE",     Expression.FALSE, TransformExprToSQLApplyer.convert(object, intvalue));
View Full Code Here

    pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
    rels = translate(pattern, "optimizer/filtertests.n3");
   
    NodeRelation intvalue = search("table2", "intvalue", rels);
   
    Expr subject = new E_IsBlank(new ExprVar("s"));
    Expr object  = new E_IsBlank(new ExprVar("o"));
   
    assertEquals("ISBLANK(literal) should be FALSE",      Expression.FALSE, TransformExprToSQLApplyer.convert(object, label));
    assertEquals("ISBLANK(literal@lang) should be FALSE", Expression.FALSE, TransformExprToSQLApplyer.convert(object, label_en));
    assertEquals("ISBLANK(uri) should be FALSE",          Expression.FALSE, TransformExprToSQLApplyer.convert(subject, label));
    assertEquals("ISBLANK(intvalue) should be FALSE",     Expression.FALSE, TransformExprToSQLApplyer.convert(object, intvalue));
View Full Code Here

    pattern.add(Triple.create(Node.createVariable("s"), RDFS.label.asNode(), Node.createVariable("o")));
    rels = translate(pattern, "optimizer/filtertests.n3");
   
    NodeRelation langliteral = search("table1", "label_en", rels);
   
    Expr filterint    = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDint.getURI())));
    Expr filterstring = new E_Equals(new E_Datatype(new ExprVar("o")), NodeValueNode.makeNode(Node.createURI(XSDDatatype.XSDstring.getURI())));
   
    assertEquals("DATATYPE(intliteral) = xsd:int should be TRUE",       Expression.TRUE, TransformExprToSQLApplyer.convert(filterint, intvalue));
    assertEquals("DATATYPE(simpleliteral) = xsd:string should be TRUE", Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, value));
    assertEquals("DATATYPE(langliteral) = xsd:string should be TRUE",   Expression.TRUE, TransformExprToSQLApplyer.convert(filterstring, langliteral));
  }
View Full Code Here

    pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
    NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
   
    NodeRelation intvalue = search("table2", "intvalue", rels);
 
    Expr disjunction = new E_LogicalOr(new E_Equals(new ExprVar("o"),  NodeValue.makeNode("1", XSDDatatype.XSDint)), new E_Equals(new ExprVar("o"), NodeValue.makeNode("2", XSDDatatype.XSDint)));
   
    Expression result = TransformExprToSQLApplyer.convert(disjunction, intvalue);
    TypedNodeMaker nm = (TypedNodeMaker) intvalue.nodeMaker(Var.alloc("o"));
    Expression e1 = nm.valueMaker().valueExpression("1");
    Expression e2 = nm.valueMaker().valueExpression("2");
View Full Code Here

    pattern.add(Triple.create(Node.createVariable("s"), Node.createURI("http://example.org/value"), Node.createVariable("o")));
    NodeRelation[] rels = translate(pattern, "optimizer/filtertests.n3");
   
    NodeRelation intvalue = search("table2", "intvalue", rels);
 
    Expr sameTerm = new E_SameTerm(new ExprVar("o"),  NodeValue.makeNode("1", XSDDatatype.XSDint));
   
    Expression result = TransformExprToSQLApplyer.convert(sameTerm, intvalue);
    TypedNodeMaker nm = (TypedNodeMaker) intvalue.nodeMaker(Var.alloc("o"));
    Expression expected = nm.valueMaker().valueExpression("1");
   
    assertEquals("sameTerm(?o, \"1\"^^xsd:int)", expected, result);
   
    sameTerm = new E_SameTerm(new ExprVar("o"),  NodeValue.makeNode("1", XSDDatatype.XSDdecimal));
   
    result = TransformExprToSQLApplyer.convert(sameTerm, intvalue);
   
    assertEquals("sameTerm(?o, \"1\"^^xsd:decimal)", Expression.FALSE, result);
  }
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.