Search in sources :

Example 11 with NodeConceptExport

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

the class ExportFromBDD method exportConceptByLot.

/**
 * Fonction permettant d'exporter un lot de concepts d'un tableau
 * ceci permet de construire un export ascendant
 *
 * @param ds
 * @param idThesaurus
 * @param idConcepts
 * @return  Le Skos en String
 */
public StringBuffer exportConceptByLot(HikariDataSource ds, String idThesaurus, ArrayList<ArrayList<String>> idConcepts) {
    if (idConcepts == null)
        return null;
    if (idConcepts.isEmpty())
        return null;
    WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.setNodePreference(nodePreference);
    writeFileSKOS.writeHeader();
    ConceptHelper conceptHelper = new ConceptHelper();
    for (ArrayList<String> tabIdConcept : idConcepts) {
        for (String idConcept : tabIdConcept) {
            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 12 with NodeConceptExport

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

the class ExportFromBDD method exportAllConcepts.

/**
 * Fonction permet d'exporter une branche complète d'un thésaurus
 * en partant de n'importe quel identifiant ARK
 * @param ds
 * @param idConcept
 * @param idThesaurus
 * @param writeFileSKOS
 * @param idArk
 * @return
 */
/*    public StringBuffer exportBranchOfConceptArk(HikariDataSource ds, String idThesaurus, String idArk) {
        
        WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
        
        // inititialisation des URI
        writeFileSKOS.setServerArk(serverArk);
        writeFileSKOS.setServerAdress(serverAdress);
        
        writeFileSKOS.writeHeader();
        NodeUri nodeUri = new NodeUri();
        nodeUri.setIdConcept(idArk);
        exportAllConcepts(ds, nodeUri.getIdConcept(), idThesaurus, writeFileSKOS);
        writeFileSKOS.endSkos(); 
        return writeFileSKOS.getSkosBuff();
    }    
  */
/**
 * @param ds
 * @param idConcept
 * @param idThesaurus
 * @param writeFileSKOS
 */
private void exportAllConcepts(HikariDataSource ds, String idConcept, String idThesaurus, WriteFileSKOS writeFileSKOS) {
    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, null);
    for (String listIdsOfConceptChildren1 : listIdsOfConceptChildren) {
        nodeConcept = conceptHelper.getConceptForExport(ds, listIdsOfConceptChildren1, idThesaurus, isArkActive);
        if (nodeConcept != null) {
            writeFileSKOS.writeDescriptor(nodeConcept, null);
            if (!nodeConcept.getNodeListOfNT().isEmpty()) {
                for (int j = 0; j < nodeConcept.getNodeListOfNT().size(); j++) {
                    exportAllConcepts(ds, nodeConcept.getNodeListOfNT().get(j).getUri().getIdConcept(), idThesaurus, writeFileSKOS);
                }
            }
        }
    }
}
Also used : NodeConceptExport(mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper)

Example 13 with NodeConceptExport

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

the class ExportFromBDD_Frantiq 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.writeHeader();
    ConceptHelper conceptHelper = new ConceptHelper();
    NodeConceptExport nodeConcept = conceptHelper.getConceptForExport(ds, idConcept, idThesaurus, isArkActive);
    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 14 with NodeConceptExport

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

the class ExportFromBDD_Frantiq method exportMultiConcept.

/**
 * Fonction permettant d'exporter un concept ou plusieurs concepts
 *
 * @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);
    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 15 with NodeConceptExport

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

the class ExportFromBDD_Frantiq method exportAllConcepts.

public void exportAllConcepts(HikariDataSource ds, String idConcept, String idThesaurus, WriteFileSKOS_Frantiq writeFileSKOS) {
    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);
    for (String listIdsOfConceptChildren1 : listIdsOfConceptChildren) {
        nodeConcept = conceptHelper.getConceptForExport(ds, listIdsOfConceptChildren1, idThesaurus, isArkActive);
        writeFileSKOS.writeDescriptor(nodeConcept);
        if (!nodeConcept.getNodeListOfNT().isEmpty()) {
            for (int j = 0; j < nodeConcept.getNodeListOfNT().size(); j++) {
                exportAllConcepts(ds, nodeConcept.getNodeListOfNT().get(j).getUri().getIdConcept(), idThesaurus, writeFileSKOS);
            }
        }
    }
}
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