/*** * This method loads the given ontologies in the system. This will merge * these new ontologies with the existing ones in a set. Then it will * translate the assertions in all the ontologies into a single one, in our * internal representation. * * The translation is done using our OWLAPITranslator that gets the TBox * part of the ontologies and filters all the DL-Lite axioms (RDFS/OWL2QL * and DL-Lite). * */ private ClassifiedTBox loadOntologies(OWLOntology ontology) { /* * We will keep track of the loaded ontologies and translate the TBox * part of them into our internal representation. */ log.debug("Load ontologies called. Translating ontologies."); Ontology mergeOntology = owlapiTranslator.translateAndClassify(ontology); return mergeOntology.tbox(); }
Optional<Ontology> loadOntology() throws OntologyException { OWLAPITranslatorOWL2QL translator = getInjector().getInstance(OWLAPITranslatorOWL2QL.class); try { return loadInputOntology() .map(o -> translator.translateAndClassify(o)); } catch (OWLOntologyCreationException e) { throw new OntologyException(e.getMessage()); } }
/** * Methods to get the empty concepts and roles in the ontology using the given mappings. * It generates SPARQL queries to check for entities. * @return QuestOWLEmptyEntitiesChecker class to get empty concepts and roles * @throws Exception */ public QuestOWLEmptyEntitiesChecker getEmptyEntitiesChecker() throws Exception { OWLOntology rootOntology = getRootOntology(); Ontology mergeOntology = owlapiTranslator.translateAndClassify(rootOntology); ClassifiedTBox tBox = mergeOntology.tbox(); return new QuestOWLEmptyEntitiesChecker(tBox, owlConnection); }
/** * High-level method */ public static OntopSemanticIndexLoader loadOntologyIndividuals(OWLOntology owlOntology, Properties properties) throws SemanticIndexException { OntopModelConfiguration defaultConfiguration = OntopModelConfiguration.defaultBuilder().build(); OWLAPITranslatorOWL2QL translatorOWL2QL = defaultConfiguration.getInjector().getInstance(OWLAPITranslatorOWL2QL.class); Ontology ontology = translatorOWL2QL.translateAndClassify(owlOntology); SIRepository repo = new SIRepository(ontology.tbox(), defaultConfiguration.getTermFactory(), defaultConfiguration.getTypeFactory(), defaultConfiguration.getInjector().getInstance(TargetAtomFactory.class) ); try { Connection connection = repo.createConnection(); // load the data Set<OWLOntology> ontologyClosure = owlOntology.getOWLOntologyManager().getImportsClosure(owlOntology); OWLAPIABoxIterator aBoxIter = new OWLAPIABoxIterator(ontologyClosure, ontology.tbox(), translatorOWL2QL); int count = repo.insertData(connection, aBoxIter); LOG.debug("Inserted {} triples from the ontology.", count); return new OntopSemanticIndexLoaderImpl(repo, connection, properties, Optional.of(extractTBox(owlOntology))); } catch (SQLException e) { throw new SemanticIndexException(e.getMessage()); } }
Ontology ontology = translatorOWL2QL.translateAndClassify(inputOntology); SIRepository repo = new SIRepository(ontology.tbox(), obdaConfiguration.getTermFactory(), obdaConfiguration.getTypeFactory(),