Search in sources :

Example 6 with ReadRdf4j

use of mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j in project opentheso by miledrousset.

the class rdf4jFileBean method chargeJsonLd.

/**
 * @param event
 */
public void chargeJsonLd(FileUploadEvent event) {
    progress = 0;
    if (!PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId())) {
        event.setPhaseId(PhaseId.INVOKE_APPLICATION);
        event.queue();
    } else {
        InputStream is = null;
        try {
            try {
                is = event.getFile().getInputstream();
            } catch (IOException ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            } catch (Exception ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            }
            ReadRdf4j readRdf4j;
            try {
                readRdf4j = new ReadRdf4j(is, 1);
                warning = readRdf4j.getMessage();
                progress = 100;
                sKOSXmlDocument = readRdf4j.getsKOSXmlDocument();
                total = sKOSXmlDocument.getConceptList().size() + sKOSXmlDocument.getGroupList().size() + 1;
                uri = sKOSXmlDocument.getTitle();
                uploadEnable = false;
                BDDinsertEnable = true;
                info = "File correctly loaded";
            } catch (IOException ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            } catch (Exception ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            }
        } catch (Exception e) {
            error.append(System.getProperty("line.separator"));
            error.append(e.toString());
        } finally {
            showError();
        }
    }
}
Also used : ReadRdf4j(mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j) InputStream(java.io.InputStream) IOException(java.io.IOException) SQLException(java.sql.SQLException) ParseException(java.text.ParseException) IOException(java.io.IOException)

Example 7 with ReadRdf4j

use of mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j in project opentheso by miledrousset.

the class rdf4jFileBean method chargeJson.

/**
 * @param event
 */
public void chargeJson(FileUploadEvent event) {
    progress = 0;
    if (!PhaseId.INVOKE_APPLICATION.equals(event.getPhaseId())) {
        event.setPhaseId(PhaseId.INVOKE_APPLICATION);
        event.queue();
    } else {
        InputStream is = null;
        try {
            try {
                is = event.getFile().getInputstream();
            } catch (IOException ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            } catch (Exception ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            }
            ReadRdf4j readRdf4j;
            try {
                readRdf4j = new ReadRdf4j(is, 3);
                warning = readRdf4j.getMessage();
                progress = 100;
                sKOSXmlDocument = readRdf4j.getsKOSXmlDocument();
                total = sKOSXmlDocument.getConceptList().size() + sKOSXmlDocument.getGroupList().size() + 1;
                uri = sKOSXmlDocument.getTitle();
                uploadEnable = false;
                BDDinsertEnable = true;
                info = "File correctly loaded";
            } catch (IOException ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            } catch (Exception ex) {
                error.append(System.getProperty("line.separator"));
                error.append(ex.getMessage());
            }
        } catch (Exception e) {
            error.append(System.getProperty("line.separator"));
            error.append(e.toString());
        } finally {
            showError();
        }
    }
}
Also used : ReadRdf4j(mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j) InputStream(java.io.InputStream) IOException(java.io.IOException) SQLException(java.sql.SQLException) ParseException(java.text.ParseException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)7 ReadRdf4j (mom.trd.opentheso.core.imports.rdf4j.ReadRdf4j)7 InputStream (java.io.InputStream)6 SQLException (java.sql.SQLException)5 ParseException (java.text.ParseException)4 SKOSXmlDocument (mom.trd.opentheso.skosapi.SKOSXmlDocument)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ArrayList (java.util.ArrayList)2 DownloadBean (mom.trd.opentheso.SelectedBeans.DownloadBean)2 SKOSDocumentation (mom.trd.opentheso.skosapi.SKOSDocumentation)2 SKOSLabel (mom.trd.opentheso.skosapi.SKOSLabel)2 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)2 FileNotFoundException (java.io.FileNotFoundException)1 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)1 SelectedResource (mom.trd.opentheso.core.alignment.SelectedResource)1