use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class WriteSkosBDD method writeDomaine.
public void writeDomaine(SKOSResource resource, String id_thesaurus, String id_langueSource, String adressSite, boolean useArk, int idUser) {
GroupHelper conceptGroupHelper = new GroupHelper();
String idConceptGroup = getId(resource.getUri());
conceptGroupHelper.insertGroup(ds, idConceptGroup, id_thesaurus, "D", "", adressSite, useArk, idUser);
// ajouter les traductions des Groupes
ConceptGroupLabel conceptGroupLabel = new ConceptGroupLabel();
for (int i = 0; i < resource.getLabelsList().size(); i++) {
conceptGroupLabel.setIdgroup(idConceptGroup);
conceptGroupLabel.setIdthesaurus(id_thesaurus);
conceptGroupLabel.setLang(resource.getLabelsList().get(i).getLanguage());
conceptGroupLabel.setLexicalvalue(resource.getLabelsList().get(i).getLabel());
conceptGroupHelper.addGroupTraduction(ds, conceptGroupLabel, idUser);
}
ArrayList<SKOSRelation> relationsList = resource.getRelationsList();
for (SKOSRelation relation : relationsList) {
switch(relation.getProperty()) {
// ici on a les identifiants des TopConcepts
case SKOSProperty.narrower:
idsTopConcept.add(getId(relation.getTargetUri()));
break;
default:
break;
}
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper 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.GroupHelper in project opentheso by miledrousset.
the class ImportRdf4jHelper method addConcepts.
public void addConcepts(rdf4jFileBean fileBean) throws SQLException, ParseException {
AddConceptsStruct acs = new AddConceptsStruct();
acs.conceptHelper = new ConceptHelper();
for (SKOSResource conceptResource : skosXmlDocument.getConceptList()) {
fileBean.setAbs_progress(fileBean.getAbs_progress() + 1);
fileBean.setProgress(fileBean.getAbs_progress() / fileBean.getTotal() * 100);
initAddConceptsStruct(acs, conceptResource);
addRelation(acs);
// envoie du concept à la BDD
if (!isConceptEmpty(acs.nodeTermTraductionList)) {
if (acs.idGrps.isEmpty()) {
acs.concept.setTopConcept(acs.isTopConcept);
acs.concept.setIdGroup(idGroupDefault);
acs.conceptHelper.insertConceptInTable(ds, acs.concept, idUser);
new GroupHelper().addConceptGroupConcept(ds, idGroupDefault, acs.concept.getIdConcept(), acs.concept.getIdThesaurus());
defaultGroupToAdd = true;
} else {
for (String idGrp : acs.idGrps) {
acs.concept.setTopConcept(acs.isTopConcept);
acs.concept.setIdGroup(idGrp);
if (!acs.conceptHelper.insertConceptInTable(ds, acs.concept, idUser)) {
System.out.println("Erreur sur le Concept = " + acs.concept.getIdConcept());
}
}
}
finalizeAddConceptStruct(acs);
}
}
addLangsToThesaurus(ds, idTheso);
addGroupDefault();
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ImportRdf4jHelper method getNewGroupId.
private String getNewGroupId() {
GroupHelper groupHelper = new GroupHelper();
ToolsHelper toolsHelper = new ToolsHelper();
String id = toolsHelper.getNewId(10);
while (groupHelper.isIdOfGroup(ds, id, thesaurus.getId_thesaurus())) {
id = toolsHelper.getNewId(10);
}
return id;
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ImportTabuleIntoBDD method insertGroup.
private boolean insertGroup(HikariDataSource ds, TabulateDocument tabulateDocument, String idThesaurus, int idUser) {
GroupHelper conceptGroupHelper = new GroupHelper();
if (!conceptGroupHelper.insertGroup(ds, tabulateDocument.getId(), idThesaurus, tabulateDocument.getType(), "", "", false, idUser)) {
return false;
}
// ajouter les traductions des Groupes
ConceptGroupLabel conceptGroupLabel = new ConceptGroupLabel();
for (Label prefLabel : tabulateDocument.getPrefLabels()) {
conceptGroupLabel.setIdgroup(tabulateDocument.getId());
conceptGroupLabel.setIdthesaurus(idThesaurus);
conceptGroupLabel.setLang(prefLabel.getLang());
conceptGroupLabel.setLexicalvalue(prefLabel.getLabel());
conceptGroupHelper.addGroupTraduction(ds, conceptGroupLabel, idUser);
}
return true;
}
Aggregations