use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.
the class ExportFromBDD 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 writeFileSKOS = new WriteFileSKOS();
// 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, idThesaurus);
}
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, null);
}
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();
}
Aggregations