Skip to content
Permalink
Browse files

export Privé de la base de données pour extraire toutes les données n…

…on SKOS
  • Loading branch information...
antonio.perez
antonio.perez committed Sep 22, 2016
1 parent a44e18d commit bc4af757352c9ac007b7c4ef9dfe656f842ce364
Showing with 3,546 additions and 210 deletions.
  1. BIN Installer Opentheso sous Mac.pdf
  2. BIN Installer Opentheso sous Windows.pdf
  3. +0 −1 src/main/java/mom/trd/opentheso/SelectedBeans/LanguageBean.java
  4. +33 −9 src/main/java/mom/trd/opentheso/SelectedBeans/SelectedTerme.java
  5. +32 −0 src/main/java/mom/trd/opentheso/SelectedBeans/SelectedThesaurus.java
  6. +1 −0 src/main/java/mom/trd/opentheso/bdd/helper/FacetHelper.java
  7. +1 −1 src/main/java/mom/trd/opentheso/bdd/helper/GroupHelper.java
  8. +13 −5 src/main/java/mom/trd/opentheso/bdd/helper/RelationsHelper.java
  9. +45 −0 src/main/java/mom/trd/opentheso/bdd/helper/ThesaurusHelper.java
  10. +1 −1 src/main/java/mom/trd/opentheso/core/alignment/AlignmentQuery.java
  11. +27 −5 src/main/java/mom/trd/opentheso/core/imports/helper/ImportSkosHelper.java
  12. +53 −6 src/main/java/mom/trd/opentheso/core/imports/old/WriteSkosBDD.java
  13. BIN src/main/resources/install/Installation_Windows.pdf
  14. BIN src/main/resources/install/{installation.pdf → installation_debian.pdf}
  15. +2,735 −0 src/main/resources/install/opentheso_dist_4.0.9.sql
  16. +5 −0 src/main/resources/language/site.properties
  17. +5 −1 src/main/resources/language/site_de.properties
  18. +5 −1 src/main/resources/language/site_en.properties
  19. +5 −1 src/main/resources/language/site_es.properties
  20. +471 −0 src/main/resources/language/site_fr.properties
  21. +5 −1 src/main/resources/language/site_it.properties
  22. +24 −0 src/main/webapp/admin/reorganizing.xhtml
  23. +4 −8 src/main/webapp/conf.xhtml
  24. +2 −2 src/main/webapp/contenuCentral/alignement/alignement.xhtml
  25. +1 −1 src/main/webapp/contenuCentral/contenuCentral.xhtml
  26. +4 −1 src/main/webapp/contenuCentral/notes/notes.xhtml
  27. +2 −1 src/main/webapp/contenuCentral/termesSpecifiques/termesSpecifiques.xhtml
  28. +0 −40 src/main/webapp/dialogs/Alignement/AjouterAutomatiqueEditDlg.xhtml
  29. +0 −45 src/main/webapp/dialogs/Alignement/AjouterManuelEditDlg.xhtml
  30. +2 −2 ...app/dialogs/Alignement/{ajouterAutomatique2EditDlg.xhtml → ajouterAutomatique_suiteEditDlg.xhtml}
  31. +44 −0 src/main/webapp/dialogs/facette/addToFacetteDlg.xhtml
  32. +5 −36 src/main/webapp/dialogs/facette/{fecetteEditlDlg.xhtml → facetteEditlDlg.xhtml}
  33. +1 −1 src/main/webapp/dialogs/traductionDlg/ajouterTraductionEditDlg.xhtml
  34. +1 −1 src/main/webapp/dialogs/user/editUserDlg.xhtml
  35. +3 −9 src/main/webapp/edition.xhtml
  36. +1 −8 src/main/webapp/gestCandidat.xhtml
  37. +7 −7 src/main/webapp/includes.xhtml
  38. +5 −5 src/main/webapp/panelDroite/facette/facette.xhtml
  39. +1 −1 src/main/webapp/panelDroite/traduction/traduction.xhtml
  40. +1 −2 src/main/webapp/panelGauche/sousArbre/sousArbre.xhtml
  41. +1 −8 src/main/webapp/statistic.xhtml
