use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.
the class SelectedTerme method majTerme.
/**
* *************************************** MISE A JOUR
* ****************************************
*/
/**
* Met à jour le terme à la sélection d'un node de l'arbre (traitement
* différent si Domaine/TopConcept/Concept)
*
* @param sN
*/
public void majTerme(MyTreeNode sN) {
// contrôler si la connexion est toujour valide
// connect.
selectedNode = sN;
reInitTerme();
majPref();
idC = sN.getIdConcept();
idTheso = sN.getIdTheso();
idlangue = sN.getLangue();
idDomaine = sN.getIdCurrentGroup();
idTopConcept = sN.getIdTopConcept();
type = sN.getTypeConcept();
status = "";
notation = "";
latitudLongitud = null;
totalConceptOfBranch = "";
totalNoticesOfBranch = "";
majTAsso();
GroupHelper groupHelper = new GroupHelper();
ConceptHelper conceptHelper = new ConceptHelper();
if (groupHelper.isIdOfGroup(connect.getPoolConnexion(), idC, idTheso)) {
microTheso = new GroupHelper().getLexicalValueOfGroup(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
NodeGroup ncg = new GroupHelper().getThisConceptGroup(connect.getPoolConnexion(), idC, idTheso, idlangue);
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
nom = ncg.getLexicalValue();
idArk = ncg.getConceptGroup().getIdARk();
nomEdit = nom;
idT = "";
if (ncg.getCreated() != null && ncg.getModified() != null) {
dateC = dateFormat.format(ncg.getCreated());
dateM = dateFormat.format(ncg.getModified());
}
majGroupTGen();
majLangueGroup();
majTSpeGroup();
majNotes();
} else {
Concept concept = conceptHelper.getThisConcept(connect.getPoolConnexion(), idC, idTheso);
if (concept == null) {
return;
}
status = concept.getStatus();
notation = concept.getNotation();
if (!idDomaine.equals("Orphan")) {
majGroup();
majTGen();
} else {
microTheso = idDomaine;
}
Term t = new TermHelper().getThisTerm(connect.getPoolConnexion(), idC, idTheso, idlangue);
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
nom = t.getLexical_value();
nomEdit = nom;
idT = t.getId_term();
dateC = dateFormat.format(t.getCreated());
dateM = dateFormat.format(t.getModified());
creator = t.getCreator();
contributor = t.getContributor();
images = new ImagesHelper().getImage(connect.getPoolConnexion(), idC, idTheso, user.getUser().getId());
majNotes();
majLangueConcept();
majSyno();
updateGps();
majTSpeConcept();
align = new AlignmentHelper().getAllAlignmentOfConcept(connect.getPoolConnexion(), idC, idTheso);
// ResourceBundle bundlePref = getBundlePref();
if (user.getNodePreference().isZ3950actif()) {
majNoticeZ3950();
}
if (user.getNodePreference().isBddActive()) {
majNoticeBdd();
}
idArk = conceptHelper.getIdArkOfConcept(connect.getPoolConnexion(), idC, idTheso);
idHandle = conceptHelper.getIdHandleOfConcept(connect.getPoolConnexion(), idC, idTheso);
reInitFacette();
initTree();
}
}
use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup in project opentheso by miledrousset.
the class ExportRdf4jHelper method addGroup.
/*
private void addSelectedGroupRecursif(){
}*/
public void addGroup(String idThesaurus, List<NodeLang> selectedLanguages, List<NodeGroup> selectedGroups) {
rootGroupList = new GroupHelper().getListIdOfRootGroup(ds, idTheso);
for (String idGroup : rootGroupList) {
boolean isInselectedGroups = false;
for (NodeGroup nodeGroup : selectedGroups) {
if (nodeGroup.getConceptGroup().getIdgroup().equals(idGroup)) {
isInselectedGroups = true;
break;
}
}
if (!isInselectedGroups) {
continue;
}
SKOSResource group = new SKOSResource(getUriFromId(idGroup), SKOSProperty.ConceptGroup);
group.addRelation(getUriFromId(idThesaurus), SKOSProperty.microThesaurusOf);
addFilsGroupRcursif(idThesaurus, idGroup, group, selectedLanguages);
}
}
use of mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup 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.nodes.group.NodeGroup in project opentheso by miledrousset.
the class BackgroundTimeJob method synchroSparql.
private Runnable synchroSparql(int key) {
SynchroSparql run = new SynchroSparql();
run.setSparqlStruct(this.SparqlSyn.get(key));
ArrayList<Languages_iso639> listeLang = new LanguageHelper().getLanguagesOfThesaurus(this.connect.getPoolConnexion(), this.SparqlSyn.get(key).getThesaurus());
ArrayList<NodeLang> nol = new ArrayList<>();
for (Languages_iso639 lang : listeLang) {
NodeLang nd = new NodeLang();
nd.setValue(lang.getId_iso639_1());
nd.setCode(lang.getId_iso639_1());
nol.add(nd);
}
run.setListe_lang(nol);
ArrayList<String> nog = new GroupHelper().getListIdOfGroup(this.connect.getPoolConnexion(), this.SparqlSyn.get(key).getThesaurus());
ArrayList<NodeGroup> groupes = new ArrayList<>();
for (String group : nog) {
NodeGroup ng1 = new NodeGroup();
ng1.setId_group(group);
ConceptGroup cg = new ConceptGroup();
cg.setIdgroup(group);
ng1.setConceptGroup(cg);
groupes.add(ng1);
}
run.setListe_group(groupes);
run.setConn(this.connect);
return run;
}
Aggregations