it.polito.elite.doseWS.wrappers
Interface DBWrapper

All Known Implementing Classes:
DBWrapperImpl

public interface DBWrapper

Declared here are the methods defined for accessing the underlying database structure for H-DOSE. See DBWRapperImpl for more informations.

Version:
1
Author:
Michele Debandi

Method Summary
 int countAnnotations()
          counts the total numer of inserted annotations
 int countAnnotations(java.lang.String topicURI)
          counts the total number of annotations given the topic they refer to
 java.lang.String dbStatus()
          last database error
 java.lang.Integer deleteAuthor(java.lang.Integer idauthor)
          delete a topic from the database, given the key
 java.lang.Integer deleteAuthor(java.lang.String author)
          delete a topic from the database, given the topicURI
 int deleteSpectrum(java.lang.String uri, java.lang.String xPath, java.lang.String author, java.lang.String type)
          Delete an annotation block
 java.lang.Integer deleteSynset(java.lang.Integer i)
          Elimina un Synset, dato topicUri e linguaggio nella tabella sysnset
 java.lang.Integer deleteSynset(java.lang.String topicURI, java.lang.String lang)
          Elimina un Synset, dato topicUri e linguaggio nella tabella sysnset
 java.lang.Integer deleteSynset(Synset S)
          elimina un synset, data la chiave
 java.lang.Integer deleteTopic(java.lang.Integer idtopic)
          delete a topic from the database, given the key
 java.lang.Integer deleteTopic(java.lang.String topic)
          delete a topic from the database, given the topicURI
 java.lang.Integer deleteType(java.lang.Integer idtype)
          delete a topic from the database, given the key
 java.lang.Integer deleteType(java.lang.String anntype)
          delete a topic from the database, given the topicURI
 int deleteXSpectrum(java.lang.String uri, java.lang.String xPath, java.lang.String author, java.lang.String type)
          Deleete an (expanded) annotation block
 Spectrum getSpectrum(java.lang.String uri, java.lang.String xPath, java.lang.String author, java.lang.String type)
          restituisce il blocco di annotazioni riferite ad un frammento (autore e tipo sono facoltativi)
 TopicCoverage getTopicsCoverage()
          Per poter implementare le politiche di autogestione della copertura concettuale delle annotazioni occorre introdurre un metodo getTopicsCoverage
 Spectrum getXSpectrum(java.lang.String uri, java.lang.String xPath, java.lang.String author, java.lang.String type)
          restituisce il blocco di annotazioni raffinate riferite ad un frammento (autore e tipo sono facoltativi)
 java.lang.Integer insertAuthor(java.lang.String author)
          inserts an annotation author into the database
 int insertSpectrum(Spectrum spectrum)
          Insert an annotaions' block gotten from a spectrum
 java.lang.Integer insertSynset(java.lang.String topicURI, java.lang.String lang)
          Inserisce una riga nella tabella sysnset
 java.lang.Integer insertTopic(java.lang.String topic)
          inserts a topic into the database
 java.lang.Integer insertType(java.lang.String anntype)
          inserts an annotation type into the database
 int insertXSpectrum(Spectrum spectrum)
          Inserts a block of refined annotations
 java.lang.Integer loadSynset(Synset S)
          loads a new synset, or add some mwords to an existing synset.
 java.util.Vector searchXByTopic(java.util.Vector topicURIs, int level)
          restituisce gli spettri in cui compaiono valori non nulli per i topic specificati
 java.lang.Integer selectAuthor(java.lang.String author)
          return the key of a given annotation author
 java.lang.Integer selectSynset(java.lang.String topicURI, java.lang.String lang)
          Cerca una riga nella tabella sysnset
 java.lang.Integer selectTopic(java.lang.String topic)
          return the key of a given topic
 java.lang.Integer selectType(java.lang.String type)
          return the key of a given annotation type
 int updateSpectrum(Spectrum spectrum)
          updates the given Spectrum
 java.lang.Integer updateSynset(Synset S, boolean addMode)
          uptates the synset values
 

Method Detail

insertSpectrum

public int insertSpectrum(Spectrum spectrum)
                   throws java.lang.Exception
Insert an annotaions' block gotten from a spectrum

Parameters:
spectrum - The Spectrum that will be inserted into the DB
Returns:
A positive integer (number of inserted rows) for succesfull completion, otherwise a negative integer
Throws:
java.lang.Exception - For database errors

insertXSpectrum

public int insertXSpectrum(Spectrum spectrum)
                    throws java.lang.Exception
Inserts a block of refined annotations

Parameters:
spectrum - The Spectrum that will be inserted into the DB
Returns:
A positive integer (number of inserted rows) for succesfull completion, otherwise a negative integer
Throws:
java.lang.Exception - For database errors

getSpectrum

public Spectrum getSpectrum(java.lang.String uri,
                            java.lang.String xPath,
                            java.lang.String author,
                            java.lang.String type)
restituisce il blocco di annotazioni riferite ad un frammento (autore e tipo sono facoltativi)

Parameters:
uri - uri del frammento
xPath - xpath del frammento
author - autore
type - e tipo
Returns:
ritorna uno spetto

getXSpectrum

public Spectrum getXSpectrum(java.lang.String uri,
                             java.lang.String xPath,
                             java.lang.String author,
                             java.lang.String type)
restituisce il blocco di annotazioni raffinate riferite ad un frammento (autore e tipo sono facoltativi)

Parameters:
uri - uri del frammento
xPath - xpath del frammento
author - autore
type - e tipo
Returns:
ritorna uno spetto

updateSpectrum

public int updateSpectrum(Spectrum spectrum)
                   throws java.lang.Exception
updates the given Spectrum

Parameters:
spectrum - Spectrum to update
Returns:
the number of row inserted
Throws:
java.lang.Exception - in case of DB errors

deleteSpectrum

public int deleteSpectrum(java.lang.String uri,
                          java.lang.String xPath,
                          java.lang.String author,
                          java.lang.String type)
Delete an annotation block

Parameters:
uri - uri for the annotations
xPath - xpath for the annotations
author - author of the annotation (or an empty String)
type - type of the Annotation (or an Empty String)
Returns:
< 0 for errors; > 0 for succesful operation

deleteXSpectrum

public int deleteXSpectrum(java.lang.String uri,
                           java.lang.String xPath,
                           java.lang.String author,
                           java.lang.String type)
Deleete an (expanded) annotation block

Parameters:
uri - uri for the annotations
xPath - xpath for the annotations
author - author of the annotation (or an empty String)
type - type of the Annotation (or an Empty String)
Returns:
< 0 for errors; > 0 for succesful operation

dbStatus

public java.lang.String dbStatus()
last database error

Returns:
last error's descriprion

searchXByTopic

public java.util.Vector searchXByTopic(java.util.Vector topicURIs,
                                       int level)
restituisce gli spettri in cui compaiono valori non nulli per i topic specificati

Parameters:
level - il numero minimo di match per ogni topic restituito
topicURIs - vettore di topic su cui fare la ricerca
Returns:
restituisce un vettore di spettri che corrispondono ai parametri

selectAuthor

public java.lang.Integer selectAuthor(java.lang.String author)
                               throws java.lang.Exception
return the key of a given annotation author

Parameters:
author - the elelement to retrieve
Returns:
null if the argument doesn'exist,else the key value
Throws:
java.lang.Exception - in error case

selectType

public java.lang.Integer selectType(java.lang.String type)
                             throws java.lang.Exception
return the key of a given annotation type

Parameters:
type - the element type to retrieve
Returns:
null if the argument doesn'exist,else the key value
Throws:
java.lang.Exception - in error case

selectTopic

public java.lang.Integer selectTopic(java.lang.String topic)
                              throws java.lang.Exception
return the key of a given topic

Parameters:
topic - tpoic to insert
Returns:
null if the argument doesn'exist,else the key value
Throws:
java.lang.Exception - in error case

insertAuthor

public java.lang.Integer insertAuthor(java.lang.String author)
                               throws java.lang.Exception
inserts an annotation author into the database

Parameters:
author - the author to insert
Returns:
null in error, Integer success
Throws:
java.lang.Exception - in error case

insertType

public java.lang.Integer insertType(java.lang.String anntype)
                             throws java.lang.Exception
inserts an annotation type into the database

Parameters:
anntype - the annotation type to insert
Returns:
null in error, Integer success
Throws:
java.lang.Exception - in error case

insertTopic

public java.lang.Integer insertTopic(java.lang.String topic)
                              throws java.lang.Exception
inserts a topic into the database

Parameters:
topic - tpoic to insert
Returns:
null in error, Integer success
Throws:
java.lang.Exception - in error case

deleteAuthor

public java.lang.Integer deleteAuthor(java.lang.Integer idauthor)
                               throws java.lang.Exception
delete a topic from the database, given the key

Parameters:
idauthor - the id of the element to delete
Returns:
null in error, else 1
Throws:
java.lang.Exception - in error

deleteAuthor

public java.lang.Integer deleteAuthor(java.lang.String author)
                               throws java.lang.Exception
delete a topic from the database, given the topicURI

Parameters:
author - the element to delete
Returns:
null null in error, Integer (1) in success
Throws:
java.lang.Exception - in error

deleteType

public java.lang.Integer deleteType(java.lang.Integer idtype)
                             throws java.lang.Exception
delete a topic from the database, given the key

Parameters:
idtype - the element to delete
Returns:
null in error, else 1
Throws:
java.lang.Exception - in error

deleteType

public java.lang.Integer deleteType(java.lang.String anntype)
                             throws java.lang.Exception
delete a topic from the database, given the topicURI

Parameters:
anntype - the element to delete
Returns:
null null in error, Integer (1) in success
Throws:
java.lang.Exception - in error

deleteTopic

public java.lang.Integer deleteTopic(java.lang.Integer idtopic)
                              throws java.lang.Exception
delete a topic from the database, given the key

Parameters:
idtopic - key of the elemet do delete
Returns:
null in error, else 1
Throws:
java.lang.Exception - in error

deleteTopic

public java.lang.Integer deleteTopic(java.lang.String topic)
                              throws java.lang.Exception
delete a topic from the database, given the topicURI

Parameters:
topic - elemet to delete
Returns:
null null in error, Integer (1) in success
Throws:
java.lang.Exception - in error

getTopicsCoverage

public TopicCoverage getTopicsCoverage()
                                throws java.lang.Exception
Per poter implementare le politiche di autogestione della copertura concettuale delle annotazioni occorre introdurre un metodo getTopicsCoverage

Returns:
TopicCoverage il risultato e` un vettore di coppie topicURI/frequenza, dove la frequenza ? il numero di annotazioni memorizzate riferite ad un dato topic, ordinato in modo crescente (prima le frequenze piu` basse e cosi` via...). Viene restituito null in caso di errore
Throws:
java.lang.Exception - In caso di errore spara una eccezione

deleteSynset

public java.lang.Integer deleteSynset(java.lang.Integer i)
                               throws java.lang.Exception
Elimina un Synset, dato topicUri e linguaggio nella tabella sysnset

Parameters:
i - chiave da eliminare
Returns:
null in caso di errore altrimenti il valore della chiave in caso di successo
Throws:
java.lang.Exception - eccezione in caso di errore

deleteSynset

public java.lang.Integer deleteSynset(java.lang.String topicURI,
                                      java.lang.String lang)
                               throws java.lang.Exception
Elimina un Synset, dato topicUri e linguaggio nella tabella sysnset

Parameters:
topicURI - l'uri a cui si riferisce il synset
lang - lingua del synset
Returns:
null in caso di errore altrimenti il valore della chiave in caso di successo
Throws:
java.lang.Exception - si` spara un'eccezione

deleteSynset

public java.lang.Integer deleteSynset(Synset S)
                               throws java.lang.Exception
elimina un synset, data la chiave

Parameters:
S - da eliminare (ATTENZIONE: non elimina solo quello che si trova nelle occour ....)
Returns:
null in caso di errore
Throws:
java.lang.Exception - In caso di problemi al DB spara un'eccezione

insertSynset

public java.lang.Integer insertSynset(java.lang.String topicURI,
                                      java.lang.String lang)
                               throws java.lang.Exception
Inserisce una riga nella tabella sysnset

Parameters:
topicURI - l'uri a cui si riferisce il synset
lang - lingua del synset
Returns:
null in caso di errore Integer (il valore della chiave della tabella) in caso di successo
Throws:
java.lang.Exception - in caso di errori...

selectSynset

public java.lang.Integer selectSynset(java.lang.String topicURI,
                                      java.lang.String lang)
                               throws java.lang.Exception
Cerca una riga nella tabella sysnset

Parameters:
topicURI - l'uri a cui si riferisce il synset
lang - lingua del synset
Returns:
null in caso di errore altrimenti il valore della chiave in caso di successo
Throws:
java.lang.Exception - for db errors

loadSynset

public java.lang.Integer loadSynset(Synset S)
                             throws java.lang.Exception
loads a new synset, or add some mwords to an existing synset. If an mword is already present, the operation will fail. updateSynset, does not fail (but is slower).

Parameters:
S - Synset to insert/extend
Returns:
null, if there is some error
Throws:
java.lang.Exception - for db problems/mword already present

updateSynset

public java.lang.Integer updateSynset(Synset S,
                                      boolean addMode)
                               throws java.lang.Exception
uptates the synset values

Parameters:
addMode - false for substitution of frequency, true for adding
S - Synset to insert/update
Returns:
null for error, else an Integer
Throws:
java.lang.Exception - for database errors

countAnnotations

public int countAnnotations()
                     throws java.lang.Exception
counts the total numer of inserted annotations

Returns:
the number of annotation, a negative number in case of error
Throws:
java.lang.Exception - in case of database error

countAnnotations

public int countAnnotations(java.lang.String topicURI)
                     throws java.lang.Exception
counts the total number of annotations given the topic they refer to

Parameters:
topicURI - the topic to check
Returns:
the number of annotation, a negative number in case of error
Throws:
java.lang.Exception - in case of seroius DB problems