Search in sources :

Example 1 with SKOSNotation

use of mom.trd.opentheso.skosapi.SKOSNotation 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);*/
}
Also used : SKOSResource(mom.trd.opentheso.skosapi.SKOSResource) ConceptGroupLabel(mom.trd.opentheso.bdd.datas.ConceptGroupLabel) SKOSRelation(mom.trd.opentheso.skosapi.SKOSRelation) SKOSLabel(mom.trd.opentheso.skosapi.SKOSLabel) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) SKOSNotation(mom.trd.opentheso.skosapi.SKOSNotation)

Aggregations

ConceptGroupLabel (mom.trd.opentheso.bdd.datas.ConceptGroupLabel)1 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)1 SKOSLabel (mom.trd.opentheso.skosapi.SKOSLabel)1 SKOSNotation (mom.trd.opentheso.skosapi.SKOSNotation)1 SKOSRelation (mom.trd.opentheso.skosapi.SKOSRelation)1 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)1