Search in sources :

Example 1 with E_Function

use of org.apache.jena.sparql.expr.E_Function in project jena by apache.

the class ExprFactoryTest method functionTest.

@Test
public void functionTest() {
    Expr e = factory.function("name", factory.list());
    assertTrue(e instanceof E_Function);
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) E_Function(org.apache.jena.sparql.expr.E_Function) Test(org.junit.Test)

Example 2 with E_Function

use of org.apache.jena.sparql.expr.E_Function in project jena by apache.

the class AggCustom method equals.

@Override
public boolean equals(Aggregator other, boolean bySyntax) {
    if (other == null)
        return false;
    if (this == other)
        return true;
    if (!AggregateRegistry.isRegistered(iri)) {
        E_Function f1 = asFunction();
        if (!(other instanceof AggCustom))
            return false;
        E_Function f2 = ((AggCustom) other).asFunction();
        return f1.equals(f2, bySyntax);
    }
    if (!(other instanceof AggCustom))
        return false;
    AggCustom agg = (AggCustom) other;
    return Objects.equals(this.iri, agg.iri) && this.isDistinct == agg.isDistinct && this.getExprList().equals(agg.getExprList(), bySyntax);
}
Also used : E_Function(org.apache.jena.sparql.expr.E_Function)

Example 3 with E_Function

use of org.apache.jena.sparql.expr.E_Function in project jena by apache.

the class WhereHandlerTest method testAddFilterWithNamespace.

@Test
public void testAddFilterWithNamespace() throws ParseException {
    query.setPrefix("afn", "http://jena.apache.org/ARQ/function#");
    handler.addFilter("afn:namespace(?one) = 'foo'");
    handler.build();
    ExprFactory fact = new ExprFactory();
    E_Function func = new E_Function("http://jena.apache.org/ARQ/function#namespace", fact.asList("?one"));
    E_Equals expr = fact.eq(func, "foo");
    WhereValidator visitor = new WhereValidator(new ElementFilter(expr));
    handler.getQueryPattern().visit(visitor);
    assertTrue(visitor.matching);
}
Also used : WhereValidator(org.apache.jena.arq.querybuilder.WhereValidator) E_Equals(org.apache.jena.sparql.expr.E_Equals) ElementFilter(org.apache.jena.sparql.syntax.ElementFilter) E_Function(org.apache.jena.sparql.expr.E_Function) ExprFactory(org.apache.jena.arq.querybuilder.ExprFactory) Test(org.junit.Test)

Aggregations

E_Function (org.apache.jena.sparql.expr.E_Function)3 Test (org.junit.Test)2 ExprFactory (org.apache.jena.arq.querybuilder.ExprFactory)1 WhereValidator (org.apache.jena.arq.querybuilder.WhereValidator)1 E_Equals (org.apache.jena.sparql.expr.E_Equals)1 Expr (org.apache.jena.sparql.expr.Expr)1 ElementFilter (org.apache.jena.sparql.syntax.ElementFilter)1