Search in sources :

Example 6 with ThesaurusHelper

use of mom.trd.opentheso.bdd.helper.ThesaurusHelper 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 7 with ThesaurusHelper

use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.

the class ExportTxtHelper method exportToTxtCsv.

/**
 * permet de préparer le thésaurus au format tabulé. Les données sont
 * écrites dans des variables type StringBuffer suivant les options
 * sélectionnées dans le tableau String[] selectedOptions
 *
 * @return
 */
public boolean exportToTxtCsv() {
    txtBuff = new StringBuffer();
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    NodeThesaurus nodeThesaurus = thesaurusHelper.getNodeThesaurus(ds, idTheso);
    if (nodeThesaurus == null) {
        return false;
    }
    // on écrit le label du thésaurus
    // writeHeader(nodeThesaurus);
    // écriture des groupes
    GroupHelper groupHelper = new GroupHelper();
    NodeGroup nodeGroup;
    for (NodeGroup selectedGroup : selectedGroups) {
        nodeGroup = groupHelper.getThisConceptGroup(ds, selectedGroup.getConceptGroup().getIdgroup(), idTheso, selectedLang);
        // writeGroup(nodeGroup);
        // écriture récursive des concepts
        writeConcepts(nodeGroup.getConceptGroup().getIdgroup());
    }
    return true;
}
Also used : ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 8 with ThesaurusHelper

use of mom.trd.opentheso.bdd.helper.ThesaurusHelper 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)

Example 9 with ThesaurusHelper

use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.

the class ExportFromBDD_Frantiq method exportThesaurus.

/**
 * Fonction récursive permettant d'exporter le thésaurus de la tête jusqu'au
 * dernier descripteur
 *
 * @param ds
 * @param idThesaurus
 * @return
 */
public StringBuffer exportThesaurus(HikariDataSource ds, String idThesaurus) {
    /*
         * Ecriture du thésaurus
         */
    ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
    NodeThesaurus nodeThesaurus = thesaurusHelper.getNodeThesaurus(ds, idThesaurus);
    WriteFileSKOS_Frantiq writeFileSKOS = new WriteFileSKOS_Frantiq();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.writeHeader();
    String idArk = thesaurusHelper.getIdArkOfThesaurus(ds, idThesaurus);
    if (idArk == null || idArk.trim().isEmpty()) {
        writeFileSKOS.setURI(serverAdress);
    } else {
        writeFileSKOS.setURI(serverArk);
    }
    // writeFileSKOS.setURI("http://opentheso.frantiq.fr/" + nodeThesaurus.getListThesaurusTraduction().get(0).getTitle());
    // thesaurus.description);
    writeFileSKOS.writeThesaurus(nodeThesaurus);
    // ecriture des TopConcept
    GroupHelper conceptGroupHelper = new GroupHelper();
    ArrayList<String> tabIdGroup = conceptGroupHelper.getListIdOfGroup(ds, idThesaurus);
    for (String tabIdGroup1 : tabIdGroup) {
        writeFileSKOS.writeTopConcepts(tabIdGroup1);
    }
    writeFileSKOS.writeEndOfMicroThesaurusList();
    // fin du bloc thésaurus et id of TopConcept
    // écriture des Domaines et Descripteurs avec traductions
    ArrayList<NodeUri> idOfTopConcept;
    for (String tabIdGroup1 : tabIdGroup) {
        NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, tabIdGroup1, idThesaurus);
        idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, tabIdGroup1, idThesaurus);
        writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept);
    }
    for (String tabIdGroup1 : tabIdGroup) {
        idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, tabIdGroup1, idThesaurus);
        for (NodeUri idOfTopConcept1 : idOfTopConcept) {
            exportAllConcepts(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS);
        }
    }
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) NodeGroupLabel(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 10 with ThesaurusHelper

use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.

the class SelectedThesaurus method changeTermeTrad.

/**
 * Met à jour le thésaurus courant, l'arbre et le terme courant lors de la
 * sélection de la traduction d'un terme dans le gestionnaire de thésaurus
 *
 * @param id
 * @param l
 * @param type
 */
public void changeTermeTrad(String id, String l, int type) {
    MyTreeNode mTN = new MyTreeNode(type, id, tree.getSelectedTerme().getIdTheso(), l, tree.getSelectedTerme().getIdDomaine(), tree.getSelectedTerme().getTypeDomaine(), tree.getSelectedTerme().getIdTopConcept(), null, null, null);
    tree.getSelectedTerme().majTerme(mTN);
    thesaurus = new ThesaurusHelper().getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), l);
    // tree.reInit();
    tree.reExpand();
    vue.setOnglet(0);
}
Also used : ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) MyTreeNode(mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)

Aggregations

ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)31 Thesaurus (mom.trd.opentheso.bdd.datas.Thesaurus)10 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)9 FacesMessage (javax.faces.application.FacesMessage)7 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)7 UserHelper (mom.trd.opentheso.bdd.helper.UserHelper)6 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)6 Connection (java.sql.Connection)5 SQLException (java.sql.SQLException)5 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)4 LanguageHelper (mom.trd.opentheso.bdd.helper.LanguageHelper)3 NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)3 NodeGroupLabel (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel)3 FacesContext (javax.faces.context.FacesContext)2 BaseDeDoneesHelper (mom.trd.opentheso.bdd.helper.BaseDeDoneesHelper)2 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)2 NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)2 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)2 Concept (mom.trd.opentheso.bdd.datas.Concept)1 DcElement (mom.trd.opentheso.bdd.datas.DcElement)1