use of org.semanticweb.owlapi.model.OWLOntologyCreationException in project opentheso by miledrousset.
the class FileBean_progress method chargeSkos2.
/**
* Cette fonction permet d'insérer un thésaurus en base de données à partir
* d'un fichier Skos en utilsant leskosapi et owlapi (officiel)
*
* @param event
*/
public void chargeSkos2(FileUploadEvent event) {
if (!PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId())) {
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
event.queue();
} else {
UploadedFile file = event.getFile();
if (formatDate == null || formatDate.equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("file.error2")));
} else {
try {
boolean useArk = false;
ResourceBundle bundlePref = getBundlePref();
if (bundlePref.getString("useArk").equalsIgnoreCase("true")) {
useArk = true;
}
String adressSite = bundlePref.getString("cheminSite");
int idUser = selectedTerme.getUser().getUser().getId();
// lecture du fichier SKOS
ImportSkosHelper importSkosHelper = new ImportSkosHelper();
importSkosHelper.setInfos(connect.getPoolConnexion(), formatDate, useArk, adressSite, idUser, langueSource);
if (!importSkosHelper.readFile(file.getInputstream(), file.getFileName())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", importSkosHelper.getMessage()));
return;
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, langueBean.getMsg("info") + " :", importSkosHelper.getMessage()));
}
// chargement du nom du thesaurus
if (!importSkosHelper.addThesaurus()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Aucune information sur le thésaurus et ses domaines, un thésaurus par defaut sera créer.. " + /*langueBean.getMsg("info")*/
" :", importSkosHelper.getMessage()));
if (!importSkosHelper.addDefaultThesaurus()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", importSkosHelper.getMessage()));
}
// echec de l'ajout du nom de thésaurus
}
// chargement des concepts
if (!importSkosHelper.addConcepts()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Aucun Concept n'a été détecté dans le fichier ... " + /*langueBean.getMsg("info")*/
" :", importSkosHelper.getMessage()));
// echec de l'ajout des concepts
}
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, langueBean.getMsg("info") + " :", importSkosHelper.getMessage()));
vue.setAddSkos2(false);
}// }
catch (IOException | OWLOntologyCreationException | SKOSCreationException ex) {
Logger.getLogger(FileBean.class.getName()).log(Level.SEVERE, null, ex);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", ex.getMessage()));
}
}
}
}
use of org.semanticweb.owlapi.model.OWLOntologyCreationException in project opentheso by miledrousset.
the class SKOSManager method loadDatasetFromInputStream.
public SKOSDataset loadDatasetFromInputStream(InputStream uri) throws SKOSCreationException {
OWLOntology onto = null;
try {
onto = man.loadOntologyFromOntologyDocument(uri);
} catch (OWLOntologyCreationException e) {
throw new SKOSCreationException(e);
}
SKOSDatasetImpl voc;
// voc;
return null;
}
Aggregations