use of mom.trd.opentheso.bdd.helper.ConceptHelper 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();
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class ExportFromBDD_Frantiq method exportThesaurus.
/**
* Fonction récursive permettant d'exporter le thésaurus de la tête jusqu'au
* dernier descripteur
*
* @param ds
* @param idThesaurus
* @return
*/
public StringBuffer exportThesaurus(HikariDataSource ds, String idThesaurus) {
/*
* Ecriture du thésaurus
*/
ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
NodeThesaurus nodeThesaurus = thesaurusHelper.getNodeThesaurus(ds, idThesaurus);
WriteFileSKOS_Frantiq writeFileSKOS = new WriteFileSKOS_Frantiq();
// inititialisation des URI
writeFileSKOS.setServerArk(serverArk);
writeFileSKOS.setServerAdress(serverAdress);
writeFileSKOS.writeHeader();
String idArk = thesaurusHelper.getIdArkOfThesaurus(ds, idThesaurus);
if (idArk == null || idArk.trim().isEmpty()) {
writeFileSKOS.setURI(serverAdress);
} else {
writeFileSKOS.setURI(serverArk);
}
// writeFileSKOS.setURI("http://opentheso.frantiq.fr/" + nodeThesaurus.getListThesaurusTraduction().get(0).getTitle());
// thesaurus.description);
writeFileSKOS.writeThesaurus(nodeThesaurus);
// ecriture des TopConcept
GroupHelper conceptGroupHelper = new GroupHelper();
ArrayList<String> tabIdGroup = conceptGroupHelper.getListIdOfGroup(ds, idThesaurus);
for (String tabIdGroup1 : tabIdGroup) {
writeFileSKOS.writeTopConcepts(tabIdGroup1);
}
writeFileSKOS.writeEndOfMicroThesaurusList();
// fin du bloc thésaurus et id of TopConcept
// écriture des Domaines et Descripteurs avec traductions
ArrayList<NodeUri> idOfTopConcept;
for (String tabIdGroup1 : tabIdGroup) {
NodeGroupLabel nodeGroupLabel = conceptGroupHelper.getNodeGroupLabel(ds, tabIdGroup1, idThesaurus);
idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, tabIdGroup1, idThesaurus);
writeFileSKOS.writeGroup(nodeGroupLabel, idOfTopConcept);
}
for (String tabIdGroup1 : tabIdGroup) {
idOfTopConcept = new ConceptHelper().getListIdsOfTopConceptsForExport(ds, tabIdGroup1, idThesaurus);
for (NodeUri idOfTopConcept1 : idOfTopConcept) {
exportAllConcepts(ds, idOfTopConcept1.getIdConcept(), idThesaurus, writeFileSKOS);
}
}
writeFileSKOS.endSkos();
return writeFileSKOS.getSkosBuff();
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class ExportFromBDD_Frantiq 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();
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedThesaurus method regenerateAllArkId.
/**
* Permet de vérifier si les Identifiants Ark sont valides s'ils n'existent
* pas, on les ajoutes s'ils exient, on ne fait rien.
*
* @param idTheso #MR
*/
public void regenerateAllArkId(String idTheso) {
ConceptHelper conceptHelper = new ConceptHelper();
try {
ArrayList<String> idGroup = null;
// concept
try {
ArrayList<String> idConcepts = conceptHelper.getAllIdConceptOfThesaurus(connect.getPoolConnexion(), idTheso);
if (idConcepts == null || idConcepts.isEmpty()) {
throw new Exception("No concept in this thesaurus");
}
regenArkIdConcept(idTheso, idConcepts);
} catch (Exception ex) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while regen id concept:", ex.getMessage()));
throw new Exception("Error while regen id concept ");
}
maj();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Info :", "Regen id finished"));
} catch (SQLException ex) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "SQL Error :", ex.getMessage()));
} catch (Exception ex) {
}
}
use of mom.trd.opentheso.bdd.helper.ConceptHelper in project opentheso by miledrousset.
the class SelectedThesaurus method generateAllInexistantHandleId.
/**
* Permet de générere les identifiants Handle manquants
*
* @param idTheso #MR
*/
public void generateAllInexistantHandleId(String idTheso) {
ConceptHelper conceptHelper = new ConceptHelper();
try {
ArrayList<String> idGroup = null;
// concept
try {
ArrayList<String> idConcepts = conceptHelper.getAllIdConceptOfThesaurusWithoutHandle(connect.getPoolConnexion(), idTheso);
if (idConcepts == null || idConcepts.isEmpty()) {
throw new Exception("No concept in this thesaurus");
}
regenerateHAndleIdOfConcepts(idTheso, idConcepts);
} catch (Exception ex) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error while regen id concept:", ex.getMessage()));
throw new Exception("Error while regen id concept ");
}
maj();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Info :", "Regen id finished"));
} catch (SQLException ex) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "SQL Error :", ex.getMessage()));
} catch (Exception ex) {
}
}
Aggregations