it.polito.elite.doseWS.kernel
Class AnnoRepositoryImpl

java.lang.Object
  extended byit.polito.elite.doseWS.kernel.AnnoRepositoryImpl
All Implemented Interfaces:
AnnoRepository

public class AnnoRepositoryImpl
extends java.lang.Object
implements AnnoRepository

The Annotation Repository implementation.
The annotation repository stores all semantic annotations relating documents, or specific substructures of them to ontology concepts. The repository has persistence on a DB by istantiating a proper DBWrapper.

Since:
11/2004
Version:
1.0
Author:
Dario Bonino Alessio Bosca Federico Pescarmona Michele Debandi
See Also:
class AnnoRepositoryImplTest for a testing class

Constructor Summary
AnnoRepositoryImpl()
          void constructor web-service ready
 
Method Summary
 int addAnnotation(java.lang.String fragmentURI, java.lang.String fragmentXpath, java.lang.String conceptURI, double weight, java.lang.String author, java.lang.String type)
          Add a single semantic annotation to the annotation repository
 int addAnnotations(java.lang.String fragmentURI, java.lang.String fragmentXpath, java.util.Hashtable conceptURIandWeights, java.lang.String author, java.lang.String type)
          Adds a series of semantic annotations corresponding to a conceptual spectra, to the annotation repository
 Spectrum getSpectrum(java.lang.String fragmentURI, java.lang.String fragmentXPath)
           
static void initAnnoRepository(java.lang.String endpoint, java.lang.String server, java.lang.String dbDriver, java.lang.String dbURI, java.lang.String dbUser, java.lang.String dbPassword)
          The static initialization method for the annotation repository, sets all parameters required by the repository during the runtime phase
static boolean isReady()
          Flag for checking if the service has been correctly initialized
 int remove(java.lang.String uri, java.lang.String xPath, java.lang.String author)
          Removes a semantic annotation from the repository
 java.util.Vector reverseSearch(java.lang.String fragmentURI, java.lang.String fragmentXPath)
           
 java.util.Vector searchByTopic(java.util.Vector topicURIs, java.util.Vector authors, java.lang.String type, double strict)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnoRepositoryImpl

public AnnoRepositoryImpl()
void constructor web-service ready

Method Detail

initAnnoRepository

public static void initAnnoRepository(java.lang.String endpoint,
                                      java.lang.String server,
                                      java.lang.String dbDriver,
                                      java.lang.String dbURI,
                                      java.lang.String dbUser,
                                      java.lang.String dbPassword)
                               throws java.lang.Exception
The static initialization method for the annotation repository, sets all parameters required by the repository during the runtime phase

Parameters:
endpoint - the endpoint of the Expander Web Service
server - the server onto which the Expander runs
dbDriver - the db driver that should be used by the internal DBWrapper
dbURI - the uri of the DB server
dbUser - the username for accessing the db
dbPassword - the password for the db, if required
Throws:
java.lang.Exception - The error that caused the initialization failure

isReady

public static boolean isReady()
Flag for checking if the service has been correctly initialized

Returns:
the status of the service, true if initialized otherwise false

remove

public int remove(java.lang.String uri,
                  java.lang.String xPath,
                  java.lang.String author)
           throws java.lang.Exception
Removes a semantic annotation from the repository

Specified by:
remove in interface AnnoRepository
Parameters:
uri - the uri of the document for which annotations should be removed
xPath - the xPath of the specific substructure for which annotations must be removed
author - the author of the annotations
Returns:
0 if the annotations have been removed successfully
Throws:
java.lang.Exception
See Also:
AnnoRepository.remove(java.lang.String, java.lang.String, java.lang.String)

addAnnotations

public int addAnnotations(java.lang.String fragmentURI,
                          java.lang.String fragmentXpath,
                          java.util.Hashtable conceptURIandWeights,
                          java.lang.String author,
                          java.lang.String type)
                   throws java.lang.Exception
Adds a series of semantic annotations corresponding to a conceptual spectra, to the annotation repository

Specified by:
addAnnotations in interface AnnoRepository
Parameters:
fragmentURI - the URI of the document for which annotations should be added in the repository
conceptURIandWeights - the Hashtable containing the concepts and their relative weights that compare into semantic annotations to be stored
author - the men or device that produced the annotations
type - the type of annotations
Throws:
java.lang.Exception
See Also:
AnnoRepository.addAnnotations(java.lang.String, java.lang.String, java.util.Hashtable, java.lang.String, java.lang.String)

addAnnotation

public int addAnnotation(java.lang.String fragmentURI,
                         java.lang.String fragmentXpath,
                         java.lang.String conceptURI,
                         double weight,
                         java.lang.String author,
                         java.lang.String type)
                  throws java.lang.Exception
Add a single semantic annotation to the annotation repository

Specified by:
addAnnotation in interface AnnoRepository
Parameters:
fragmentURI - the URI of the document for which the annotation should be added in the repository
conceptURI - the URI of the concept to which the annotation is referred
weight - the weight value associated to the annotation
author - the men or device that produced the annotation
type - the type of the annotation
Throws:
java.lang.Exception
See Also:
AnnoRepository.addAnnotation(java.lang.String, java.lang.String, java.lang.String, double, java.lang.String, java.lang.String)

searchByTopic

public java.util.Vector searchByTopic(java.util.Vector topicURIs,
                                      java.util.Vector authors,
                                      java.lang.String type,
                                      double strict)
Specified by:
searchByTopic in interface AnnoRepository

reverseSearch

public java.util.Vector reverseSearch(java.lang.String fragmentURI,
                                      java.lang.String fragmentXPath)
Specified by:
reverseSearch in interface AnnoRepository

getSpectrum

public Spectrum getSpectrum(java.lang.String fragmentURI,
                            java.lang.String fragmentXPath)