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

it.unibz.inf.ontop.rdf4j.predefined.impl.FakeOntopRDF4JPredefinedQueryEngine Maven / Gradle / Ivy

The newest version!
package it.unibz.inf.ontop.rdf4j.predefined.impl;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import it.unibz.inf.ontop.rdf4j.predefined.OntopRDF4JPredefinedQueryEngine;
import org.eclipse.rdf4j.query.GraphQueryResult;
import org.eclipse.rdf4j.query.QueryEvaluationException;
import org.eclipse.rdf4j.rio.RDFHandlerException;

import java.io.OutputStream;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

public class FakeOntopRDF4JPredefinedQueryEngine implements OntopRDF4JPredefinedQueryEngine {

    @Override
    public void evaluate(String queryId, ImmutableMap bindings, ImmutableList acceptMediaTypes,
                         ImmutableMap httpHeaders, Consumer httpStatusSetter,
                         BiConsumer httpHeaderSetter, OutputStream outputStream)
            throws QueryEvaluationException, RDFHandlerException {
        // Not-recognized query id
        httpStatusSetter.accept(404);
    }

    @Override
    public String evaluate(String queryId, ImmutableMap bindings, ImmutableList acceptMediaTypes,
                           ImmutableMap httpHeaders, Consumer httpStatusSetter,
                           BiConsumer httpHeaderSetter) {
        // Not-recognized query id
        httpStatusSetter.accept(404);
        return "Not found";
    }

    @Override
    public boolean shouldStream(String queryId) {
        return false;
    }

    @Override
    public GraphQueryResult evaluateGraph(String queryId, ImmutableMap bindings) throws QueryEvaluationException {
        throw new UnsupportedOperationException("Intended to be used by the HTTP endpoint only");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy