use of mom.trd.opentheso.bdd.helper.nodes.NodeFusion in project opentheso by miledrousset.
the class SelectedTerme method majNoticeZ3950.
private void majNoticeZ3950() {
// ResourceBundle bundlePref = getBundlePref();
if (user.getNodePreference().isZ3950actif()) {
try {
Properties p = new Properties();
p.put("CollectionDataSourceClassName", "com.k_int.util.Repository.XMLDataSource");
p.put("RepositoryDataSourceURL", "file:" + user.getNodePreference().getPathNotice1());
p.put("XSLConverterConfiguratorClassName", "com.k_int.IR.Syntaxes.Conversion.XMLConfigurator");
p.put("ConvertorConfigFile", user.getNodePreference().getPathNotice2());
Searchable federated_search_proxy = new HeterogeneousSetOfSearchable();
federated_search_proxy.init(p);
try {
IRQuery e = new IRQuery();
// e.collections = new Vector<String>();
e.collections.add(user.getNodePreference().getCollectionAdresse());
e.hints.put("default_element_set_name", "f");
e.hints.put("small_set_setname", "f");
e.hints.put("record_syntax", "unimarc");
e.query = new PrefixString((new StringBuilder("@attrset bib-1 @attr 1=Koha-Auth-Number \"")).append(AsciiUtils.convertNonAscii("" + idC)).append("\"").toString());
SearchTask st = federated_search_proxy.createTask(e, null);
st.evaluate(5000);
nbNotices = st.getTaskResultSet().getFragmentCount();
st.destroyTask();
federated_search_proxy.destroy();
for (NodeFusion nf : getFusions()) {
if (nf.getIdConcept1().equals(idC)) {
String idTe = new TermHelper().getIdTermOfConcept(connect.getPoolConnexion(), nf.getIdConcept2(), idTheso);
nbNotices += getNotice(idTe);
}
}
} catch (TimeoutExceededException | SearchException srch_e) {
// srch_e.printStackTrace();
}
urlNotice = user.getNodePreference().getNoticeUrl();
try {
// String url_notices = "http://catalogue.frantiq.fr/cgi-bin/koha/opac-search.pl?idx=su%2Cwrdl&q=terme&idx=kw&idx=kw&sort_by=relevance&do=OK";
urlNotice = urlNotice.replace("terme", URLEncoder.encode("" + idC, user.getNodePreference().getUrlEncode()));
} catch (UnsupportedEncodingException ex) {
// Logger.getLogger(SelectedTerme.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (Exception e) {
}
}
}
use of mom.trd.opentheso.bdd.helper.nodes.NodeFusion in project opentheso by miledrousset.
the class ConceptHelper method getConceptFusion.
public ArrayList<NodeFusion> getConceptFusion(HikariDataSource ds, String idConcept, String idLang, String idThesaurus) {
Connection conn;
Statement stmt;
ResultSet resultSet;
ArrayList<NodeFusion> nf = new ArrayList<>();
try {
// Get connection from pool
conn = ds.getConnection();
try {
stmt = conn.createStatement();
try {
String query = "select id_concept1, id_concept2 from concept_fusion where" + " concept_fusion.id_thesaurus = '" + idThesaurus + "'" + " AND (concept_fusion.id_concept1 = '" + idConcept + "'" + " OR concept_fusion.id_concept2 = '" + idConcept + "')";
stmt.executeQuery(query);
resultSet = stmt.getResultSet();
while (resultSet.next()) {
NodeFusion n = new NodeFusion();
n.setIdConcept1(resultSet.getString("id_concept1"));
n.setIdConcept2(resultSet.getString("id_concept2"));
n.setLexicalValue1(getLexicalValueOfConcept(ds, resultSet.getString("id_concept1"), idThesaurus, idLang));
n.setLexicalValue2(getLexicalValueOfConcept(ds, resultSet.getString("id_concept2"), idThesaurus, idLang));
nf.add(n);
}
} finally {
stmt.close();
}
} finally {
conn.close();
}
} catch (SQLException sqle) {
// Log exception
log.error("Error while getting fusion of Concept : " + idConcept, sqle);
}
return nf;
}
Aggregations