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);
}
}
}
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;
}
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);
}
}
}
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();
}
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);
}
Aggregations