def convert_worker(self, filename): db_path = os.path.join( self.db_dir, '.'.join( (os.path.splitext(os.path.basename(filename))[0], "sqlite3"))) if not os.path.isfile(db_path): self.Print(cDebug.LEVEL_DEVELOPMENT, 'Convert: ' + db_path) my_world = World() my_world.set_backend(filename=db_path) my_world.get_ontology('file://' + filename).load() my_world.save() if self.remove_source: os.remove(filename) return db_path
def get_ontology_from_local_file(filename: str = '', db_dir: str = '', db_dir_name: str = '', use_owl_world: bool = True) -> Ontology: filename_with_prefix = 'file://' + filename if use_owl_world: if not os.path.isdir(db_dir): ret = FL.CreateDir(db_dir) my_world = World() my_world.set_backend(filename=db_dir_name) return my_world.get_ontology(filename_with_prefix).load() else: return get_ontology(filename_with_prefix).load()
def get_ontology_from_database(iri, db_dir_name, exclusive=True) -> Ontology: my_world = World() my_world.set_backend(filename=db_dir_name, exclusive=exclusive) return my_world.get_ontology(iri).load()