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

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

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

import java.util.Map;
import java.util.Set;

import org.apache.jena.sparql.core.Var;

import com.google.common.collect.Sets;

/**
 * A less general form of AggMap2 ; this class should be removed and AggMap2 renamed to this
 * 
 * @author raven
 *
 * @param 
 * @param 
 */
public class AggMap
    implements Agg>
{
    private BindingMapper mapper;
    private Agg subAgg;

    public AggMap(BindingMapper mapper, Agg subAgg) {
        this.mapper = mapper;
        this.subAgg = subAgg;
    }

    @Override
    public Acc> createAccumulator() {
        Acc> result = new AccMap(mapper, subAgg);
        return result;
    }

    @Override
    public Set getDeclaredVars() {
        Set a = mapper instanceof BindingMapperVarAware
        ? ((BindingMapperVarAware)mapper).getVarsMentioned()
        : null // Collections.emptySet()
        ;

        Set b = subAgg.getDeclaredVars();
        Set result = a == null || b == null
            ? null
            : Sets.union(a, b);

        return result;
    }

    public static  AggMap create(BindingMapper mapper, Agg subAgg) {
        AggMap result = new AggMap(mapper, subAgg);
        return result;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy