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

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

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

import org.apache.jena.sparql.engine.binding.Binding;
import org.apache.jena.sparql.function.FunctionEnv;

public class AccLiteral
    implements Acc
{
    private T value = null;
    private long i = 0;
    private BindingMapper bindingMapper;

    public AccLiteral(BindingMapper bindingMapper) {
        this.bindingMapper = bindingMapper;
    }

    @Override
    public void accumulate(Binding binding, FunctionEnv env) {
        // TODO Detect if we override the value and raise a warning!
        value = bindingMapper.apply(binding, i++);
    }

    @Override
    public T getValue() {
        return value;
    }

    public static  AccLiteral create(BindingMapper bindingMapper) {
        return new AccLiteral(bindingMapper);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy