Skip to content

Commit

Permalink
RDF4J export phase 2 (progress bar)
Browse files Browse the repository at this point in the history
BDD 4.2.6 phase 1
  • Loading branch information
Quincy authored and Quincy committed May 10, 2017
1 parent fdeee92 commit eca4473
Show file tree
Hide file tree
Showing 21 changed files with 1,245 additions and 79,263 deletions.
218 changes: 111 additions & 107 deletions src/main/java/mom/trd/opentheso/SelectedBeans/DownloadBean.java

Large diffs are not rendered by default.

352 changes: 300 additions & 52 deletions src/main/java/mom/trd/opentheso/SelectedBeans/NewTreeBean.java

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/main/java/mom/trd/opentheso/SelectedBeans/SelectedTerme.java
Expand Up @@ -330,6 +330,8 @@ public void majTerme(MyTreeNode sN) {
majGroupTGen();
majLangueGroup();
majTSpeGroup();



} else {
Concept concept = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idC, idTheso);
Expand Down Expand Up @@ -456,7 +458,7 @@ private void majTAsso() {

private void majLangueGroup() {
langues = new ArrayList<>();
ArrayList<NodeGroupTraductions> tempNGT = new GroupHelper().getGroupTraduction(connect.getPoolConnexion(), idDomaine, idTheso, idlangue);
ArrayList<NodeGroupTraductions> tempNGT = new GroupHelper().getGroupTraduction(connect.getPoolConnexion(), idC, idTheso, idlangue);
HashMap<String, String> tempMapL = new HashMap<>();
for (NodeGroupTraductions ngt : tempNGT) {
tempMapL.put(ngt.getIdLang(), ngt.getTitle());
Expand All @@ -467,12 +469,21 @@ private void majLangueGroup() {
private void majTSpeGroup() {
termesSpecifique = new ArrayList<>();
ConceptHelper ch = new ConceptHelper();
GroupHelper gh = new GroupHelper();
ArrayList<NodeConceptTree> tempNT = ch.getListTopConcepts(connect.getPoolConnexion(), idC, idTheso, idlangue);
for (NodeConceptTree nct : tempNT) {
HashMap<String, String> tempMap1 = new HashMap<>();
tempMap1.put(nct.getIdConcept(), nct.getTitle());
termesSpecifique.addAll(tempMap1.entrySet());
}
for(String tGroup : ch.getListGroupChildIdOfGroup(connect.getPoolConnexion(), idC, idTheso)){

String value = gh.getLexicalValueOfGroup(connect.getPoolConnexion(), tGroup, idTheso, idlangue);
HashMap<String, String> tempMap1 = new HashMap<>();
tempMap1.put(tGroup, value);
termesSpecifique.addAll(tempMap1.entrySet());
}

}

private void majGroup() {
Expand Down
Expand Up @@ -123,6 +123,17 @@ public class SelectedThesaurus implements Serializable {

@ManagedProperty(value = "#{treeBean}")
private TreeBean tree;

@ManagedProperty(value = "#{newtreeBean}")
private NewTreeBean newTree;

public NewTreeBean getNewTree() {
return newTree;
}

public void setNewTree(NewTreeBean newTree) {
this.newTree = newTree;
}



Expand Down Expand Up @@ -165,6 +176,7 @@ private ResourceBundle getBundlePrefArk() {
FacesContext context = FacesContext.getCurrentInstance();
ResourceBundle bundlePref = context.getApplication().getResourceBundle(context, "ark");
return bundlePref;

}

/**
Expand Down Expand Up @@ -779,6 +791,11 @@ public void maj() {
uTree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
candidat.maj(thesaurus.getId_thesaurus(), thesaurus.getLanguage());



if(newTree!=null)
newTree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
vue.setCreat(false);
}

Expand Down Expand Up @@ -825,6 +842,9 @@ public void update() {
languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
candidat.maj(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
vue.setCreat(false);

if(newTree!=null)
newTree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
}

/***************************************** FACETTES *****************************************/
Expand Down Expand Up @@ -1447,6 +1467,7 @@ public void setStatBean(StatBean statBean) {

public ArrayList<Entry<String, String>> getArrayFacette() {
if(connect.getPoolConnexion() != null) {

ArrayList<NodeFacet> temp = new FacetHelper().getAllFacetsOfThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
Map<String, String> mapTemp = new HashMap<>();
for(NodeFacet nf : temp) {
Expand Down
57 changes: 55 additions & 2 deletions src/main/java/mom/trd/opentheso/bdd/helper/ConceptHelper.java
Expand Up @@ -2434,6 +2434,8 @@ public ArrayList<String> getListGroupIdOfConcept(HikariDataSource ds,
idGroup.add(resultSet.getString("id_group"));
}
}



} finally {
stmt.close();
Expand Down Expand Up @@ -2532,6 +2534,44 @@ public ArrayList<String> getListGroupParentIdOfGroup(HikariDataSource ds,
return idGroupParentt;
}

public ArrayList<String> getListGroupChildIdOfGroup(HikariDataSource ds,
String idGRoup, String idThesaurus) {

Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<String> idGroupParentt = new ArrayList<>();
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select id_group2 from relation_group where id_thesaurus = '"
+ idThesaurus + "'"
+ " and id_group1 = '" + idGRoup + "'"
+ " and relation='sub'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
while (resultSet.next()) {
idGroupParentt.add(resultSet.getString("id_group2"));
}
}

} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting Id of group of Concept : " + idGRoup, sqle);
}
return idGroupParentt;
}


/**
* Cette fonction permet de récupérer les identifiants des Group des parents
Expand Down Expand Up @@ -2645,6 +2685,7 @@ public ArrayList<String> getListIdsOfTopConcepts(HikariDataSource ds,
}
return listIdOfTopConcept;
}


/**
* Cette fonction permet de récupérer la liste des Ids of Topconcepts pour
Expand Down Expand Up @@ -2723,7 +2764,7 @@ public ArrayList<NodeConceptTree> getListTopConcepts(HikariDataSource ds,
try {
String query = "select id_concept, status from concept where id_thesaurus = '"
+ idThesaurus + "'"
+ " and id_group = '" + idGroup + "'"
+ " and concept.id_concept IN (SELECT idconcept FROM concept_group_concept WHERE idgroup = '"+idGroup+ "')"
+ " and top_concept = true";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
Expand Down Expand Up @@ -3674,7 +3715,18 @@ public ArrayList<ArrayList<String>> getInvertPathOfConcept(HikariDataSource ds,
}
}
if (resultat.isEmpty()) {
path.add(getGroupIdOfConcept(ds, idConcept, idThesaurus));

String group;

do{
group = getGroupIdOfConcept(ds, idConcept, idThesaurus);
if(group == null)
group = new GroupHelper().getIdFather(ds, idConcept, idThesaurus);
path.add(group);
idConcept = group;
}while(new GroupHelper().getIdFather(ds, group, idThesaurus) != null);


ArrayList<String> pathTemp = new ArrayList<>();
for (String path2 : firstPath) {
pathTemp.add(path2);
Expand All @@ -3694,6 +3746,7 @@ public ArrayList<ArrayList<String>> getInvertPathOfConcept(HikariDataSource ds,
}

return tabId;

}

public ArrayList<ArrayList<String>> getPathOfConcept(HikariDataSource ds,
Expand Down
81 changes: 78 additions & 3 deletions src/main/java/mom/trd/opentheso/bdd/helper/GroupHelper.java
Expand Up @@ -108,6 +108,44 @@ public void addConceptGroupConcept(HikariDataSource ds,

}

public ArrayList<String> getListGroupChildIdOfGroup(HikariDataSource ds,
String idGRoup, String idThesaurus) {

Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<String> idGroupParentt = new ArrayList<>();
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select id_group2 from relation_group where id_thesaurus = '"
+ idThesaurus + "'"
+ " and id_group1 = '" + idGRoup + "'"
+ " and relation='sub'";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
if (resultSet != null) {
while (resultSet.next()) {
idGroupParentt.add(resultSet.getString("id_group2"));
}
}

} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting Id of group of Concept : " + idGRoup, sqle);
}
return idGroupParentt;
}

/**
* Fonction qui permet de supprimer un domaine de la branche donnée avec un
* concept de tête un domaine et thesaurus
Expand Down Expand Up @@ -868,7 +906,8 @@ public ArrayList<NodeConceptTree> getRelationGroupOf(HikariDataSource ds,
stmt = conn.createStatement();
try {
String query = "SELECT * FROM concept_group_label WHERE "
+ "lang = '" + idLang + "' and "
+ "lang = '" + idLang + "' and "
+ "idthesaurus = '" + idThesaurus + "' and "
+ "idgroup IN ("
+ "SELECT id_group2 FROM relation_group WHERE "
+ "relation = 'sub' and "
Expand Down Expand Up @@ -905,6 +944,42 @@ public ArrayList<NodeConceptTree> getRelationGroupOf(HikariDataSource ds,
return nodeConceptTrees;
}

public String getIdFather(HikariDataSource ds,
String idGRoup, String idThesaurus) {
Connection conn;
Statement stmt;
ResultSet resultSet;
String idFather = null;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select id_group1 from relation_group where id_thesaurus = '"
+ idThesaurus + "'"
+ " and id_group2 = '" + idGRoup + "'"
+ " and relation='sub'";

stmt.executeQuery(query);
resultSet = stmt.getResultSet();
resultSet.next();
idFather = resultSet.getString("id_group1");

} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getChildrenOf: " + idThesaurus, sqle);
}

return idFather;
}

/**
* Permet de retourner un NodeConceptGroup par identifiant, par thésaurus et
* par langue / ou null si rien cette fonction ne retourne pas les détails
Expand Down Expand Up @@ -1237,7 +1312,7 @@ public ArrayList<NodeGroup> getListConceptGroup(HikariDataSource ds,

public ArrayList<NodeGroup> getListRootConceptGroup(HikariDataSource ds,
String idThesaurus, String idLang) {

ArrayList<NodeGroup> nodeConceptGroupList;
ArrayList tabIdConceptGroup = getListIdOfRootGroup(ds, idThesaurus);

Expand All @@ -1252,7 +1327,6 @@ public ArrayList<NodeGroup> getListRootConceptGroup(HikariDataSource ds,
}

return nodeConceptGroupList;


}

Expand Down Expand Up @@ -1440,6 +1514,7 @@ public ArrayList<String> getListIdOfGroup(HikariDataSource ds,
}
return tabIdConceptGroup;
}

public ArrayList<String> getListIdOfRootGroup(HikariDataSource ds,
String idThesaurus) {

Expand Down

0 comments on commit eca4473

Please sign in to comment.