Binary file not shown.
Binary file not shown.
@@ -8,7 +8,6 @@
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import mom.trd.opentheso.bdd.helper.Connexion;
import mom.trd.opentheso.bdd.helper.UserHelper;

@ManagedBean(name = "langueBean", eager = true)
@SessionScoped
@@ -1139,13 +1139,27 @@ public void creerTradterme() {
return;
}
boolean tradExist = false;

// c'est le cas ou le concept n'a pas de traduction dans la langue en cours, il faut le mettre a jour dans l'arbre
boolean newTraduction = false;


for (Entry<String, String> e : langues) {
if (e.getKey().equals(langueEdit)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
tradExist = true;
break;
}
}
ConceptHelper ch = new ConceptHelper();
TermHelper termHelper = new TermHelper();
if(idT.isEmpty()) {
newTraduction = true;
String tmp = termHelper.getIdTermOfConcept(connect.getPoolConnexion(), idC, idTheso);
if(tmp != null) {
idT = tmp;
}
}
// traduction du domaine
if (type == 1 && !tradExist) {
ConceptGroupLabel cgl = new ConceptGroupLabel();
@@ -1155,7 +1169,7 @@ public void creerTradterme() {
cgl.setLang(langueEdit);

GroupHelper cgh = new GroupHelper();
if (!cgh.isDomainExist(connect.getPoolConnexion(),
if (cgh.isDomainExist(connect.getPoolConnexion(),
cgl.getLexicalvalue(),
cgl.getIdthesaurus(), cgl.getLang())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
@@ -1172,6 +1186,9 @@ public void creerTradterme() {
for (NodeGroupTraductions ngt : tempNGT) {
tempMapL.put(ngt.getIdLang(), ngt.getTitle());
}
if(newTraduction) {
nom = cgh.getLexicalValueOfGroup(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
}
langues.addAll(tempMapL.entrySet());

// traduction du TT
@@ -1181,25 +1198,28 @@ public void creerTradterme() {
terme.setLang(langueEdit);
terme.setLexical_value(valueEdit);
terme.setId_term(idT);
if (new TermHelper().isTermExist(connect.getPoolConnexion(),
if (termHelper.isTermExist(connect.getPoolConnexion(),
terme.getLexical_value(),
terme.getId_thesaurus(), terme.getLang())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
return;
}

ConceptHelper ch = new ConceptHelper();

if (!ch.addTopConceptTraduction(connect.getPoolConnexion(), terme, user.getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error")));
return;
}

ArrayList<NodeTermTraduction> tempNTT = new TermHelper().getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
ArrayList<NodeTermTraduction> tempNTT = termHelper.getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
langues = new ArrayList<>();
HashMap<String, String> tempMapL = new HashMap<>();
for (NodeTermTraduction ntt : tempNTT) {
tempMapL.put(ntt.getLang(), ntt.getLexicalValue());
}
if(newTraduction) {
nom = termHelper.getThisTerm(connect.getPoolConnexion(),idC, idTheso, idlangue).getLexical_value();
}
langues.addAll(tempMapL.entrySet());

// traduction des concepts
@@ -1210,25 +1230,28 @@ public void creerTradterme() {
terme.setLexical_value(valueEdit);
terme.setId_term(idT);

if (new TermHelper().isTermExist(connect.getPoolConnexion(),
if (termHelper.isTermExist(connect.getPoolConnexion(),
terme.getLexical_value(),
terme.getId_thesaurus(), terme.getLang())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error4")));
return;
}
ConceptHelper ch = new ConceptHelper();

if (!ch.addConceptTraduction(connect.getPoolConnexion(), terme, user.getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error")));
return;
}

ArrayList<NodeTermTraduction> tempNTT = new TermHelper().getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
ArrayList<NodeTermTraduction> tempNTT = termHelper.getTraductionsOfConcept(connect.getPoolConnexion(), idC, idTheso, idlangue);
langues = new ArrayList<>();
HashMap<String, String> tempMapL = new HashMap<>();
for (NodeTermTraduction ntt : tempNTT) {
tempMapL.put(ntt.getLang(), ntt.getLexicalValue());
}
langues.addAll(tempMapL.entrySet());
if(newTraduction) {
nom = termHelper.getThisTerm(connect.getPoolConnexion(),idC, idTheso, idlangue).getLexical_value();
}
}

langueEdit = "";
@@ -2044,8 +2067,9 @@ public void initTree() {
} else {
dynamicTreeNode = (TreeNode) new MyTreeNode(1, n.getIdConcept(), idTheso, idlangue, "", "", "dossier", n.getTitle(), root);
}

new DefaultTreeNode("fake", dynamicTreeNode);

DefaultTreeNode defaultTreeNode = new DefaultTreeNode("fake", dynamicTreeNode);
defaultTreeNode.setExpanded(true);
}
}

@@ -341,6 +341,38 @@ public void initTheso() {
/************************************** EDITION THESO BDD **************************************/


/**
* Cette fonction permet de nettoyer et réorganiser le thésaurus
* @return
*/
public boolean reorganizing() {
if(thesaurus.getId_thesaurus().isEmpty()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error1")));
return false;
}
try {
ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);

if(!thesaurusHelper.reorganizingTheso(conn, thesaurus.getId_thesaurus())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("theso.infoReorganizing") ));
return true;

} catch (SQLException ex) {
Logger.getLogger(CurrentUser.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}


/**
* Création d'un nouveau thésaurus avec le role
* @param idUser
@@ -701,6 +701,7 @@ public NodeConceptTree getConceptOnFacet(HikariDataSource ds,
+ "from thesaurus_array, term, preferred_term"
+ " where thesaurus_array.id_concept_parent=preferred_term.id_concept"
+ " and preferred_term.id_term=term.id_term"
+ " and thesaurus_array.id_thesaurus=term.id_thesaurus"
+ " and term.lang='" + lang.trim() + "'"
+ " and thesaurus_array.id_thesaurus = '" + idThesaurus + "'"
+ " and identifier = '" + idFacet + "'";
@@ -1482,7 +1482,7 @@ public boolean isDomainExist(HikariDataSource ds,
try {
stmt = conn.createStatement();
try {
String query = "select idgroup from group_concept_label where "
String query = "select idgroup from concept_group_label where "
+ "unaccent_string(lexicalvalue) ilike "
+ "unaccent_string('" + title
+ "') and lang = '" + idLang
@@ -123,11 +123,19 @@ public boolean addRelationMT(Connection conn,
try {
stmt = conn.createStatement();
try {
String query = "select DISTINCT (id_concept2), status from hierarchical_relationship, concept"
+ " where hierarchical_relationship.id_thesaurus = '" + idThesaurus + "'"
+ " and hierarchical_relationship.id_concept2 = concept.id_concept"
+ " and id_concept1 = '" + idConcept + "'"
+ " and role = '" + "BT" + "'";
String query = "SELECT hierarchical_relationship.id_concept2,"
+ " concept.status FROM hierarchical_relationship,"
+ " concept WHERE "
+ " concept.id_thesaurus = hierarchical_relationship.id_thesaurus"
+ " AND "
+ " concept.id_concept = hierarchical_relationship.id_concept1"
+ " AND"
+ " hierarchical_relationship.id_thesaurus = '" + idThesaurus + "'"
+ " AND"
+ " hierarchical_relationship.id_concept1 = '" + idConcept + "'"
+ " AND"
+ " hierarchical_relationship.role = 'BT'";

stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
@@ -268,6 +268,51 @@ public boolean addThesaurusTraductionRollBack(Connection conn,
return status;
}

/**
* Cette focntion permet de nettoyer un thésaurus
* @param conn
* @param idTheso
* @return
*/
public boolean reorganizingTheso(Connection conn, String idTheso) {
Statement stmt;
boolean status = false;

try {
try {
stmt = conn.createStatement();
try {
String query = "delete from term where id_term = ''"
+ " and id_thesaurus = '" + idTheso + "'";
stmt.executeUpdate(query);

query = "delete from concept_group_label where idgroup = ''"
+ " and idthesaurus = '" + idTheso + "'";
stmt.executeUpdate(query);

query = "UPDATE concept_group SET notation = '' WHERE notation ilike 'null'";
stmt.executeUpdate(query);

query = "UPDATE concept_group SET idtypecode = 'MT' WHERE idtypecode ilike 'null'";
stmt.executeUpdate(query);

query = "UPDATE concept SET notation = '' WHERE notation ilike 'null'";
stmt.executeUpdate(query);

status = true;

} finally {
stmt.close();
}
} finally {
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while reorganizing theso : " + idTheso, sqle);
}
return status;
}

/**
* Permet de rajouter une traduction à un Thésaurus existant suivant un l'id
* du thésaurus et la langue retourne yes or No si l'opération a réussie ou
@@ -384,7 +384,7 @@
NodeAlignment na = new NodeAlignment();
na.setInternal_id_concept(idC);
na.setInternal_id_thesaurus(idTheso);
na.setThesaurus_target("OpenTheso");
na.setThesaurus_target("Pactols");
na.setUri_target(resource.getUri());
for(SKOSLabel label : resource.getLabelsList()) {
switch (label.getProperty()) {
@@ -1685,13 +1685,35 @@ private String getNewId(){
}

private String getIdFromUri(String uri) {
if (uri.contains("#")) {
uri = uri.substring(uri.indexOf("#") + 1, uri.length());
if (uri.contains("idg=")) {
if(uri.contains("&")){
uri = uri.substring(uri.indexOf("idg=") + 4, uri.indexOf("&"));
}
else {
uri = uri.substring(uri.indexOf("idg=") + 4, uri.length());
}
}
else
{
uri = uri.substring(uri.lastIndexOf("/") + 1, uri.length());
else {
if (uri.contains("idc=")) {
if(uri.contains("&")){
uri = uri.substring(uri.indexOf("idc=") + 4, uri.indexOf("&"));
}
else {
uri = uri.substring(uri.indexOf("idc=") + 4, uri.length());
}
}
else {
if (uri.contains("#")) {
uri = uri.substring(uri.indexOf("#") + 1, uri.length());
}
else
{
uri = uri.substring(uri.lastIndexOf("/") + 1, uri.length());
}
}
}


StringPlus stringPlus = new StringPlus();
uri =stringPlus.normalizeStringForIdentifier(uri);
return uri;
@@ -499,15 +499,62 @@ public String getThesaurusName(String uri) {
}

public String getId(String uri) {
if (uri.contains("#")) {
uri = uri.substring(uri.indexOf("#") + 1, uri.length());
if (uri.contains("idg=")) {
if(uri.contains("&")){
uri = uri.substring(uri.indexOf("idg=") + 4, uri.indexOf("&"));
}
else {
uri = uri.substring(uri.indexOf("idg=") + 4, uri.length());
}
}
else
{
uri = uri.substring(uri.lastIndexOf("/") + 1, uri.length());
else {
if (uri.contains("idc=")) {
if(uri.contains("&")){
uri = uri.substring(uri.indexOf("idc=") + 4, uri.indexOf("&"));
}
else {
uri = uri.substring(uri.indexOf("idc=") + 4, uri.length());
}
}
else {
if (uri.contains("#")) {
uri = uri.substring(uri.indexOf("#") + 1, uri.length());
}
else
{
uri = uri.substring(uri.lastIndexOf("/") + 1, uri.length());
}
}
}
return uri;
}
}

/*
public String getId(SKOSResource resource) {
String id = "";
if(resource.getSdc() != null){
if(resource.getSdc().getIdentifier()!= null) {
if(!resource.getSdc().getIdentifier().isEmpty()){
id = resource.getSdc().getIdentifier();
}
}
}
if(id.isEmpty()) {
if (resource.getUri().contains("#")) {
id = resource.getUri().substring(resource.getUri().indexOf("#") + 1, resource.getUri().length());
}
else
{
id = resource.getUri().substring(resource.getUri().lastIndexOf("/") + 1, resource.getUri().length());
}
}
return id;
}*/




/* Pour un concept */
public ArrayList<NodeTermTraduction> getTraductionConcept(ArrayList<SKOSLabel> labelsList) {
Binary file not shown.
File renamed without changes.

0 comments on commit bc4af75

Please sign in to comment.
You can’t perform that action at this time.