Search in sources :

Example 1 with NodeGps

use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.

the class ImportSkosHelper method addConcepts.

/**
 * récupération des concepts
 * @return
 */
public boolean addConcepts() {
    String uri;
    Value value;
    boolean isTopConcept = true;
    Concept concept = new Concept();
    ConceptHelper conceptHelper = new ConceptHelper();
    TermHelper termHelper = new TermHelper();
    NoteHelper noteHelper = new NoteHelper();
    Term term = new Term();
    AlignmentHelper alignmentHelper = new AlignmentHelper();
    // pour intégrer les coordonnées GPS
    NodeGps nodeGps = new NodeGps();
    GpsHelper gpsHelper = new GpsHelper();
    // ajout des termes et traductions
    NodeTerm nodeTerm = new NodeTerm();
    ArrayList<NodeTermTraduction> nodeTermTraductionList = new ArrayList<>();
    // Enregister les synonymes et traductions
    ArrayList<NodeEM> nodeEMList = new ArrayList<>();
    // ajout des notes
    ArrayList<NodeNote> nodeNotes = new ArrayList<>();
    // ajout des alignements
    ArrayList<NodeAlignment> nodeAlignments = new ArrayList<>();
    // ajout des relations
    ArrayList<HierarchicalRelationship> hierarchicalRelationships = new ArrayList<>();
    // ajout des relations Groups
    ArrayList<String> idGrps = new ArrayList<>();
    if (dataSet.getSKOSConcepts().isEmpty())
        return false;
    conceptsCount = dataSet.getSKOSConcepts().size();
    // i can get all the concepts from this scheme
    for (SKOSConcept skosConcept : dataSet.getSKOSConcepts()) {
        // URI du Concept récupération automatique de l'identifiant
        String id = getIdFromUri(skosConcept.getURI().toString());
        if (id == null || id.isEmpty()) {
            message = message + "identifiant null pour l'URI : " + skosConcept.getURI().toString();
            continue;
        } else {
            concept.setIdConcept(id);
        }
        concept.setIdThesaurus(thesaurus.getId_thesaurus());
        // concept.setIdGroup(idGroup.get(0));
        concept.setNotation("");
        // skos:notation
        /* if(anno.getURI().getFragment().equalsIgnoreCase("notation")) {
                            value = getValue(anno);
                            NodeTermTraduction nodeTermTraduction = new NodeTermTraduction();
                            nodeTermTraduction.setLexicalValue(value.getValue());
                            nodeTermTraduction.setLang(value.getLang());
                            nodeTermTraductionList.add(nodeTermTraduction);
                        }*/
        concept.setStatus("");
        concept.setIdArk(skosConcept.getURI().toString());
        for (SKOSAnnotation anno : skosConcept.getSKOSAnnotations(dataSet)) {
            // c'est une valeur
            if (anno.isAnnotationByConstant()) {
                // balises SKOS
                if (anno.getURI().getFragment() != null) {
                    // get notation
                    if (anno.getURI().getFragment().equalsIgnoreCase("notation")) {
                        value = getValue(anno);
                        concept.setNotation(value.getValue());
                    }
                    // get GPS : long and lat
                    if (anno.getURI().getFragment().equalsIgnoreCase("long")) {
                        value = getValue(anno);
                        nodeGps.setLongitude(Double.parseDouble(value.getValue()));
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("lat")) {
                        value = getValue(anno);
                        nodeGps.setLatitude(Double.parseDouble(value.getValue()));
                    }
                    // get altLabels
                    if (anno.getURI().getFragment().equalsIgnoreCase("prefLabel")) {
                        value = getValue(anno);
                        NodeTermTraduction nodeTermTraduction = new NodeTermTraduction();
                        nodeTermTraduction.setLexicalValue(value.getValue());
                        nodeTermTraduction.setLang(value.getLang());
                        nodeTermTraductionList.add(nodeTermTraduction);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("altLabel")) {
                        value = getValue(anno);
                        NodeEM nodeEM = new NodeEM();
                        nodeEM.setLexical_value(value.getValue());
                        nodeEM.setLang(value.getLang());
                        nodeEM.setSource("" + idUser);
                        nodeEM.setStatus("USE");
                        nodeEM.setHiden(false);
                        nodeEMList.add(nodeEM);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("hiddenLabel")) {
                        value = getValue(anno);
                        NodeEM nodeEM = new NodeEM();
                        nodeEM.setLexical_value(value.getValue());
                        nodeEM.setLang(value.getLang());
                        nodeEM.setSource("" + idUser);
                        nodeEM.setStatus("Hidden");
                        nodeEM.setHiden(true);
                        nodeEMList.add(nodeEM);
                    }
                    // get notes
                    if (anno.getURI().getFragment().equalsIgnoreCase("definition")) {
                        value = getValue(anno);
                        NodeNote nodeNote = new NodeNote();
                        nodeNote.setLang(value.getLang());
                        nodeNote.setLexicalvalue(value.getValue());
                        nodeNote.setNotetypecode("definition");
                        nodeNotes.add(nodeNote);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("note")) {
                        value = getValue(anno);
                        NodeNote nodeNote = new NodeNote();
                        nodeNote.setLang(value.getLang());
                        nodeNote.setLexicalvalue(value.getValue());
                        nodeNote.setNotetypecode("note");
                        nodeNotes.add(nodeNote);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("scopeNote")) {
                        value = getValue(anno);
                        NodeNote nodeNote = new NodeNote();
                        nodeNote.setLang(value.getLang());
                        nodeNote.setLexicalvalue(value.getValue());
                        nodeNote.setNotetypecode("scopeNote");
                        nodeNotes.add(nodeNote);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("editorialNote")) {
                        value = getValue(anno);
                        NodeNote nodeNote = new NodeNote();
                        nodeNote.setLang(value.getLang());
                        nodeNote.setLexicalvalue(value.getValue());
                        nodeNote.setNotetypecode("editorialNote");
                        nodeNotes.add(nodeNote);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("historyNote")) {
                        value = getValue(anno);
                        NodeNote nodeNote = new NodeNote();
                        nodeNote.setLang(value.getLang());
                        nodeNote.setLexicalvalue(value.getValue());
                        nodeNote.setNotetypecode("historyNote");
                        nodeNotes.add(nodeNote);
                    }
                } else // balises DublinCore dc
                {
                    uri = getIdFromUri(anno.getURI().toString());
                    if (uri.equalsIgnoreCase("created") || uri.equalsIgnoreCase("date")) {
                        concept = addDates(concept, formatDate, getValue(anno).getValue(), "created");
                    }
                    if (uri.equalsIgnoreCase("modified")) {
                        concept = addDates(concept, formatDate, getValue(anno).getValue(), "modified");
                    }
                    // get the identifier from dcterms ceci peut être aussi l'identifiant ark
                    if (uri.equalsIgnoreCase("identifier")) {
                        concept.setIdArk(getValue(anno).getValue());
                    }
                }
            } else // c'est une relation
            {
                // balises SKOS
                if (anno.getURI().getFragment() != null) {
                    // get relations hiérarchiques
                    if (anno.getURI().getFragment().equalsIgnoreCase("narrower")) {
                        uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
                        HierarchicalRelationship hierarchicalRelationship = new HierarchicalRelationship();
                        hierarchicalRelationship.setIdConcept1(concept.getIdConcept());
                        hierarchicalRelationship.setIdConcept2(uri);
                        hierarchicalRelationship.setIdThesaurus(thesaurus.getId_thesaurus());
                        hierarchicalRelationship.setRole("NT");
                        hierarchicalRelationships.add(hierarchicalRelationship);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("broader")) {
                        uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
                        HierarchicalRelationship hierarchicalRelationship = new HierarchicalRelationship();
                        hierarchicalRelationship.setIdConcept1(concept.getIdConcept());
                        hierarchicalRelationship.setIdConcept2(uri);
                        hierarchicalRelationship.setIdThesaurus(thesaurus.getId_thesaurus());
                        hierarchicalRelationship.setRole("BT");
                        hierarchicalRelationships.add(hierarchicalRelationship);
                        isTopConcept = false;
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("related")) {
                        uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
                        HierarchicalRelationship hierarchicalRelationship = new HierarchicalRelationship();
                        hierarchicalRelationship.setIdConcept1(concept.getIdConcept());
                        hierarchicalRelationship.setIdConcept2(uri);
                        hierarchicalRelationship.setIdThesaurus(thesaurus.getId_thesaurus());
                        hierarchicalRelationship.setRole("RT");
                        hierarchicalRelationships.add(hierarchicalRelationship);
                    }
                    // get scheme
                    if (anno.getURI().getFragment().equalsIgnoreCase("inScheme")) {
                    // uri = anno.getAnnotationValue().getURI().toString();
                    }
                    // get Groups
                    if (anno.getURI().getFragment().equalsIgnoreCase("memberOf")) {
                        uri = getIdFromUri(anno.getAnnotationValue().getURI().toString());
                        idGrps.add(uri);
                        addIdGroupToVector(uri);
                    }
                    // get Alignements
                    if (anno.getURI().getFragment().equalsIgnoreCase("closeMatch")) {
                        uri = anno.getAnnotationValue().getURI().toString();
                        NodeAlignment nodeAlignment = new NodeAlignment();
                        nodeAlignment.setId_author(idUser);
                        nodeAlignment.setConcept_target("");
                        nodeAlignment.setThesaurus_target("");
                        nodeAlignment.setUri_target(uri);
                        nodeAlignment.setInternal_id_concept(concept.getIdConcept());
                        nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
                        nodeAlignment.setAlignement_id_type(2);
                        nodeAlignments.add(nodeAlignment);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("exactMatch")) {
                        uri = anno.getAnnotationValue().getURI().toString();
                        NodeAlignment nodeAlignment = new NodeAlignment();
                        nodeAlignment.setId_author(idUser);
                        nodeAlignment.setConcept_target("");
                        nodeAlignment.setThesaurus_target("");
                        nodeAlignment.setUri_target(uri);
                        nodeAlignment.setInternal_id_concept(concept.getIdConcept());
                        nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
                        nodeAlignment.setAlignement_id_type(1);
                        nodeAlignments.add(nodeAlignment);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("broadMatch")) {
                        uri = anno.getAnnotationValue().getURI().toString();
                        NodeAlignment nodeAlignment = new NodeAlignment();
                        nodeAlignment.setId_author(idUser);
                        nodeAlignment.setConcept_target("");
                        nodeAlignment.setThesaurus_target("");
                        nodeAlignment.setUri_target(uri);
                        nodeAlignment.setInternal_id_concept(concept.getIdConcept());
                        nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
                        nodeAlignment.setAlignement_id_type(3);
                        nodeAlignments.add(nodeAlignment);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("narrowMatch")) {
                        uri = anno.getAnnotationValue().getURI().toString();
                        NodeAlignment nodeAlignment = new NodeAlignment();
                        nodeAlignment.setId_author(idUser);
                        nodeAlignment.setConcept_target("");
                        nodeAlignment.setThesaurus_target("");
                        nodeAlignment.setUri_target(uri);
                        nodeAlignment.setInternal_id_concept(concept.getIdConcept());
                        nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
                        nodeAlignment.setAlignement_id_type(5);
                        nodeAlignments.add(nodeAlignment);
                    }
                    if (anno.getURI().getFragment().equalsIgnoreCase("relatedMatch")) {
                        uri = anno.getAnnotationValue().getURI().toString();
                        NodeAlignment nodeAlignment = new NodeAlignment();
                        nodeAlignment.setId_author(idUser);
                        nodeAlignment.setConcept_target("");
                        nodeAlignment.setThesaurus_target("");
                        nodeAlignment.setUri_target(uri);
                        nodeAlignment.setInternal_id_concept(concept.getIdConcept());
                        nodeAlignment.setInternal_id_thesaurus(thesaurus.getId_thesaurus());
                        nodeAlignment.setAlignement_id_type(4);
                        nodeAlignments.add(nodeAlignment);
                    }
                }
            }
        }
        // ajout des termes et traductions
        nodeTerm.setNodeTermTraduction(nodeTermTraductionList);
        nodeTerm.setIdTerm(concept.getIdConcept());
        nodeTerm.setIdConcept(concept.getIdConcept());
        nodeTerm.setIdThesaurus(thesaurus.getId_thesaurus());
        nodeTerm.setSource("");
        nodeTerm.setStatus("");
        nodeTerm.setCreated(concept.getCreated());
        nodeTerm.setModified(concept.getModified());
        // conctrole si le concept est vide aucun prefLable, on l'ignore
        if (!isConceptEmpty(nodeTermTraductionList)) {
            if (idGrps.isEmpty()) {
                concept.setTopConcept(isTopConcept);
                concept.setIdGroup(idGroupDefault);
                conceptHelper.insertConceptInTable(ds, concept, idUser);
            } else {
                for (String idGrp : idGrps) {
                    concept.setTopConcept(isTopConcept);
                    concept.setIdGroup(idGrp);
                    conceptHelper.insertConceptInTable(ds, concept, idUser);
                }
            }
            termHelper.insertTerm(ds, nodeTerm, idUser);
            try {
                Connection conn = ds.getConnection();
                conn.setAutoCommit(false);
                for (HierarchicalRelationship hierarchicalRelationship : hierarchicalRelationships) {
                    conceptHelper.addLinkHierarchicalRelation(conn, hierarchicalRelationship, idUser);
                }
                conn.commit();
                conn.close();
            } catch (SQLException ex) {
            }
            for (NodeNote nodeNoteList1 : nodeNotes) {
                if (nodeNoteList1.getNotetypecode().contains("scopeNote")) {
                    noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
                }
                if (nodeNoteList1.getNotetypecode().contains("historyNote")) {
                    noteHelper.addConceptNote(ds, concept.getIdConcept(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
                }
                if (nodeNoteList1.getNotetypecode().contains("definition")) {
                    noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
                }
                if (nodeNoteList1.getNotetypecode().contains("editorialNote")) {
                    noteHelper.addTermNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
                }
                if (nodeNoteList1.getNotetypecode().contains("note")) {
                    noteHelper.addConceptNote(ds, nodeTerm.getIdTerm(), nodeNoteList1.getLang(), thesaurus.getId_thesaurus(), nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
                }
            }
            for (NodeAlignment nodeAlignment : nodeAlignments) {
                alignmentHelper.addNewAlignment(ds, nodeAlignment);
            }
            for (NodeEM nodeEMList1 : nodeEMList) {
                term.setId_concept(concept.getIdConcept());
                term.setId_term(nodeTerm.getIdTerm());
                term.setLexical_value(nodeEMList1.getLexical_value());
                term.setLang(nodeEMList1.getLang());
                term.setId_thesaurus(thesaurus.getId_thesaurus());
                term.setSource(nodeEMList1.getSource());
                term.setStatus(nodeEMList1.getStatus());
                termHelper.addNonPreferredTerm(ds, term, idUser);
            }
            if (nodeGps.getLatitude() != 0.0) {
                if (nodeGps.getLongitude() != 0.0) {
                    // insertion des données GPS
                    gpsHelper.insertCoordonees(ds, concept.getIdConcept(), thesaurus.getId_thesaurus(), nodeGps.getLatitude(), nodeGps.getLongitude());
                }
            }
        }
        // initialisation des variables
        concept = new Concept();
        term = new Term();
        nodeTerm = new NodeTerm();
        nodeTermTraductionList = new ArrayList<>();
        nodeEMList = new ArrayList<>();
        nodeNotes = new ArrayList<>();
        nodeAlignments = new ArrayList<>();
        hierarchicalRelationships = new ArrayList<>();
        idGrps = new ArrayList<>();
        isTopConcept = true;
        nodeGps = new NodeGps();
    }
    for (String idTopConcept1 : idTopConcept) {
        if (!conceptHelper.setTopConcept(ds, idTopConcept1, thesaurus.getId_thesaurus())) {
        // erreur;
        }
    }
    addGroups();
    addLangsToThesaurus(ds, thesaurus.getId_thesaurus());
    message = message + "\n nombre de Concepts importés : " + conceptsCount;
    return true;
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) TermHelper(mom.trd.opentheso.bdd.helper.TermHelper) SKOSConcept(org.semanticweb.skos.SKOSConcept) Concept(mom.trd.opentheso.bdd.datas.Concept) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NodeTerm(mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm) NodeGps(mom.trd.opentheso.bdd.helper.nodes.NodeGps) Connection(java.sql.Connection) NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) Term(mom.trd.opentheso.bdd.datas.Term) NodeTerm(mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm) NodeTermTraduction(mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction) SKOSAnnotation(org.semanticweb.skos.SKOSAnnotation) NodeEM(mom.trd.opentheso.bdd.helper.nodes.NodeEM) NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) HierarchicalRelationship(mom.trd.opentheso.bdd.datas.HierarchicalRelationship) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote) SKOSConcept(org.semanticweb.skos.SKOSConcept)

Example 2 with NodeGps

use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.

the class ImportRdf4jHelper method finalizeAddConceptStruct.

private void finalizeAddConceptStruct(AddConceptsStruct acs) throws SQLException {
    acs.termHelper.insertTerm(ds, acs.nodeTerm, idUser);
    RelationsHelper relationsHelper = new RelationsHelper();
    for (HierarchicalRelationship hierarchicalRelationship : acs.hierarchicalRelationships) {
        if (!relationsHelper.insertHierarchicalRelation(ds, hierarchicalRelationship.getIdConcept1(), hierarchicalRelationship.getIdThesaurus(), hierarchicalRelationship.getRole(), hierarchicalRelationship.getIdConcept2())) {
            // System.out.println("Erreur sur la relation = " + acs.concept.getIdConcept() + " ## " + hierarchicalRelationship.getRole());
            message.append(System.getProperty("line.separator"));
            message.append("Erreur sur la relation = ");
            message.append(acs.concept.getIdConcept());
            message.append(" ## ");
            message.append(hierarchicalRelationship.getRole());
        }
    }
    // For Term : definition; editorialNote; historyNote;
    for (NodeNote nodeNoteList1 : acs.nodeNotes) {
        if (nodeNoteList1.getNotetypecode().equals("customnote") || nodeNoteList1.getNotetypecode().equals("scopeNote") || nodeNoteList1.getNotetypecode().equals("historyNote") || nodeNoteList1.getNotetypecode().equals("note")) {
            acs.noteHelper.addConceptNote(ds, acs.concept.getIdConcept(), nodeNoteList1.getLang(), idTheso, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
        }
        if (nodeNoteList1.getNotetypecode().equals("definition") || nodeNoteList1.getNotetypecode().equals("editorialNote")) {
            acs.noteHelper.addTermNote(ds, acs.nodeTerm.getIdTerm(), nodeNoteList1.getLang(), idTheso, nodeNoteList1.getLexicalvalue(), nodeNoteList1.getNotetypecode(), idUser);
        }
    }
    for (NodeAlignment nodeAlignment : acs.nodeAlignments) {
        acs.alignmentHelper.addNewAlignment(ds, nodeAlignment);
    }
    for (NodeEM nodeEMList1 : acs.nodeEMList) {
        acs.term.setId_concept(acs.concept.getIdConcept());
        acs.term.setId_term(acs.nodeTerm.getIdTerm());
        acs.term.setLexical_value(nodeEMList1.getLexical_value());
        acs.term.setLang(nodeEMList1.getLang());
        acs.term.setId_thesaurus(thesaurus.getId_thesaurus());
        acs.term.setSource(nodeEMList1.getSource());
        acs.term.setStatus(nodeEMList1.getStatus());
        acs.termHelper.addNonPreferredTerm(ds, acs.term, idUser);
    }
    if (acs.nodeGps.getLatitude() != null && acs.nodeGps.getLongitude() != null) {
        // insertion des données GPS
        acs.gpsHelper.insertCoordonees(ds, acs.concept.getIdConcept(), thesaurus.getId_thesaurus(), acs.nodeGps.getLatitude(), acs.nodeGps.getLongitude());
    }
    for (String idTopConcept1 : idTopConcept) {
        if (!acs.conceptHelper.setTopConcept(ds, idTopConcept1, thesaurus.getId_thesaurus())) {
        // erreur;
        }
    }
    // initialisation des variables
    acs.concept = new Concept();
    acs.nodeTerm = new NodeTerm();
    acs.nodeTermTraductionList = new ArrayList<>();
    acs.nodeEMList = new ArrayList<>();
    acs.nodeNotes = new ArrayList<>();
    acs.nodeAlignments = new ArrayList<>();
    acs.hierarchicalRelationships = new ArrayList<>();
    acs.idGrps = new ArrayList<>();
    acs.isTopConcept = false;
    acs.nodeGps = new NodeGps();
}
Also used : Concept(mom.trd.opentheso.bdd.datas.Concept) NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) NodeTerm(mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm) HierarchicalRelationship(mom.trd.opentheso.bdd.datas.HierarchicalRelationship) NodeGps(mom.trd.opentheso.bdd.helper.nodes.NodeGps) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote) RelationsHelper(mom.trd.opentheso.bdd.helper.RelationsHelper) NodeEM(mom.trd.opentheso.bdd.helper.nodes.NodeEM)

Example 3 with NodeGps

use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.

the class ConceptHelper method getConceptForExport.

/**
 * Cette fonction permet de récupérer toutes les informations concernant un
 * Concept par son id et son thésaurus et la langue On récupère aussi les
 * IdArk si Ark est actif
 *
 * @param ds
 * @param idConcept
 * @param idThesaurus
 * @param isArkActive
 * @return Objet class NodeConcept
 */
public NodeConceptExport getConceptForExport(HikariDataSource ds, String idConcept, String idThesaurus, boolean isArkActive) {
    NodeConceptExport nodeConceptExport = new NodeConceptExport();
    // récupération des BT
    RelationsHelper relationsHelper = new RelationsHelper();
    ArrayList<NodeHieraRelation> nodeListOfBT_Ark = relationsHelper.getListBT(ds, idConcept, idThesaurus);
    nodeConceptExport.setNodeListOfBT(nodeListOfBT_Ark);
    // récupération du Concept
    Concept concept = getThisConcept(ds, idConcept, idThesaurus);
    /**
     * Attention si on passe par le null, ca veut dire qu'il y a une
     * incohérence dans la base à corriger !!!!!
     */
    if (concept == null) {
        return null;
    }
    nodeConceptExport.setConcept(concept);
    AlignmentHelper alignmentHelper = new AlignmentHelper();
    ArrayList<NodeAlignment> nodeAlignmentList = alignmentHelper.getAllAlignmentOfConcept(ds, idConcept, idThesaurus);
    nodeConceptExport.setNodeAlignmentsList(nodeAlignmentList);
    // récupération des termes spécifiques
    ArrayList<NodeHieraRelation> nodeListIdsOfNT_Ark = relationsHelper.getListNT(ds, idConcept, idThesaurus);
    nodeConceptExport.setNodeListOfNT(nodeListIdsOfNT_Ark);
    // récupération des termes associés
    ArrayList<NodeHieraRelation> nodeListIdsOfRT_Ark = relationsHelper.getListRT(ds, idConcept, idThesaurus);
    nodeConceptExport.setNodeListIdsOfRT(nodeListIdsOfRT_Ark);
    // récupération des Non Prefered Term
    nodeConceptExport.setNodeEM(new TermHelper().getAllNonPreferredTerms(ds, new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus), idThesaurus));
    // récupération des traductions
    nodeConceptExport.setNodeTermTraductions(new TermHelper().getAllTraductionsOfConcept(ds, idConcept, idThesaurus));
    // récupération des Groupes ou domaines
    ArrayList<NodeUri> nodeListIdsOfConceptGroup_Ark = getListIdArkOfGroup(ds, new GroupHelper().getListIdGroupOfConcept(ds, idThesaurus, idConcept), idThesaurus);
    nodeConceptExport.setNodeListIdsOfConceptGroup(nodeListIdsOfConceptGroup_Ark);
    // récupération des notes du Terme
    String idTerm = new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus);
    nodeConceptExport.setNodeNoteTerm(new NoteHelper().getListNotesTermAllLang(ds, idTerm, idThesaurus));
    // récupération des Notes du Concept
    nodeConceptExport.setNodeNoteConcept(new NoteHelper().getListNotesConceptAllLang(ds, idConcept, idThesaurus));
    // récupération des coordonnées GPS
    GpsHelper gpsHelper = new GpsHelper();
    NodeGps nodeGps = gpsHelper.getCoordinate(ds, idConcept, idThesaurus);
    if (nodeGps != null) {
        nodeConceptExport.setNodeGps(nodeGps);
    }
    return nodeConceptExport;
}
Also used : NodeConcept(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConcept) Concept(mom.trd.opentheso.bdd.datas.Concept) NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) NodeGps(mom.trd.opentheso.bdd.helper.nodes.NodeGps) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) NodeAlignment(mom.trd.opentheso.bdd.helper.nodes.NodeAlignment) NodeHieraRelation(mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation)

Example 4 with NodeGps

use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.

the class SelectedTerme method updateGps.

public void updateGps() {
    GpsBeans gps = new GpsBeans();
    coordonnees = new NodeGps();
    GpsHelper gpsHelper = new GpsHelper();
    coordonnees = gpsHelper.getCoordinate(connect.getPoolConnexion(), idC, idTheso);
    if (coordonnees == null) {
        latitudLongitud = null;
        gps.latitud = 0.0;
        gps.longitud = 0.0;
        return;
    }
    gps.latitud = coordonnees.getLatitude();
    gps.longitud = coordonnees.getLongitude();
    gps.reinitBoolean();
    latitudLongitud = "" + coordonnees.getLatitude() + "," + coordonnees.getLongitude();
}
Also used : GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) NodeGps(mom.trd.opentheso.bdd.helper.nodes.NodeGps)

Example 5 with NodeGps

use of mom.trd.opentheso.bdd.helper.nodes.NodeGps in project opentheso by miledrousset.

the class GpsBeans method getCoordinatesGps.

/**
 * récupère les coordonées de la BDD
 *
 * @param idConcept
 * @param idTheso
 * @return
 */
public boolean getCoordinatesGps(String idConcept, String idTheso) {
    GpsHelper gpshelper = new GpsHelper();
    NodeGps nodeGps = gpshelper.getCoordinate(connect.getPoolConnexion(), idConcept, idTheso);
    if (nodeGps != null) {
        latitud = nodeGps.getLatitude();
        longitud = nodeGps.getLongitude();
    } else {
        initcoordonees();
    }
    return true;
}
Also used : GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) NodeGps(mom.trd.opentheso.bdd.helper.nodes.NodeGps)

Aggregations

NodeGps (mom.trd.opentheso.bdd.helper.nodes.NodeGps)6 Concept (mom.trd.opentheso.bdd.datas.Concept)3 GpsHelper (mom.trd.opentheso.bdd.helper.GpsHelper)3 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)3 Connection (java.sql.Connection)2 SQLException (java.sql.SQLException)2 HierarchicalRelationship (mom.trd.opentheso.bdd.datas.HierarchicalRelationship)2 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)2 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)2 NodeTerm (mom.trd.opentheso.bdd.helper.nodes.term.NodeTerm)2 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 ArrayList (java.util.ArrayList)1 Term (mom.trd.opentheso.bdd.datas.Term)1 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)1 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)1 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)1 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)1 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)1 NodeHieraRelation (mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation)1