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

org.aksw.jena_sparql_api.stmt.QuerySupplierImpl Maven / Gradle / Ivy

package org.aksw.jena_sparql_api.stmt;

import java.util.function.Supplier;

import org.apache.jena.query.Query;
import org.apache.jena.sparql.core.Prologue;


public class QuerySupplierImpl
    implements Supplier
{
    protected Prologue prologue;

    public QuerySupplierImpl() {
        this(null);
    }

    public QuerySupplierImpl(Prologue prologue) {
        super();
        this.prologue = prologue;
    }


    @Override
    public Query get() {
        Query result = new Query();

        if(prologue != null) {
            result.setBaseURI(prologue.getBaseURI());
//            PrefixMappingImpl tmp = new PrefixMappingImpl();
//            // Note: Query parsing may modify the prefixes, hence create a copy of the prefix mappings
//            tmp.setNsPrefixes(prologue.getPrefixMapping());
            result.getPrefixMapping().setNsPrefixes(prologue.getPrefixMapping());
        }

        return result;
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy