nl.telin.mymedia.db.util
Class HibernateUtil

java.lang.Object
  extended by nl.telin.mymedia.db.util.HibernateUtil

public class HibernateUtil
extends java.lang.Object


Constructor Summary
HibernateUtil()
           
 
Method Summary
static void filterCommonLemma()
          remove common lemma's from the database They have a count > doccount/2
static void filterSpecificLemma()
          remove rare lemma's from the database They have a count < doccount/1000
static Stats findDocCount()
           
static InfGainVector findInfGainVector(java.lang.Integer id)
          get infgainvector from an id
static InfGainVector findInfGainVector(Lemma l)
          get infgainvector from a lemma
static Lemma findLemma(java.lang.String lemma)
          return lemma from the database with given string
static java.util.Iterator getAllDocFreq(org.hibernate.Session s)
          Get all docFreq objects
static java.util.List<Lemma> getAllLemma()
          return all lemma's from the database
static int getLemmaCount()
          get the number of lemma's in the database
static org.hibernate.Session getSession()
          open a hibernate session
static void removeAll()
          remove all Lemma
static void removeAllInfGain()
          remove all InfGain
static InfGainVector saveCODistr(InfGainVector vector)
          save InfGainVector to database
static Lemma saveLemma(Lemma lf)
          save a lemma to the database
static void shutdown()
          close database
static void updateDocCount(Stats stats)
          Updste the document count.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateUtil

public HibernateUtil()
Method Detail

getSession

public static org.hibernate.Session getSession()
                                        throws org.hibernate.HibernateException
open a hibernate session

Returns:
a new session
Throws:
org.hibernate.HibernateException

shutdown

public static void shutdown()
                     throws org.hibernate.HibernateException
close database

Throws:
org.hibernate.HibernateException

getAllLemma

public static java.util.List<Lemma> getAllLemma()
return all lemma's from the database

Returns:
a list of Lemma

findLemma

public static Lemma findLemma(java.lang.String lemma)
return lemma from the database with given string

Parameters:
lemma - the lemma string
Returns:
Found lemma

saveLemma

public static Lemma saveLemma(Lemma lf)
save a lemma to the database

Parameters:
lf - The Lemma
Returns:
The saved Lemma with id

findDocCount

public static Stats findDocCount()
Returns:
the number of documents used to create the database. (Training size)

updateDocCount

public static void updateDocCount(Stats stats)
Updste the document count.

Parameters:
stats - Stats object with doccount, stats.name = documents

getAllDocFreq

public static java.util.Iterator getAllDocFreq(org.hibernate.Session s)
Get all docFreq objects

Parameters:
an - open hibernate session
Returns:
an iterator

removeAll

public static void removeAll()
remove all Lemma


removeAllInfGain

public static void removeAllInfGain()
remove all InfGain


saveCODistr

public static InfGainVector saveCODistr(InfGainVector vector)
save InfGainVector to database

Parameters:
vector - the vector
Returns:
the vector with id.

getLemmaCount

public static int getLemmaCount()
get the number of lemma's in the database

Returns:
the count

filterCommonLemma

public static void filterCommonLemma()
remove common lemma's from the database They have a count > doccount/2


filterSpecificLemma

public static void filterSpecificLemma()
remove rare lemma's from the database They have a count < doccount/1000


findInfGainVector

public static InfGainVector findInfGainVector(Lemma l)
get infgainvector from a lemma

Parameters:
Lemma -
Returns:
the vector

findInfGainVector

public static InfGainVector findInfGainVector(java.lang.Integer id)
get infgainvector from an id

Parameters:
id -
Returns:
the vector