void declareOntologyDefined() { if (isOntologyDefined) { throw new InvalidOntopConfigurationException("Ontology already defined!"); } isOntologyDefined = true; }
/** * End-users: use the QuestOWLFactory instead */ protected QuestOWL(OWLOntology rootOntology, QuestOWLConfiguration owlConfiguration) throws IllegalConfigurationException { super(rootOntology, owlConfiguration, BufferingMode.BUFFERING); OntopSystemOWLAPIConfiguration ontopConfiguration = owlConfiguration.getOntopConfiguration(); /* * Validates the preferences */ try { ontopConfiguration.validate(); } catch (InvalidOntopConfigurationException e) { throw new IllegalConfigurationException(e.getMessage(), owlConfiguration); } this.structuralReasoner = new StructuralReasoner(rootOntology, owlConfiguration, BufferingMode.BUFFERING); try { queryEngine = ontopConfiguration.loadQueryEngine(); /* * Mapping parsing exceptions are re-thrown as configuration exceptions. */ } catch (OBDASpecificationException e) { throw new IllegalConfigurationException(e, owlConfiguration); } inputQueryFactory = ontopConfiguration.getInputQueryFactory(); pm = owlConfiguration.getProgressMonitor(); version = extractVersion(); owlapiTranslator = ontopConfiguration.getInjector().getInstance(OWLAPITranslatorOWL2QL.class); prepareReasoner(); }
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 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; }
void declareOntologyDefined() { if (isOBDASpecificationAssigned()) throw new InvalidOntopConfigurationException("The OBDA specification has already been assigned"); if (isOntologyDefined) { throw new InvalidOntopConfigurationException("Ontology already defined!"); } isOntologyDefined = true; }
private static boolean extractBoolean(Properties properties, String key) { Object value = Optional.ofNullable(properties.get(key)) .orElseThrow(() -> new InvalidOntopConfigurationException(key + " key is missing")); if (value instanceof Boolean) return (Boolean) value; else if (value instanceof String) return Boolean.valueOf((String) value); else throw new InvalidOntopConfigurationException("Invalid value for " + key + ": is " + value); }
/** * 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; }
private static boolean extractBoolean(Properties properties, String key) { Object value = Optional.ofNullable(properties.get(key)) .orElseThrow(() -> new InvalidOntopConfigurationException(key + " key is missing")); if (value instanceof Boolean) return (Boolean) value; else if (value instanceof String) return Boolean.valueOf((String) value); else throw new InvalidOntopConfigurationException("Invalid value for " + key + ": is " + value); }
/** * 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)")); }
private static CardinalityPreservationMode extractCardinalityMode(Properties properties) throws InvalidOntopConfigurationException { Object cardinalityModeObject = Optional.ofNullable(properties.get(OntopModelSettings.CARDINALITY_MODE)) .orElseThrow(() -> new InvalidOntopConfigurationException(CARDINALITY_MODE + " key is missing")); if (cardinalityModeObject instanceof String) { try { return CardinalityPreservationMode.valueOf((String)cardinalityModeObject); } catch (IllegalArgumentException e) { } } else if (cardinalityModeObject instanceof CardinalityPreservationMode) return (CardinalityPreservationMode) cardinalityModeObject; throw new InvalidOntopConfigurationException("Invalid value for " + CARDINALITY_MODE + ": is " + cardinalityModeObject); }
private static CardinalityPreservationMode extractCardinalityMode(Properties properties) throws InvalidOntopConfigurationException { Object cardinalityModeObject = Optional.ofNullable(properties.get(OntopModelSettings.CARDINALITY_MODE)) .orElseThrow(() -> new InvalidOntopConfigurationException(CARDINALITY_MODE + " key is missing")); if (cardinalityModeObject instanceof String) { try { return CardinalityPreservationMode.valueOf((String)cardinalityModeObject); } catch (IllegalArgumentException e) { } } else if (cardinalityModeObject instanceof CardinalityPreservationMode) return (CardinalityPreservationMode) cardinalityModeObject; throw new InvalidOntopConfigurationException("Invalid value for " + CARDINALITY_MODE + ": is " + cardinalityModeObject); }
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)")); }