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

org.aksw.sparqlify.database.PrefixIndexMetaFactory Maven / Gradle / Ivy

The newest version!
package org.aksw.sparqlify.database;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Function;

public class PrefixIndexMetaFactory
    implements MetaIndexFactory
{
    public static Set> supportedConstraintClasses = new HashSet>();

    static
    {
        supportedConstraintClasses.add(PrefixConstraint.class);
    }

    public Set> getSupportedConstraintClasses() {
        return supportedConstraintClasses;
    }


    private Function> prefixExtractor;

    public PrefixIndexMetaFactory(Function> prefixExtractor) {
        this.prefixExtractor = prefixExtractor;
    }

    @Override
    public MapStoreAccessor create(Table table, List columnNames) {

        int[] indexColumns = new int[columnNames.size()];

        for(int i = 0; i < indexColumns.length; ++i) {
            String columnName = columnNames.get(i);
            indexColumns[i] = table.getColumns().getIndex(columnName);
        }

        PrefixMapStoreAccessor accessor = new PrefixMapStoreAccessor(indexColumns, prefixExtractor);

        return accessor;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy