Search in sources :

Example 6 with NodeConceptExport

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

the class ExportFromBDD method exportConcept.

/**
 * Fonction permettant d'exporter Un concept
 *
 * @param ds
 * @param idThesaurus
 * @param idConcept
 * @return  Le Skos en String
 */
public StringBuffer exportConcept(HikariDataSource ds, String idThesaurus, String idConcept) {
    WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.setNodePreference(nodePreference);
    writeFileSKOS.writeHeader();
    ConceptHelper conceptHelper = new ConceptHelper();
    NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
    if (nodeConcept == null)
        return null;
    writeFileSKOS.writeDescriptor(nodeConcept, null);
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper)

Example 7 with NodeConceptExport

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

the class ExportFromBDD method exportMultiConcept.

/**
 * Fonction permettant d'exporter un concept ou plusieurs concepts suivant la valeur
 *
 * @param ds
 * @param idThesaurus
 * @param value
 * @param lang
 * @return  Le Skos en String
 */
public StringBuffer exportMultiConcept(HikariDataSource ds, String idThesaurus, String value, String lang) {
    WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
    writeFileSKOS.writeHeader();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.setNodePreference(nodePreference);
    ConceptHelper conceptHelper = new ConceptHelper();
    ArrayList<NodeConceptExport> listNodeConcept = conceptHelper.getMultiConceptForExport(ds, value, idThesaurus, lang, isArkActive);
    for (NodeConceptExport nodeConcept : listNodeConcept) {
        writeFileSKOS.writeDescriptor(nodeConcept, null);
    }
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper)

Example 8 with NodeConceptExport

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

the class ConceptHelper method getMultiConceptForExport.

/**
 * Cette fonction permet de récupérer toutes les informations concernant un
 * ou plusieurs Concept par une chaîne de caractère, suivant le thésaurus,
 * la langue et le group
 *
 * @param ds
 * @param value
 * @param idThesaurus
 * @param idGroup
 * @param idLang
 * @param isArkActif
 * @return Objet class NodeConcept
 */
public ArrayList<NodeConceptExport> getMultiConceptForExport(HikariDataSource ds, String value, String idLang, String idGroup, String idThesaurus, boolean isArkActif) {
    ArrayList<NodeConceptExport> listNce = new ArrayList<>();
    // Récupération des concept
    ArrayList<NodeSearch> listRes = new SearchHelper().searchTerm(ds, value, idLang, idThesaurus, idGroup, 1, false);
    for (NodeSearch ns : listRes) {
        Concept concept = getThisConcept(ds, ns.getIdConcept(), idThesaurus);
        NodeConceptExport nce = new NodeConceptExport();
        nce.setConcept(concept);
        listNce.add(nce);
    }
    for (NodeConceptExport nce : listNce) {
        String idConcept = nce.getConcept().getIdConcept();
        RelationsHelper relationsHelper = new RelationsHelper();
        // récupération des BT
        ArrayList<NodeHieraRelation> nodeListIdOfBT_Ark = relationsHelper.getListBT(ds, idConcept, idThesaurus);
        nce.setNodeListOfBT(nodeListIdOfBT_Ark);
        // récupération des termes spécifiques
        ArrayList<NodeHieraRelation> nodeListIdOfNT_Ark = relationsHelper.getListNT(ds, idConcept, idThesaurus);
        nce.setNodeListOfNT(nodeListIdOfNT_Ark);
        // récupération des termes associés
        ArrayList<NodeHieraRelation> nodeListIdOfRT_Ark = relationsHelper.getListRT(ds, idConcept, idThesaurus);
        nce.setNodeListIdsOfRT(nodeListIdOfRT_Ark);
        // récupération des Non Prefered Term
        nce.setNodeEM(new TermHelper().getAllNonPreferredTerms(ds, new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus), idThesaurus));
        // récupération des traductions
        nce.setNodeTermTraductions(new TermHelper().getAllTraductionsOfConcept(ds, idConcept, idThesaurus));
        // récupération des Groupes
        ArrayList<NodeUri> nodeListIdsOfConceptGroup_Ark = getListIdArkOfGroup(ds, new GroupHelper().getListIdGroupOfConcept(ds, idThesaurus, idConcept), idThesaurus);
        nce.setNodeListIdsOfConceptGroup(nodeListIdsOfConceptGroup_Ark);
        // récupération des notes du Terme
        String idTerm = new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus);
        nce.setNodeNoteTerm(new NoteHelper().getListNotesTermAllLang(ds, idTerm, idThesaurus));
        // récupération des Notes du Concept
        nce.setNodeNoteConcept(new NoteHelper().getListNotesConceptAllLang(ds, idConcept, idThesaurus));
        // récupération des Alignements
        nce.setNodeAlignmentsList(new AlignmentHelper().getAllAlignmentOfConcept(ds, idConcept, idThesaurus));
    }
    return listNce;
}
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) ArrayList(java.util.ArrayList) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) NodeHieraRelation(mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation) NodeSearch(mom.trd.opentheso.bdd.helper.nodes.search.NodeSearch)

Example 9 with NodeConceptExport

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

the class ExportRdf4jHelper method writeConceptInfo.

private void writeConceptInfo(ConceptHelper conceptHelper, SKOSResource sKOSResource, String idThesaurus, String idOfConceptChildren, DownloadBean downloadBean, List<NodeLang> selectedLanguages) {
    NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idOfConceptChildren, idThesaurus, false);
    if (nodeConcept == null) {
        return;
    }
    sKOSResource.setUri(getUri(nodeConcept));
    sKOSResource.setProperty(SKOSProperty.Concept);
    // prefLabel
    for (NodeTermTraduction traduction : nodeConcept.getNodeTermTraductions()) {
        boolean isInselectedLanguages = false;
        for (NodeLang nodeLang : selectedLanguages) {
            if (nodeLang.getCode().equals(traduction.getLang())) {
                isInselectedLanguages = true;
                break;
            }
        }
        if (isInselectedLanguages) {
            sKOSResource.addLabel(traduction.getLexicalValue(), traduction.getLang(), SKOSProperty.prefLabel);
        }
    }
    // altLabel
    for (NodeEM nodeEM : nodeConcept.getNodeEM()) {
        boolean isInselectedLanguages = false;
        for (NodeLang nodeLang : selectedLanguages) {
            if (nodeLang.getCode().equals(nodeEM.getLang())) {
                isInselectedLanguages = true;
                break;
            }
        }
        if (isInselectedLanguages) {
            sKOSResource.addLabel(nodeEM.getLexical_value(), nodeEM.getLang(), SKOSProperty.altLabel);
        }
    }
    ArrayList<NodeNote> nodeNotes = nodeConcept.getNodeNoteConcept();
    nodeNotes.addAll(nodeConcept.getNodeNoteTerm());
    addNoteGiven(nodeNotes, sKOSResource, selectedLanguages);
    addGPSGiven(nodeConcept.getNodeGps(), sKOSResource);
    addAlignementGiven(nodeConcept.getNodeAlignmentsList(), sKOSResource);
    addRelationGiven(nodeConcept.getNodeListOfBT(), nodeConcept.getNodeListOfNT(), nodeConcept.getNodeListIdsOfRT(), sKOSResource, nodeConcept.getConcept().getIdThesaurus());
    String notation = nodeConcept.getConcept().getNotation();
    String created = nodeConcept.getConcept().getCreated().toString();
    String modified = nodeConcept.getConcept().getModified().toString();
    if (notation != null && !notation.equals("null")) {
        sKOSResource.addNotation(notation);
    }
    if (created != null) {
        sKOSResource.addDate(created, SKOSProperty.created);
    }
    if (modified != null) {
        sKOSResource.addDate(modified, SKOSProperty.modified);
    }
    sKOSResource.addRelation(getUriFromId(idTheso), SKOSProperty.inScheme);
    sKOSResource.addIdentifier(nodeConcept.getConcept().getIdConcept(), SKOSProperty.identifier);
    downloadBean.setProgress_abs(downloadBean.getProgress_abs() + 1);
    double progress = (downloadBean.getProgress_abs() / downloadBean.getSizeOfTheso()) * 100;
    if (progress > 100) {
        progress = 100;
    }
    downloadBean.setProgress_per_100((int) progress);
    skosXmlDocument.addconcept(sKOSResource);
}
Also used : NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) NodeTermTraduction(mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction) NodeNote(mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote) NodeEM(mom.trd.opentheso.bdd.helper.nodes.NodeEM)

Example 10 with NodeConceptExport

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

the class ExportFromBDD method exportAllConceptsAdvanced.

/**
 * focntion récursive pour récupérer la branche des
 * @param ds
 * @param idArk
 * @param idThesaurus
 * @param writeFileSKOS
 */
/*    private void exportAllConceptsArk(HikariDataSource ds,
            String idArk, String idThesaurus,
            WriteFileSKOS writeFileSKOS) {

        ConceptHelper conceptHelper = new ConceptHelper();
        
        ArrayList <String> listIdsOfConceptChildren = conceptHelper.getListChildrenOfConcept(ds, idConcept, idThesaurus);
        
        NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
      
        /// attention il y a un problème ici, il faut vérifier pourquoi nous avons un Concept Null
        
       
        
        
        if(nodeConcept.getConcept() == null) {
            int k = 0;
            return;
        }
        
        
        
        
        
        writeFileSKOS.writeDescriptor(nodeConcept, null);

        for (String listIdsOfConceptChildren1 : listIdsOfConceptChildren) {
            nodeConcept = conceptHelper.getConceptForExport(ds, listIdsOfConceptChildren1, idThesaurus, isArkActive);
            if(nodeConcept != null) {
                writeFileSKOS.writeDescriptor(nodeConcept, null);
                if (!nodeConcept.getNodeListIdsOfNT().isEmpty()) {
                    for (int j = 0; j < nodeConcept.getNodeListIdsOfNT().size(); j++) {

                        exportAllConcepts(ds,
                                nodeConcept.getNodeListIdsOfNT().get(j).getIdConcept(),
                                idThesaurus, writeFileSKOS);

                    }
                }
            }
        }
    }    */
public void exportAllConceptsAdvanced(HikariDataSource ds, String idConcept, String idThesaurus, WriteFileSKOS writeFileSKOS, List<NodeLang> selectedLanguages) {
    ConceptHelper conceptHelper = new ConceptHelper();
    ArrayList<String> listIdsOfConceptChildren = conceptHelper.getListChildrenOfConcept(ds, idConcept, idThesaurus);
    NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
    if (nodeConcept.getConcept() == null) {
        int k = 0;
        return;
    }
    writeFileSKOS.writeDescriptor(nodeConcept, selectedLanguages);
    incrementProgressBar();
    for (String listIdsOfConceptChildren1 : listIdsOfConceptChildren) {
        nodeConcept = conceptHelper.getConceptForExport(ds, listIdsOfConceptChildren1, idThesaurus, isArkActive);
        if (nodeConcept != null) {
            writeFileSKOS.writeDescriptor(nodeConcept, selectedLanguages);
            incrementProgressBar();
            if (!nodeConcept.getNodeListOfNT().isEmpty()) {
                for (int j = 0; j < nodeConcept.getNodeListOfNT().size(); j++) {
                    exportAllConceptsAdvanced(ds, nodeConcept.getNodeListOfNT().get(j).getUri().getIdConcept(), idThesaurus, writeFileSKOS, selectedLanguages);
                }
            }
        }
    }
}
Also used : NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper)

Aggregations

NodeConceptExport (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport)15 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)9 NodeEM (mom.trd.opentheso.bdd.helper.nodes.NodeEM)4 NodeNote (mom.trd.opentheso.bdd.helper.nodes.notes.NodeNote)4 NodeTermTraduction (mom.trd.opentheso.bdd.helper.nodes.term.NodeTermTraduction)4 NodeHieraRelation (mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation)3 NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)3 ArrayList (java.util.ArrayList)2 Concept (mom.trd.opentheso.bdd.datas.Concept)2 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)2 NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)2 NodeConcept (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConcept)2 NodeGps (mom.trd.opentheso.bdd.helper.nodes.NodeGps)1 NodeSearch (mom.trd.opentheso.bdd.helper.nodes.search.NodeSearch)1 SKOSResource (mom.trd.opentheso.skosapi.SKOSResource)1