Here you can find the source of getSenatorProp(String topicId)
private static TreeMap<String, Double> getSenatorProp(String topicId)
//package com.java2s; //License from project: Apache License import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import java.util.HashMap; import java.util.TreeMap; public class Main { private static final HashMap<String, String> docId_actorId = new HashMap<String, String>(); private static TreeMap<String, Double> getSenatorProp(String topicId) { Connection c = null;//from w w w. j a v a2 s . c om Statement stmt = null; TreeMap<String, Double> output = new TreeMap<String, Double>(); try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:dbs/newpress.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); stmt = c.createStatement(); ResultSet rs = stmt .executeQuery("SELECT DOCID, TOPICPROP from DOC_TOPIC where TOPICID = '" + topicId + "';"); String docId = ""; String topicProp = ""; String actorId = ""; while (rs.next()) { docId = rs.getString("DOCID"); topicProp = rs.getString("TOPICPROP"); actorId = docId_actorId.get(docId); if (output.containsKey(actorId)) { output.put(actorId, output.get(actorId) + Double.parseDouble(topicProp)); } else { output.put(actorId, Double.parseDouble(topicProp)); } } rs.close(); stmt.close(); c.close(); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } return output; } }