use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class ImportRdf4jHelper method initAddConceptsStruct.
private void initAddConceptsStruct(AddConceptsStruct acs, SKOSResource conceptResource) throws ParseException {
acs.conceptResource = conceptResource;
acs.concept = new Concept();
String idConcept = getOriginalId(conceptResource.getUri());
acs.concept.setIdConcept(idConcept);
// option cochée
if (identifierType.equalsIgnoreCase("ark")) {
acs.concept.setIdArk(getIdArkFromUri(conceptResource.getUri()));
}
if (identifierType.equalsIgnoreCase("handle")) {
acs.concept.setIdHandle(getIdHandleFromUri(conceptResource.getUri()));
}
acs.concept.setIdThesaurus(idTheso);
addNotation(acs);
addGPSCoordinates(acs);
addLabel(acs);
addDocumentation(acs);
addDate(acs);
addMatch(acs);
// autre
// ajout des termes et traductions
acs.nodeTerm.setNodeTermTraduction(acs.nodeTermTraductionList);
acs.nodeTerm.setIdTerm(acs.concept.getIdConcept());
acs.nodeTerm.setIdConcept(acs.concept.getIdConcept());
acs.nodeTerm.setIdThesaurus(idTheso);
acs.nodeTerm.setSource("");
acs.nodeTerm.setStatus("");
acs.nodeTerm.setCreated(acs.concept.getCreated());
acs.nodeTerm.setModified(acs.concept.getModified());
}
use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class ConceptHelper method reactiveConcept.
/**
* Cette fonction permet de réactiver un concept (!hidden)
*
* @param ds
* @param idConcept
* @param idTheso
* @param idUser
* @return
*/
public boolean reactiveConcept(HikariDataSource ds, String idConcept, String idTheso, int idUser) {
Connection conn;
Statement stmt;
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
Concept concept = getThisConcept(ds, idConcept, idTheso);
concept.setStatus("D");
if (!addConceptHistorique(conn, concept, idUser)) {
conn.rollback();
conn.close();
return false;
}
String query = "UPDATE concept " + "set status='D'" + " WHERE id_concept ='" + idConcept + "'" + " AND id_thesaurus='" + idTheso + "'";
stmt.executeUpdate(query);
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error during reactivation of Concept : " + idConcept, sqle);
return false;
}
return true;
}
use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class ConceptHelper method addConceptFusion.
/**
* Cette fonction permet de fusionner deux concepts. Le premier concept
* reste, le second passe en état 'fusionné'.
*
* @param ds
* @param idConcept1
* @param idConcept2
* @param idTheso
* @param idUser
* @return
*/
public boolean addConceptFusion(HikariDataSource ds, String idConcept1, String idConcept2, String idTheso, int idUser) {
boolean status = false;
String idArk = "";
Connection conn;
Statement stmt;
try {
// Get connection from pool
conn = ds.getConnection();
conn.setAutoCommit(false);
Concept concept = getThisConcept(ds, idConcept2, idTheso);
concept.setStatus("hidden");
if (!addConceptHistorique(conn, concept, idUser)) {
conn.rollback();
conn.close();
return false;
} else if (!updateStatusConcept(ds, idConcept2, idTheso, "hidden")) {
conn.rollback();
conn.close();
return false;
}
try {
stmt = conn.createStatement();
try {
String query = "Insert into concept_fusion " + "(id_concept1, id_concept2, id_thesaurus, id_user)" + " values (" + "'" + idConcept1 + "'" + ",'" + idConcept2 + "'" + ",'" + idTheso + "'" + ",'" + idUser + "')";
stmt.executeUpdate(query);
status = true;
conn.commit();
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while melting Concept : " + idConcept1 + " and " + idConcept2, sqle);
}
return status;
}
use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class ConceptHelper method getConceptForExport.
/**
* Cette fonction permet de récupérer toutes les informations concernant un
* Concept par son id et son thésaurus et la langue On récupère aussi les
* IdArk si Ark est actif
*
* @param ds
* @param idConcept
* @param idThesaurus
* @param isArkActive
* @return Objet class NodeConcept
*/
public NodeConceptExport getConceptForExport(HikariDataSource ds, String idConcept, String idThesaurus, boolean isArkActive) {
NodeConceptExport nodeConceptExport = new NodeConceptExport();
// récupération des BT
RelationsHelper relationsHelper = new RelationsHelper();
ArrayList<NodeHieraRelation> nodeListOfBT_Ark = relationsHelper.getListBT(ds, idConcept, idThesaurus);
nodeConceptExport.setNodeListOfBT(nodeListOfBT_Ark);
// récupération du Concept
Concept concept = getThisConcept(ds, idConcept, idThesaurus);
/**
* Attention si on passe par le null, ca veut dire qu'il y a une
* incohérence dans la base à corriger !!!!!
*/
if (concept == null) {
return null;
}
nodeConceptExport.setConcept(concept);
AlignmentHelper alignmentHelper = new AlignmentHelper();
ArrayList<NodeAlignment> nodeAlignmentList = alignmentHelper.getAllAlignmentOfConcept(ds, idConcept, idThesaurus);
nodeConceptExport.setNodeAlignmentsList(nodeAlignmentList);
// récupération des termes spécifiques
ArrayList<NodeHieraRelation> nodeListIdsOfNT_Ark = relationsHelper.getListNT(ds, idConcept, idThesaurus);
nodeConceptExport.setNodeListOfNT(nodeListIdsOfNT_Ark);
// récupération des termes associés
ArrayList<NodeHieraRelation> nodeListIdsOfRT_Ark = relationsHelper.getListRT(ds, idConcept, idThesaurus);
nodeConceptExport.setNodeListIdsOfRT(nodeListIdsOfRT_Ark);
// récupération des Non Prefered Term
nodeConceptExport.setNodeEM(new TermHelper().getAllNonPreferredTerms(ds, new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus), idThesaurus));
// récupération des traductions
nodeConceptExport.setNodeTermTraductions(new TermHelper().getAllTraductionsOfConcept(ds, idConcept, idThesaurus));
// récupération des Groupes ou domaines
ArrayList<NodeUri> nodeListIdsOfConceptGroup_Ark = getListIdArkOfGroup(ds, new GroupHelper().getListIdGroupOfConcept(ds, idThesaurus, idConcept), idThesaurus);
nodeConceptExport.setNodeListIdsOfConceptGroup(nodeListIdsOfConceptGroup_Ark);
// récupération des notes du Terme
String idTerm = new TermHelper().getIdTermOfConcept(ds, idConcept, idThesaurus);
nodeConceptExport.setNodeNoteTerm(new NoteHelper().getListNotesTermAllLang(ds, idTerm, idThesaurus));
// récupération des Notes du Concept
nodeConceptExport.setNodeNoteConcept(new NoteHelper().getListNotesConceptAllLang(ds, idConcept, idThesaurus));
// récupération des coordonnées GPS
GpsHelper gpsHelper = new GpsHelper();
NodeGps nodeGps = gpsHelper.getCoordinate(ds, idConcept, idThesaurus);
if (nodeGps != null) {
nodeConceptExport.setNodeGps(nodeGps);
}
return nodeConceptExport;
}
use of mom.trd.opentheso.bdd.datas.Concept in project opentheso by miledrousset.
the class NewTreeBean method loadOrphan.
public void loadOrphan(String idTheso, String langue) {
String typeNode, value = "";
/*
this.typeMot = type;
this.idMot = id;
this.idTheso = idT;
this.langue = l;
this.idDomaine = idD;
this.typeDomaine = typeDomaine;
this.idTopConcept = idTC;
*/
TreeNode dynamicTreeNode = (TreeNode) new MyTreeNode(1, null, idTheso, langue, null, null, null, "orphan", langueBean.getMsg("index.orphans"), root);
orphans = new OrphanHelper().getListOrphanId(connect.getPoolConnexion(), idTheso);
for (String idC : orphans) {
if (new ConceptHelper().haveChildren(connect.getPoolConnexion(), idTheso, idC)) {
typeNode = "dossier";
} else {
typeNode = "fichier";
}
Term term = new TermHelper().getThisTerm(connect.getPoolConnexion(), idC, idTheso, langue);
if (term != null) {
value = term.getLexical_value() + " (id_" + idC + ")";
Concept temp = new ConceptHelper().getThisConcept(connect.getPoolConnexion(), idC, idTheso);
MyTreeNode mtn = new MyTreeNode(3, idC, idTheso, langue, "Orphan", null, null, typeNode, value, dynamicTreeNode);
if (typeNode.equals("dossier")) {
new DefaultTreeNode("fake", mtn);
}
}
}
}
Aggregations