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

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


   
    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


    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

                Expr x = exprOneOf.getLHS() ;
                Expr disjunction = null ;
                // if ?x IN () then it's false regardless. 
                for ( Expr sub : exprOneOf.getRHS() )
                {
                    Expr e2 = new E_Equals(x, sub) ;
                    if ( disjunction == null )
                        disjunction = e2 ;
                    else
                        disjunction = new E_LogicalOr(disjunction, e2) ;
                }
View Full Code Here

TOP

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

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.