use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ExportRdf4jHelper method addFilsGroupRcursif.
private void addFilsGroupRcursif(String idThesaurus, String idPere, SKOSResource sKOSResource, List<NodeLang> selectedLanguages) {
GroupHelper groupHelper = new GroupHelper();
ArrayList<String> listIdsOfGroupChildren = groupHelper.getListGroupChildIdOfGroup(ds, idPere, idThesaurus);
writeGroupInfo(sKOSResource, idThesaurus, idPere, selectedLanguages);
for (String idOfGroupChildren : listIdsOfGroupChildren) {
sKOSResource = new SKOSResource();
// writeGroupInfo(groupHelper, group, idThesaurus, idOfGroupChildren, selectedLanguages);
// if (!groupHelper.getListGroupChildIdOfGroup(ds, idOfGroupChildren, idThesaurus).isEmpty()) {
addFilsGroupRcursif(idThesaurus, idOfGroupChildren, sKOSResource, selectedLanguages);
// }
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ThesaurusDatas method exportAllDatas.
/**
* permet de récupérer toutes les données d'un thésaurus
* puis les chargées dans les variables de la classe
*
* @param ds
* @param idThesaurus
* @return
*/
public boolean exportAllDatas(HikariDataSource ds, String idThesaurus) {
// récupération du thésaurus
this.nodeThesaurus = new ThesaurusHelper().getNodeThesaurus(ds, idThesaurus);
// récupération des groupes
ArrayList<String> idGroups = new GroupHelper().getListIdOfGroup(ds, idThesaurus);
for (String idGroup : idGroups) {
this.nodeGroupLabels.add(new GroupHelper().getNodeGroupLabel(ds, idGroup, idThesaurus));
// System.out.println("idGroup = : " + idGroup);
}
// récupération des ids des Tops Concepts
nodeTTs = new ConceptHelper().getAllListIdsOfTopConcepts(ds, idThesaurus);
// récupération de tous les concepts
for (NodeTT nodeTT1 : nodeTTs) {
new ConceptHelper().exportAllConcepts(ds, nodeTT1.getIdConcept(), idThesaurus, nodeConceptExports);
}
return true;
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ImportRdf4jHelper method addBranch.
/**
* ajoute une brache en choisissant un concept père
*
* @param selectedTerme
* @throws java.text.ParseException
* @throws java.sql.SQLException
*/
public void addBranch(SelectedTerme selectedTerme) throws ParseException, SQLException {
String idGroup = selectedTerme.getIdDomaine();
String idConceptPere = selectedTerme.getIdC();
idTheso = selectedTerme.getIdTheso();
SKOSResource root = detectRootOfBranch();
// on ajoute la racine de la branche
AddConceptsStruct acs;
acs = new AddConceptsStruct();
acs.conceptHelper = new ConceptHelper();
initAddConceptsStruct(acs, root);
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);
// on ajoute le reste
skosXmlDocument.getConceptList().remove(root);
for (SKOSResource resource : skosXmlDocument.getConceptList()) {
acs = new AddConceptsStruct();
acs.conceptHelper = new ConceptHelper();
initAddConceptsStruct(acs, resource);
addRelation(acs);
acs.concept.setTopConcept(false);
acs.concept.setIdGroup(idGroup);
acs.conceptHelper.insertConceptInTable(ds, acs.concept, idUser);
new GroupHelper().addConceptGroupConcept(ds, idGroup, acs.concept.getIdConcept(), acs.concept.getIdThesaurus());
finalizeAddConceptStruct(acs);
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ImportRdf4jHelper method addGroups.
public void addGroups(rdf4jFileBean fileBean) {
// récupération des groups ou domaine
GroupHelper groupHelper = new GroupHelper();
String idGroup;
for (SKOSResource group : skosXmlDocument.getGroupList()) {
fileBean.setAbs_progress(fileBean.getAbs_progress() + 1);
fileBean.setProgress(fileBean.getAbs_progress() / fileBean.getTotal() * 100);
idGroup = getIdFromUri(group.getUri());
ArrayList<SKOSNotation> notationList = group.getNotationList();
SKOSNotation notation = null;
if (notationList != null && !notationList.isEmpty()) {
notation = notationList.get(0);
}
String notationValue;
if (notation == null) {
notationValue = "";
} else {
notationValue = notation.getNotation();
}
String type;
switch(group.getProperty()) {
case SKOSProperty.Collection:
type = "C";
break;
case SKOSProperty.ConceptGroup:
type = "G";
break;
case SKOSProperty.MicroThesaurus:
default:
type = "MT";
break;
case SKOSProperty.Theme:
type = "T";
break;
}
groupHelper.insertGroup(ds, idGroup, thesaurus.getId_thesaurus(), type, notationValue, adressSite, useArk, idUser);
// sub group
String idSubGroup;
// concept group concept
String idSubConcept;
for (SKOSRelation relation : group.getRelationsList()) {
int prop = relation.getProperty();
switch(prop) {
case SKOSProperty.subGroup:
idSubGroup = getIdFromUri(relation.getTargetUri());
groupHelper.addSubGroup(ds, idGroup, idSubGroup, thesaurus.getId_thesaurus());
break;
case SKOSProperty.member:
// option cochée
/* if(identifierType.equalsIgnoreCase("sans")){
idSubConcept = getIdFromUri(relation.getTargetUri());
} else {*/
// Récupération de l'Id d'origine sauvegardé à l'import (idArk -> identifier)
idSubConcept = getOriginalId(relation.getTargetUri());
// }
groupHelper.addConceptGroupConcept(ds, idGroup, idSubConcept, thesaurus.getId_thesaurus());
memberHashMap.put(relation.getTargetUri(), idGroup);
break;
case SKOSProperty.hasTopConcept:
hasTopConcceptList.add(relation.getTargetUri());
break;
default:
break;
}
}
for (SKOSLabel label : group.getLabelsList()) {
// ajouter les traductions des Groupes
ConceptGroupLabel conceptGroupLabel = new ConceptGroupLabel();
conceptGroupLabel.setIdgroup(idGroup);
conceptGroupLabel.setIdthesaurus(thesaurus.getId_thesaurus());
conceptGroupLabel.setLang(label.getLanguage());
conceptGroupLabel.setLexicalvalue(label.getLabel());
groupHelper.addGroupTraduction(ds, conceptGroupLabel, idUser);
}
}
/*
groupHelper.insertGroup(ds,
idGroupDefault,
thesaurus.getId_thesaurus(),
"MT",
"", //notation
adressSite,
useArk,
idUser);
*/
// Création du domaine par défaut
// ajouter les traductions des Groupes
/*ConceptGroupLabel conceptGroupLabel = new ConceptGroupLabel();
conceptGroupLabel.setIdgroup(idGroupDefault);
conceptGroupLabel.setIdthesaurus(thesaurus.getId_thesaurus());
conceptGroupLabel.setLang(langueSource);
conceptGroupLabel.setLexicalvalue("groupDefault");
groupHelper.addGroupTraduction(ds, conceptGroupLabel, idUser);*/
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class ImportRdf4jHelper method addGroupDefault.
/**
* Permet d'ajouter le Groupe par défaut pour les concepts qui sont orphelins
* @return
*/
private void addGroupDefault() {
if (defaultGroupToAdd) {
GroupHelper groupHelper = new GroupHelper();
groupHelper.insertGroup(ds, idGroupDefault, thesaurus.getId_thesaurus(), "MT", // notation
"", adressSite, useArk, idUser);
// Création du domaine par défaut
// ajouter les traductions des Groupes
ConceptGroupLabel conceptGroupLabel = new ConceptGroupLabel();
conceptGroupLabel.setIdgroup(idGroupDefault);
conceptGroupLabel.setIdthesaurus(thesaurus.getId_thesaurus());
conceptGroupLabel.setLang(langueSource);
conceptGroupLabel.setLexicalvalue("groupDefault");
groupHelper.addGroupTraduction(ds, conceptGroupLabel, idUser);
}
}
Aggregations