use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ImportRdf4jHelper method addSingleConcept.
/**
* ajoute un seul concept en choisissant un concept père
*
* @param selectedTerme
* @throws java.sql.SQLException
* @throws java.text.ParseException
*/
public void addSingleConcept(SelectedTerme selectedTerme) throws SQLException, ParseException {
String idGroup = selectedTerme.getIdDomaine();
String idConceptPere = selectedTerme.getIdC();
idTheso = selectedTerme.getIdTheso();
AddConceptsStruct acs = new AddConceptsStruct();
acs.conceptHelper = new ConceptHelper();
// addConcepts
if (skosXmlDocument.getConceptList().size() == 1) {
initAddConceptsStruct(acs, skosXmlDocument.getConceptList().get(0));
addRelationNoBTHiera(acs);
acs.concept.setTopConcept(false);
acs.concept.setIdGroup(idGroup);
acs.conceptHelper.insertConceptInTable(ds, acs.concept, idUser);
// on lie le nouveau concept au concept père
HierarchicalRelationship hierarchicalRelationship1 = new HierarchicalRelationship(acs.concept.getIdConcept(), idConceptPere, idTheso, "BT");
HierarchicalRelationship hierarchicalRelationship2 = new HierarchicalRelationship(idConceptPere, acs.concept.getIdConcept(), idTheso, "NT");
acs.hierarchicalRelationships.add(hierarchicalRelationship1);
acs.hierarchicalRelationships.add(hierarchicalRelationship2);
new GroupHelper().addConceptGroupConcept(ds, idGroup, acs.concept.getIdConcept(), acs.concept.getIdThesaurus());
finalizeAddConceptStruct(acs);
} else {
// erreur il y a plus d'un concept
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ExportThesaurus method exportAltLabel.
public StringBuilder exportAltLabel(HikariDataSource ds, String idTheso, String idLang) {
GroupHelper groupHelper = new GroupHelper();
WriteAltLabel writeAltLabel = new WriteAltLabel();
String GroupLabel;
// getAllBottomGroup(ds, idTheso);
ArrayList<String> GroupLists = groupHelper.getListIdOfGroup(ds, idTheso);
if (GroupLists == null)
return null;
if (GroupLists.isEmpty())
return new StringBuilder("");
for (String GroupList : GroupLists) {
GroupLabel = groupHelper.getLexicalValueOfGroup(ds, GroupList, idTheso, idLang);
writeAltLabel.setGroup(GroupList, GroupLabel);
writeAltLabel.setHeader();
writeAltLabel.AddAltLabelByGroup(ds, idTheso, GroupList, idLang);
}
return writeAltLabel.getAllAltLabels();
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ExportTxtHelper method countIndentation.
/**
* permet de compter le nombre de décalalge pour chaque type de données
* concept : pour l'hiérarchie NT : pour le nombre maxi de NT existant dans
* le thésaurus ou le domaine choisi RT ... UF ....
*
* @param idConcept
* @param indentation
*/
private void countIndentation(String idConcept, String indentation) {
ArrayList<NodeNT> childList = new RelationsHelper().getListNT(ds, idConcept, idTheso, selectedLang);
if (childList == null) {
return;
}
// indentation des concepts par hiérarchie
indentation += "\t";
int tot = StringUtils.countMatches(indentation, "\t");
if (tot > indentationConcept) {
indentationConcept = tot;
}
// indentation des NT nombre maxi
if (selectedOptions.contains("nt")) {
int totNT = new RelationsHelper().getCountOfNT(ds, idConcept, idTheso);
if (totNT > indentationNT) {
indentationNT = totNT;
}
}
// indentation des BT nombre maxi
if (selectedOptions.contains("bt")) {
int totBT = new RelationsHelper().getCountOfBT(ds, idConcept, idTheso);
if (totBT > indentationBT) {
indentationBT = totBT;
}
}
// indentation des RT nombre maxi
if (selectedOptions.contains("rt")) {
int totRT = new RelationsHelper().getCountOfRT(ds, idConcept, idTheso);
if (totRT > indentationRT) {
indentationRT = totRT;
}
}
// indentation des UF nombre maxi
if (selectedOptions.contains("uf")) {
int totUF = new RelationsHelper().getCountOfUF(ds, idConcept, idTheso, selectedLang);
if (totUF > indentationUF) {
indentationUF = totUF;
}
}
// indentation des Groups nombre maxi
if (selectedOptions.contains("groups")) {
int totGroup = new GroupHelper().getCountOfGroups(ds, idConcept, idTheso);
if (totGroup > indentationGroups) {
indentationGroups = totGroup;
}
}
// indentation traductions
if (selectedOptions.contains("traductions")) {
int totTraductions = new TermHelper().getCountOfTraductions(ds, idConcept, idTheso, selectedLang);
if (totTraductions > indentationTraductions) {
indentationTraductions = totTraductions;
}
}
// indentation notes
if (selectedOptions.contains("notes")) {
int totNotes = new NoteHelper().getCountOfNotes(ds, idConcept, idTheso, selectedLang);
if (totNotes > indentationNotes) {
indentationNotes = totNotes;
}
}
for (NodeNT nodeNT : childList) {
countIndentation(nodeNT.getIdConcept(), indentation);
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ExportFromBDD method exportThesaurusAdvanced.
/**
* Fonction récursive permettant d'exporter le thésaurus de la tête jusqu'au
* dernier descripteur en filtrant par langues et domaines choisis
*
* @param ds
* @param idThesaurus
* @param selectedLanguages
* @param selectedGroups
* @param downloadBean
* @return
*/
public StringBuffer exportThesaurusAdvanced(HikariDataSource ds, String idThesaurus, List<NodeLang> selectedLanguages, List<NodeGroup> selectedGroups, DownloadBean downloadBean) {
/*
* Ecriture du thésaurus
*/
this.downloadBean = downloadBean;
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) {
for (NodeGroup nodeGroup : selectedGroups) {
if (nodeGroup.getConceptGroup().getIdgroup().equalsIgnoreCase(tabIdGroup1)) {
NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, tabIdGroup1, idThesaurus);
idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, tabIdGroup1, idThesaurus);
writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept, selectedLanguages);
}
}
}
for (String tabIdGroup1 : tabIdGroup) {
for (NodeGroup nodeGroup : selectedGroups) {
if (nodeGroup.getConceptGroup().getIdgroup().equalsIgnoreCase(tabIdGroup1)) {
idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, tabIdGroup1, idThesaurus);
for (NodeUri idOfTopConcept1 : idOfTopConcept) {
exportAllConceptsAdvanced(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS, selectedLanguages);
}
}
}
}
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ExportFromBDD method exportGroupsOfThesaurus.
/**
* Fonction récursive permettant d'exporter le thésaurus de la tête jusqu'au
* dernier descripteur
*
* @param ds
* @param idThesaurus
* @return
*/
public StringBuffer exportGroupsOfThesaurus(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);
}
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