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

it.unibz.inf.ontop.injection.OntopMappingSQLConfiguration Maven / Gradle / Ivy

There is a newer version: 5.2.1.1
Show newest version
package it.unibz.inf.ontop.injection;


import it.unibz.inf.ontop.exception.MappingException;
import it.unibz.inf.ontop.injection.impl.OntopMappingSQLConfigurationImpl;
import it.unibz.inf.ontop.spec.mapping.pp.SQLPPMapping;

import javax.annotation.Nonnull;
import java.util.Optional;

public interface OntopMappingSQLConfiguration extends OntopSQLCredentialConfiguration, OntopMappingConfiguration {

    @Override
    OntopMappingSQLSettings getSettings();

    /**
     * Default builder
     */
    static Builder defaultBuilder() {
        return new OntopMappingSQLConfigurationImpl.BuilderImpl<>();
    }

    Optional loadPPMapping() throws MappingException;

    default SQLPPMapping loadProvidedPPMapping() throws MappingException {
        return loadPPMapping()
                .orElseThrow(() -> new IllegalStateException("No PreProcessedMapping could have been loaded. " +
                        "Do not call this method unless you are sure of the input provision."));
    }

    /**
     * TODO: explain
     */
    interface OntopMappingSQLBuilderFragment> {

        B ppMapping(@Nonnull SQLPPMapping ppMapping);
    }

    interface Builder> extends OntopMappingSQLBuilderFragment,
            OntopSQLCredentialConfiguration.Builder, OntopMappingConfiguration.Builder {

        @Override
        OntopMappingSQLConfiguration build();
    }
}