Modified:
/branches/hive-gwt-upgrade/hive-core/src/maui/vocab/Vocabulary.java
/branches/hive-gwt-upgrade/hive-core/src/maui/vocab/VocabularyH2.java
/branches/hive-gwt-upgrade/hive-core/src/maui/vocab/VocabularyJena.java
=======================================
--- /branches/hive-gwt-upgrade/hive-core/src/maui/vocab/Vocabulary.java Fri
Nov 18 17:30:24 2011
+++ /branches/hive-gwt-upgrade/hive-core/src/maui/vocab/Vocabulary.java Fri
Dec 16 13:49:27 2011
@@ -69,5 +69,7 @@
* @return a vector with ids related to the input id by a specified
relation
*/
public abstract Vector<String> getRelated(String id, String relation);
+
+ public abstract String getIDFromPrefLabel(String prefLabel);
}
=======================================
--- /branches/hive-gwt-upgrade/hive-core/src/maui/vocab/VocabularyH2.java
Mon Dec 5 08:07:30 2011
+++ /branches/hive-gwt-upgrade/hive-core/src/maui/vocab/VocabularyH2.java
Fri Dec 16 13:49:27 2011
@@ -168,6 +168,42 @@
}
}
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } finally {
+ try
+ {
+ if (con != null)
+ con.close();
+ if (ps != null)
+ ps.close();
+ if (ps2 != null)
+ ps2.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return id;
+ }
+
+ public String getIDFromPrefLabel(String prefLabel)
+ {
+ String id = null;
+ if (prefLabel != null) {
+ Connection con = null;
+ PreparedStatement ps = null;
+ PreparedStatement ps2 = null;
+ try {
+ String sql = "select id from vocabulary_enrev where value
= ?";
+
+ con = getConnection();
+ ps = con.prepareStatement(sql);
+ ps.setString(1, prefLabel);
+ ResultSet rs = ps.executeQuery();
+ while (rs.next())
+ id = rs.getString(1);
+
} catch (SQLException e) {
e.printStackTrace();
} finally {
=======================================
--- /branches/hive-gwt-upgrade/hive-core/src/maui/vocab/VocabularyJena.java
Fri Nov 18 17:30:24 2011
+++ /branches/hive-gwt-upgrade/hive-core/src/maui/vocab/VocabularyJena.java
Fri Dec 16 13:49:27 2011
@@ -637,5 +637,10 @@
}
return result.trim();
}
+
+ @Override
+ public String getIDFromPrefLabel(String prefLabel) {
+ return termIdIndex.get(prefLabel);
+ }
}