Search in sources :

Example 16 with NodeUri

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

the class ExportFromBDD method exportGroup.

/**
 * Fonction récursive permettant d'exporter le Groupe de la tête jusqu'au
 * dernier descripteur
 *
 * @param ds
 * @param idThesaurus
 * @param idGroup
 * @return
 */
public StringBuffer exportGroup(HikariDataSource ds, String idThesaurus, String idGroup) {
    WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.setNodePreference(nodePreference);
    writeFileSKOS.writeHeader();
    // ecriture des TopConcept
    GroupHelper conceptGroupHelper = new GroupHelper();
    // écriture des Domaines et Descripteurs avec traductions
    NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, idGroup, idThesaurus);
    ArrayList<NodeUri> idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, idGroup, idThesaurus);
    writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept, null);
    // écriture des TopConcepts
    for (NodeUri idOfTopConcept1 : idOfTopConcept) {
        exportAllConcepts(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS);
    }
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NodeGroupLabel(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 17 with NodeUri

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

the class ExportFromBDD method exportThisGroup.

/**
 * Fonction permettant d'exporter un noeud Groupe (un seul identifiant group)
 *
 * @param ds
 * @param idThesaurus
 * @param idGroup
 * @return  Skos
 */
public StringBuffer exportThisGroup(HikariDataSource ds, String idThesaurus, String idGroup) {
    WriteFileSKOS writeFileSKOS = new WriteFileSKOS();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.writeHeader();
    // ecriture des TopConcept
    GroupHelper conceptGroupHelper = new GroupHelper();
    // écriture des Domaines et Descripteurs avec traductions
    NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, idGroup, idThesaurus);
    nodeGroupLabel.setIdArk(new GroupHelper().getIdArkOfGroup(ds, idGroup, idThesaurus));
    ArrayList<NodeUri> idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, idGroup, idThesaurus);
    writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept, null);
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NodeGroupLabel(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 18 with NodeUri

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

the class ExportFromBDD_Frantiq method exportGroup.

/**
 * Fonction récursive permettant d'exporter le Groupe de la tête jusqu'au
 * dernier descripteur
 *
 * @param ds
 * @param idThesaurus
 * @param idGroup
 * @return
 */
public StringBuffer exportGroup(HikariDataSource ds, String idThesaurus, String idGroup) {
    WriteFileSKOS_Frantiq writeFileSKOS = new WriteFileSKOS_Frantiq();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.writeHeader();
    // ecriture des TopConcept
    GroupHelper conceptGroupHelper = new GroupHelper();
    // écriture des Domaines et Descripteurs avec traductions
    NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, idGroup, idThesaurus);
    ArrayList<NodeUri> idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, idGroup, idThesaurus);
    writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept);
    // écriture des TopConcepts
    for (NodeUri idOfTopConcept1 : idOfTopConcept) {
        exportAllConcepts(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS);
    }
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NodeGroupLabel(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 19 with NodeUri

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

the class ExportFromBDD_Frantiq method exportBranchOfConcept.

/**
 * Fonction permet d'exporter une branche complète d'un thésaurus
 * en partant de n'importe quel concept, mais pas d'un Domaine
 * @param ds
 * @param idConcept
 * @param idThesaurus
 * @return
 */
public StringBuffer exportBranchOfConcept(HikariDataSource ds, String idThesaurus, String idConcept) {
    WriteFileSKOS_Frantiq writeFileSKOS = new WriteFileSKOS_Frantiq();
    // inititialisation des URI
    writeFileSKOS.setServerArk(serverArk);
    writeFileSKOS.setServerAdress(serverAdress);
    writeFileSKOS.writeHeader();
    NodeUri nodeUri = new NodeUri();
    nodeUri.setIdConcept(idConcept);
    exportAllConcepts(ds, nodeUri.getIdConcept(), idThesaurus, writeFileSKOS);
    writeFileSKOS.endSkos();
    return writeFileSKOS.getSkosBuff();
}
Also used : NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri)

Example 20 with NodeUri

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

the class WriteFileSKOS method writeGroup.

