Search in sources :

Example 6 with PreferencesHelper

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

the class Rest method getJsonDatas.

// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
// //////// Fonctions Privées     //////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////////
/**
 * Temporaire à refaire (Miled)
 */
/**
 * @param idConcept
 * @param idTheso
 * @return
 */
private String getJsonDatas(String value, String idLang, String idTheso) {
    ArrayList<String> listId = getListId(value, idLang, idTheso);
    NodePreference nodePreference1 = new PreferencesHelper().getThesaurusPreference(ds, idTheso);
    if (nodePreference != null) {
        ExportRdf4jHelper exportRdf4jHelper = new ExportRdf4jHelper();
        exportRdf4jHelper.setNodePreference(nodePreference1);
        exportRdf4jHelper.setInfos(ds, "dd-mm-yyyy", false, idTheso, nodePreference1.getCheminSite());
        exportRdf4jHelper.setNodePreference(nodePreference1);
        for (String idConcept : listId) {
            exportRdf4jHelper.addSignleConcept(idTheso, idConcept);
        }
        WriteRdf4j writeRdf4j = new WriteRdf4j(exportRdf4jHelper.getSkosXmlDocument());
        ByteArrayOutputStream out;
        out = new ByteArrayOutputStream();
        Rio.write(writeRdf4j.getModel(), out, RDFFormat.RDFJSON);
        // System.out.println(out.toString());
        return out.toString();
    }
    return messageEmptyJson();
}
Also used : WriteRdf4j(mom.trd.opentheso.core.exports.rdf4j.WriteRdf4j) ExportRdf4jHelper(mom.trd.opentheso.core.exports.rdf4j.helper.ExportRdf4jHelper) ByteArrayOutputStream(java.io.ByteArrayOutputStream) NodePreference(mom.trd.opentheso.bdd.helper.nodes.NodePreference) PreferencesHelper(mom.trd.opentheso.bdd.helper.PreferencesHelper)

Example 7 with PreferencesHelper

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

the class Rest method groupToSkos.

/**
 * Fonction qui permet de récupérer un concept skos par identifiant
 *
 * @param idGroup
 * @param idThesaurus
 * @return skos
 */
private StringBuffer groupToSkos(String idGroup, String idTheso) {
    if (ds == null) {
        return null;
    }
    nodePreference = new PreferencesHelper().getThesaurusPreference(ds, idTheso);
    if (nodePreference == null) {
        return null;
    }
    ExportFromBDD exportFromBDD = new ExportFromBDD();
    exportFromBDD.setServerArk(nodePreference.getServeurArk());
    exportFromBDD.setServerAdress(nodePreference.getCheminSite());
    StringBuffer skos = exportFromBDD.exportThisGroup(ds, idTheso, idGroup);
    return skos;
}
Also used : ExportFromBDD(mom.trd.opentheso.core.exports.old.ExportFromBDD) PreferencesHelper(mom.trd.opentheso.bdd.helper.PreferencesHelper)

Example 8 with PreferencesHelper

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

the class Rest method brancheOfConceptsToSkos.

/**
 * Fonction qui permet de récupérer une branche complète en partant d'un
 * concept vers le bas
 *
 * @param idGroup
 * @param idThesaurus
 * @return skos
 */
private StringBuffer brancheOfConceptsToSkos(String idConcept, String idTheso) {
    if (ds == null) {
        return null;
    }
    nodePreference = new PreferencesHelper().getThesaurusPreference(ds, idTheso);
    if (nodePreference == null) {
        return null;
    }
    ExportFromBDD exportFromBDD = new ExportFromBDD();
    exportFromBDD.setServerArk(nodePreference.getServeurArk());
    exportFromBDD.setServerAdress(nodePreference.getCheminSite());
    exportFromBDD.setNodePreference(nodePreference);
    StringBuffer skos = exportFromBDD.exportBranchOfConcept(ds, idTheso, idConcept);
    return skos;
}
Also used : ExportFromBDD(mom.trd.opentheso.core.exports.old.ExportFromBDD) PreferencesHelper(mom.trd.opentheso.bdd.helper.PreferencesHelper)

Example 9 with PreferencesHelper

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

the class Rest method groupsOfThesaurusToSkos.

/**
 * Fonction qui permet de récupérer les groupes d'un thésauurs
 *
 * @param idThesaurus
 * @return skos
 */
private StringBuffer groupsOfThesaurusToSkos(String idTheso) {
    if (ds == null) {
        return null;
    }
    nodePreference = new PreferencesHelper().getThesaurusPreference(ds, idTheso);
    if (nodePreference == null) {
        return null;
    }
    ExportFromBDD exportFromBDD = new ExportFromBDD();
    exportFromBDD.setServerArk(nodePreference.getServeurArk());
    exportFromBDD.setServerAdress(nodePreference.getCheminSite());
    StringBuffer skos = exportFromBDD.exportGroupsOfThesaurus(ds, idTheso);
    return skos;
}
Also used : ExportFromBDD(mom.trd.opentheso.core.exports.old.ExportFromBDD) PreferencesHelper(mom.trd.opentheso.bdd.helper.PreferencesHelper)

Example 10 with PreferencesHelper

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

the class Rest method ConceptByValueToSkos.

/**
 * cette fonction permet de retourner tous les concetps qui contiennenet la
 * valeur recherchée en filtrant par domaine ou groupe
 *
 * @param value
 * @param lang
 * @param idGroup
 * @param idThesaurus
 * @return
 */
private StringBuffer ConceptByValueToSkos(String value, String lang, String idGroup, String idTheso) {
    if (ds == null) {
        return null;
    }
    nodePreference = new PreferencesHelper().getThesaurusPreference(ds, idTheso);
    if (nodePreference == null) {
        return null;
    }
    ExportFromBDD exportFromBDD = new ExportFromBDD();
    exportFromBDD.setServerArk(nodePreference.getServeurArk());
    exportFromBDD.setServerAdress(nodePreference.getCheminSite());
    exportFromBDD.setNodePreference(nodePreference);
    StringBuffer skos = exportFromBDD.exportMultiConcept(ds, value, lang, idGroup, idTheso);
    return skos;
}
Also used : ExportFromBDD(mom.trd.opentheso.core.exports.old.ExportFromBDD) PreferencesHelper(mom.trd.opentheso.bdd.helper.PreferencesHelper)

Aggregations

PreferencesHelper (mom.trd.opentheso.bdd.helper.PreferencesHelper)20 ExportFromBDD (mom.trd.opentheso.core.exports.old.ExportFromBDD)9 NodePreference (mom.trd.opentheso.bdd.helper.nodes.NodePreference)8 ExportRdf4jHelper (mom.trd.opentheso.core.exports.rdf4j.helper.ExportRdf4jHelper)7 WriteRdf4j (mom.trd.opentheso.core.exports.rdf4j.WriteRdf4j)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)4 RDFFormat (org.eclipse.rdf4j.rio.RDFFormat)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 ByteArrayContent (org.primefaces.model.ByteArrayContent)2 DefaultStreamedContent (org.primefaces.model.DefaultStreamedContent)2 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 ConnexionTest (connexion.ConnexionTest)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 FacesMessage (javax.faces.application.FacesMessage)1 BaseDeDoneesHelper (mom.trd.opentheso.bdd.helper.BaseDeDoneesHelper)1 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)1 UserHelper (mom.trd.opentheso.bdd.helper.UserHelper)1