Search in sources :

Example 1 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class ExportRdf4jHelper method addThesaurus.

public void addThesaurus(String idThesaurus, List<NodeLang> selectedLanguages) {
    nodeThesaurus = new ThesaurusHelper().getNodeThesaurus(ds, idThesaurus);
    String uri = getUriFromId(nodeThesaurus.getIdThesaurus());
    SKOSResource conceptScheme = new SKOSResource(uri, SKOSProperty.ConceptScheme);
    idTheso = nodeThesaurus.getIdThesaurus();
    String creator;
    String contributor;
    String title;
    String language;
    for (Thesaurus thesaurus : nodeThesaurus.getListThesaurusTraduction()) {
        boolean isInSelectedLanguages = false;
        for (NodeLang nodeLang : selectedLanguages) {
            if (nodeLang.getCode().equals(thesaurus.getLanguage())) {
                isInSelectedLanguages = true;
                break;
            }
        }
        if (!isInSelectedLanguages) {
            break;
        }
        creator = thesaurus.getCreator();
        contributor = thesaurus.getContributor();
        title = thesaurus.getTitle();
        language = thesaurus.getLanguage();
        /*[...]*/
        if (creator != null && !creator.equalsIgnoreCase("null")) {
            conceptScheme.addCreator(creator, SKOSProperty.creator);
        }
        if (contributor != null && !contributor.equalsIgnoreCase("null")) {
            conceptScheme.addCreator(creator, SKOSProperty.contributor);
        }
        if (title != null && language != null) {
            conceptScheme.addLabel(title, language, SKOSProperty.prefLabel);
        }
        // dates
        String created = thesaurus.getCreated().toString();
        String modified = thesaurus.getModified().toString();
        if (created != null) {
            conceptScheme.addDate(created, SKOSProperty.created);
        }
        if (modified != null) {
            conceptScheme.addDate(modified, SKOSProperty.modified);
        }
    }
    skosXmlDocument.setConceptScheme(conceptScheme);
}
Also used : SKOSResource(mom.trd.opentheso.skosapi.SKOSResource) Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang)

Example 2 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class ImportSkosHelper method addLangsToThesaurus.

private void addLangsToThesaurus(HikariDataSource ds, String idThesaurus) {
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    Thesaurus thesaurus2 = new Thesaurus();
    ArrayList<String> tabListLang = thesaurusHelper.getAllUsedLanguagesOfThesaurus(ds, idThesaurus);
    for (String tabListLang1 : tabListLang) {
        if (!thesaurusHelper.isLanguageExistOfThesaurus(ds, idThesaurus, tabListLang1)) {
            thesaurus2.setId_thesaurus(idThesaurus);
            thesaurus2.setContributor("");
            thesaurus2.setCoverage("");
            thesaurus2.setCreator("");
            thesaurus2.setDescription("");
            thesaurus2.setFormat("");
            thesaurus2.setLanguage(tabListLang1);
            thesaurus2.setPublisher("");
            thesaurus2.setRelation("");
            thesaurus2.setRights("");
            thesaurus2.setSource("");
            thesaurus2.setSubject("");
            thesaurus2.setTitle("theso_" + idThesaurus);
            thesaurus2.setType("");
            thesaurusHelper.addThesaurusTraduction(ds, thesaurus2);
        }
    }
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Example 3 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class WriteBranchSkosBDD method addLangsToThesaurus.

public void addLangsToThesaurus(HikariDataSource ds, String idThesaurus) {
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    ArrayList<String> tabListLang = thesaurusHelper.getAllUsedLanguagesOfThesaurus(ds, idThesaurus);
    for (int i = 0; i < tabListLang.size(); i++) {
        if (!thesaurusHelper.isLanguageExistOfThesaurus(ds, idThesaurus, tabListLang.get(i).trim())) {
            Thesaurus thesaurus = new Thesaurus();
            thesaurus.setId_thesaurus(idThesaurus);
            thesaurus.setContributor("");
            thesaurus.setCoverage("");
            thesaurus.setCreator("");
            thesaurus.setDescription("");
            thesaurus.setFormat("");
            thesaurus.setLanguage(tabListLang.get(i));
            thesaurus.setPublisher("");
            thesaurus.setRelation("");
            thesaurus.setRights("");
            thesaurus.setSource("");
            thesaurus.setSubject("");
            thesaurus.setTitle("");
            thesaurus.setType("");
            thesaurusHelper.addThesaurusTraduction(ds, thesaurus);
        }
    }
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Example 4 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class ExportTxtHelper method writeHeader.

/**
 * permet d'acrire le titre du thésaurus
 *
 * @return
 */
private void writeHeader(NodeThesaurus nodeThesaurus) {
    for (Thesaurus thesaurus : nodeThesaurus.getListThesaurusTraduction()) {
        if (thesaurus.getLanguage().equalsIgnoreCase(selectedLang)) {
            txtBuff.append(thesaurus.getTitle());
            txtBuff.append(" (");
            txtBuff.append(idTheso);
            txtBuff.append(" )");
        }
    }
    txtBuff.append("\n");
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)

Example 5 with Thesaurus

use of mom.trd.opentheso.bdd.datas.Thesaurus in project opentheso by miledrousset.

the class ImportTabuleIntoBDD method addLangsToThesaurus.

private void addLangsToThesaurus(HikariDataSource ds, String idThesaurus) {
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    ArrayList<String> tabListLang = thesaurusHelper.getAllUsedLanguagesOfThesaurus(ds, idThesaurus);
    for (String tabListLang1 : tabListLang) {
        if (!thesaurusHelper.isLanguageExistOfThesaurus(ds, idThesaurus, tabListLang1.trim())) {
            Thesaurus thesaurus = new Thesaurus();
            thesaurus.setId_thesaurus(idThesaurus);
            thesaurus.setContributor("");
            thesaurus.setCoverage("");
            thesaurus.setCreator("");
            thesaurus.setDescription("");
            thesaurus.setFormat("");
            thesaurus.setLanguage(tabListLang1);
            thesaurus.setPublisher("");
            thesaurus.setRelation("");
            thesaurus.setRights("");
            thesaurus.setSource("");
            thesaurus.setSubject("");
            thesaurus.setTitle("");
            thesaurus.setType("");
            thesaurusHelper.addThesaurusTraduction(ds, thesaurus);
        }
    }
}
Also used : Thesaurus(mom.trd.opentheso.bdd.datas.Thesaurus) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper)

Aggregations

Thesaurus (mom.trd.opentheso.bdd.datas.Thesaurus)19 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)10 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)6 Connection (java.sql.Connection)4 SQLException (java.sql.SQLException)3 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 UserHelper (mom.trd.opentheso.bdd.helper.UserHelper)2 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)2 Document (com.itextpdf.text.Document)1 Paragraph (com.itextpdf.text.Paragraph)1 PdfWriter (com.itextpdf.text.pdf.PdfWriter)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 FacesMessage (javax.faces.application.FacesMessage)1 Languages_iso639 (mom.trd.opentheso.bdd.datas.Languages_iso639)1 AccessThesaurusHelper (mom.trd.opentheso.bdd.helper.AccessThesaurusHelper)1