/**
 * @param nodeGroupLabel
 * @param listIdOfTopConcept
 * @param selectedLanguages
 *
 * @return true ou false
 */
public boolean writeGroup(NodeGroupLabel nodeGroupLabel, ArrayList<NodeUri> listIdOfTopConcept, List<NodeLang> selectedLanguages) {
    SKOSResource concept;
    if (nodeGroupLabel.getIdArk() == null || nodeGroupLabel.getIdArk().trim().isEmpty()) {
        /*
            Cette partie est pour l'export des PACTOLS pour Frantiq
             */
        // concept = new SKOSResource(serverAdress + "#" + nodeGroupLabel.getIdGroup());
        concept = new SKOSResource(serverAdress + "?idg=" + nodeGroupLabel.getIdGroup() + "&amp;idt=" + nodeGroupLabel.getIdThesaurus());
    } else {
        concept = new SKOSResource(serverArk + nodeGroupLabel.getIdArk());
    }
    for (int i = 0; i < nodeGroupLabel.getNodeGroupTraductionses().size(); i++) {
        if (selectedLanguages != null) {
            // nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang().equalsIgnoreCase("fr"))
            for (NodeLang selectedLanguage : selectedLanguages) {
                if (nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang().equalsIgnoreCase(selectedLanguage.getCode())) {
                    concept.addLabel(nodeGroupLabel.getNodeGroupTraductionses().get(i).getTitle(), nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang(), SKOSProperty.prefLabel);
                }
            }
        } else {
            concept.addLabel(nodeGroupLabel.getNodeGroupTraductionses().get(i).getTitle(), nodeGroupLabel.getNodeGroupTraductionses().get(i).getIdLang(), SKOSProperty.prefLabel);
        }
    }
    if (!nodeGroupLabel.getNodeGroupTraductionses().isEmpty()) {
        concept.addDate(nodeGroupLabel.getNodeGroupTraductionses().get(0).getCreated().toString(), SKOSProperty.created);
        concept.addDate(nodeGroupLabel.getNodeGroupTraductionses().get(0).getModified().toString(), SKOSProperty.modified);
    }
    if (!nodeGroupLabel.getIdGroup().isEmpty()) {
        concept.addIdentifier(nodeGroupLabel.getIdGroup(), SKOSProperty.identifier);
    }
    for (NodeUri listIdOfTopConcept1 : listIdOfTopConcept) {
        if (listIdOfTopConcept1.getIdArk() == null || listIdOfTopConcept1.getIdArk().trim().isEmpty()) {
            concept.addRelation(serverAdress + "?idc=" + listIdOfTopConcept1.getIdConcept() + "&amp;idt=" + nodeGroupLabel.getIdThesaurus(), SKOSProperty.narrower);
        } else {
            concept.addRelation(serverArk + listIdOfTopConcept1.getIdArk(), SKOSProperty.narrower);
        }
    }
    skosBuff.append("    ").append(concept.toString());
    return true;
}
Also used : SKOSResource(skos.SKOSResource) NodeLang(mom.trd.opentheso.bdd.helper.nodes.NodeLang) NodeUri(mom.trd.opentheso.bdd.helper.nodes.NodeUri)

Aggregations

NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)20 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)9 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)8 NodeGroupLabel (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel)8 ArrayList (java.util.ArrayList)5 NodeHieraRelation (mom.trd.opentheso.bdd.helper.nodes.NodeHieraRelation)4 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)3 NodeLang (mom.trd.opentheso.bdd.helper.nodes.NodeLang)3 NodeConceptExport (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConceptExport)3 NodeThesaurus (mom.trd.opentheso.bdd.helper.nodes.thesaurus.NodeThesaurus)3 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 Concept (mom.trd.opentheso.bdd.datas.Concept)2 NodeAlignment (mom.trd.opentheso.bdd.helper.nodes.NodeAlignment)2 NodeConcept (mom.trd.opentheso.bdd.helper.nodes.concept.NodeConcept)2 SKOSResource (skos.SKOSResource)2 PrefixString (com.k_int.IR.QueryModels.PrefixString)1