void declareOntologyDefined() { if (isOntologyDefined) { throw new InvalidOntopConfigurationException("Ontology already defined!"); } isOntologyDefined = true; }
void declareOntologyDefined() { if (isOntologyDefined) { throw new InvalidOntopConfigurationException("Ontology already defined!"); } isOntologyDefined = true; }
void declareImplicitConstraintSetDefined() { if (isImplicitConstraintSetDefined) throw new InvalidOntopConfigurationException("The implicit constraint file is already defined"); isImplicitConstraintSetDefined = true; }
void declareOntologyDefined() { if (isOBDASpecificationAssigned()) throw new InvalidOntopConfigurationException("The OBDA specification has already been assigned"); if (isOntologyDefined) { throw new InvalidOntopConfigurationException("Ontology already defined!"); } isOntologyDefined = true; }
/** * Allows to detect double mapping definition (error). */ protected final void declareMappingDefined() { if (isOBDASpecificationAssigned()) throw new InvalidOntopConfigurationException("The OBDA specification has already been assigned"); if (isMappingDefined) throw new InvalidOntopConfigurationException("The mapping is already defined"); isMappingDefined = true; }
/** * Not for end-users! Please consider giving a mapping file or a mapping reader. */ @Override public B ppMapping(@Nonnull SQLPPMapping ppMapping) { if (isMappingDefinedSupplier.get()) { throw new InvalidOntopConfigurationException("OBDA model or mappings already defined!"); } declareMappingDefinedCB.run(); this.ppMapping = Optional.of(ppMapping); return builder; }
/** * Not for end-users! Please consider giving a mapping file or a mapping reader. */ @Override public B ppMapping(@Nonnull SQLPPMapping ppMapping) { if (isMappingDefinedSupplier.get()) { throw new InvalidOntopConfigurationException("OBDA model or mappings already defined!"); } declareMappingDefinedCB.run(); this.ppMapping = Optional.of(ppMapping); return builder; }
@Override void declareOBDASpecificationAssigned() { super.declareOBDASpecificationAssigned(); if (isDBMetadataDefined) { throw new InvalidOntopConfigurationException("DBMetadata is already defined, " + "cannot assign the OBDA specification"); } if (isMappingDefined()) { throw new InvalidOntopConfigurationException("The mapping is already defined, " + "cannot assign the OBDA specification"); } }
final void declareDBMetadataDefined() { if (isOBDASpecificationAssigned()) { throw new InvalidOntopConfigurationException("The OBDA specification has already been assigned"); } isDBMetadataDefined = true; }
int getRequiredInteger(String key) { return getInteger(key) .orElseThrow(() -> new InvalidOntopConfigurationException(key + " is required but missing " + "(must have a default value)")); }
boolean getRequiredBoolean(String key) { return getBoolean(key) .orElseThrow(() -> new InvalidOntopConfigurationException(key + " is required but missing " + "(must have a default value)")); }
int getRequiredInteger(String key) { return getInteger(key) .orElseThrow(() -> new InvalidOntopConfigurationException(key + " is required but missing " + "(must have a default value)")); }
final void declareDBMetadataDefined() { if (isOBDASpecificationAssigned()) { throw new InvalidOntopConfigurationException("The OBDA specification has already been assigned"); } isDBMetadataDefined = true; }
@Override public final B propertyFile(File propertyFile) { try { Properties p = new Properties(); p.load(new FileReader(propertyFile)); return properties(p); } catch (IOException e) { // System.out.println(e); throw new InvalidOntopConfigurationException("Cannot reach the property file: " + propertyFile); } }
@Override public <R extends ProposalResults, P extends QueryOptimizationProposal<R>> ProposalExecutor<P, R> getExecutor( P proposal) { Optional<Class<? extends ProposalExecutor>> optionalExecutorClass = getProposalExecutorInterface(proposal.getClass()); if (optionalExecutorClass.isPresent()) { return injector.getInstance(optionalExecutorClass.get()); } else { throw new InvalidOntopConfigurationException("No executor found for a proposal of the type " + proposal.getClass()); } }
@Override public <R extends ProposalResults, P extends QueryOptimizationProposal<R>> ProposalExecutor<P, R> getExecutor( P proposal) { Optional<Class<? extends ProposalExecutor>> optionalExecutorClass = getProposalExecutorInterface(proposal.getClass()); if (optionalExecutorClass.isPresent()) { return injector.getInstance(optionalExecutorClass.get()); } else { throw new InvalidOntopConfigurationException("No executor found for a proposal of the type " + proposal.getClass()); } }
@Override public final B propertyFile(File propertyFile) { try { Properties p = new Properties(); p.load(new FileReader(propertyFile)); return properties(p); } catch (IOException e) { // System.out.println(e); throw new InvalidOntopConfigurationException("Cannot reach the property file: " + propertyFile); } }
@Override public OntopReformulationSQLConfiguration build() { if (!isOBDASpecificationAssigned()) throw new InvalidOntopConfigurationException("An OBDA specification must be assigned " + "to directly instantiate such a OntopReformulationSQLConfiguration"); OntopReformulationSQLSettings settings = new OntopReformulationSQLSettingsImpl(generateProperties()); OntopReformulationSQLOptions options = generateSQLReformulationOptions(); return new OntopReformulationSQLConfigurationImpl(settings, options); } }
@Override public OntopSystemSQLConfiguration build() { if (!isOBDASpecificationAssigned()) throw new InvalidOntopConfigurationException("An OBDA specification must be assigned " + "to directly instantiate such a OntopReformulationSQLConfiguration"); OntopSystemSQLSettings settings = new OntopSystemSQLSettingsImpl(generateProperties()); OntopSystemSQLOptions options = generateSystemSQLOptions(); return new OntopSystemSQLConfigurationImpl(settings, options); } }
@Override public OntopReformulationSQLConfiguration build() { if (!isOBDASpecificationAssigned()) throw new InvalidOntopConfigurationException("An OBDA specification must be assigned " + "to directly instantiate such a OntopReformulationSQLConfiguration"); OntopReformulationSQLSettings settings = new OntopReformulationSQLSettingsImpl(generateProperties()); OntopReformulationSQLOptions options = generateSQLReformulationOptions(); return new OntopReformulationSQLConfigurationImpl(settings, options); } }