All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.jenax.arq.aggregation.BindingMapperExpr Maven / Gradle / Ivy

The newest version!
package org.aksw.jenax.arq.aggregation;

import java.util.Set;

import org.apache.jena.graph.Node;
import org.apache.jena.sparql.core.Var;
import org.apache.jena.sparql.engine.binding.Binding;
import org.apache.jena.sparql.expr.Expr;
import org.apache.jena.sparql.expr.ExprVars;
import org.apache.jena.sparql.expr.NodeValue;
import org.apache.jena.sparql.util.ExprUtils;

public class BindingMapperExpr
    implements BindingMapperVarAware {

    private Expr expr;

    public BindingMapperExpr(Expr expr) {
        this.expr = expr;
    }

    @Override
    public Node apply(Binding binding, Long rowNum) {
        NodeValue nv = ExprUtils.eval(expr, binding);
        Node result = nv.asNode();
        return result;
    }

    @Override
    public Set getVarsMentioned() {
        Set result = ExprVars.getVarsMentioned(expr);
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy