Search in sources :

Example 6 with GroupHelper

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;
        }
    }
}
Also used : ConceptGroupLabel(mom.trd.opentheso.bdd.datas.ConceptGroupLabel) SKOSRelation(skos.SKOSRelation) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 7 with GroupHelper

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

Example 8 with GroupHelper

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

Example 9 with GroupHelper

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;
}
Also used : ToolsHelper(mom.trd.opentheso.bdd.helper.ToolsHelper) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 10 with GroupHelper

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;
}
Also used : ConceptGroupLabel(mom.trd.opentheso.bdd.datas.ConceptGroupLabel) Label(mom.trd.opentheso.core.exports.tabulate.Label) ConceptGroupLabel(mom.trd.opentheso.bdd.datas.ConceptGroupLabel) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Aggregations

GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)79 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)38 ArrayList (java.util.ArrayList)22 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)18 SQLException (java.sql.SQLException)16 Connection (java.sql.Connection)14 FacesMessage (javax.faces.application.FacesMessage)13 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)9 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)9 ConceptGroupLabel (mom.trd.opentheso.bdd.datas.ConceptGroupLabel)8 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)8 NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)8 NodeGroupLabel (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel)8 PrefixString (com.k_int.IR.QueryModels.PrefixString)7 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)6 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)6 HashMap (java.util.HashMap)5 Concept (mom.trd.opentheso.bdd.datas.Concept)5 OrphanHelper (mom.trd.opentheso.bdd.helper.OrphanHelper)5 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)5