Search in sources :

Example 26 with NodeGroup

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();
    }
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) ImagesHelper(mom.trd.opentheso.bdd.helper.ImagesHelper) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) Term(mom.trd.opentheso.bdd.datas.Term) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) SimpleDateFormat(java.text.SimpleDateFormat) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper)

Example 27 with NodeGroup

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);
    }
}
Also used : SKOSResource(mom.trd.opentheso.skosapi.SKOSResource) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 28 with NodeGroup

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();
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) ThesaurusHelper(mom.trd.opentheso.bdd.helper.ThesaurusHelper) NodeGroupLabel(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel) NodeThesaurus(mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 29 with NodeGroup

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;
}
Also used : LanguageHelper(mom.trd.opentheso.bdd.helper.LanguageHelper) ArrayList(java.util.ArrayList) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) ConceptGroup(mom.trd.opentheso.bdd.datas.ConceptGroup) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) Languages_iso639(mom.trd.opentheso.bdd.datas.Languages_iso639) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Aggregations

NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)29 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)18 ArrayList (java.util.ArrayList)8 Connection (java.sql.Connection)7 PreparedStatement (java.sql.PreparedStatement)7 ResultSet (java.sql.ResultSet)7 SQLException (java.sql.SQLException)7 Statement (java.sql.Statement)7 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)5 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)4 ConceptGroup (mom.trd.opentheso.bdd.datas.ConceptGroup)3 StatisticHelper (mom.trd.opentheso.bdd.helper.StatisticHelper)2 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)2 NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)2 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)2 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)2 TreeNode (org.primefaces.model.TreeNode)2 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 FacesMessage (javax.faces.application.FacesMessage)1