de.unidu.is.annotation.rework.frontend
Class AnnotationService

java.lang.Object
  extended byde.unidu.is.annotation.rework.frontend.AnnotationService

public class AnnotationService
extends java.lang.Object

AnnotationService.java Annotation service (Frontend) Methods to add, get, modify and remove annotations Converts ServiceObjects into OWL serializations and calls methods of the backend annotation service

Author:
Marc Lechtenfeld

Field Summary
protected  BackendAnnotationService backendService
          Connection to the backend annotation service
 
Constructor Summary
AnnotationService(BackendAnnotationService backendServiceConnection)
          Creates a new AnnotationService object.
 
Method Summary
 void addAnnotation(Annotation annotation)
          Saves the specified annotation
 void addAnnotationType(Person user, java.lang.String parentType, java.lang.String typeName)
          Adds a user-defined annotation type to the ontology
protected  void addSubClasses(JenaModel model, CheckNode rootNode, java.lang.String subclass)
          Adds all subclasses of subclasses to the node rootNode
 Annotation getAnnotation(AnnotationUri annotation)
          Returns the annotation with the specified URI
 Annotation getAnnotation(java.lang.String annotationUri)
          Returns the specified annotation
 CheckNode getAnnotationOntology(Person user)
          Returns the root element of the annotation (type) ontology
 java.util.List getAnnotations(Annotation annotationPattern, java.lang.String fulltext, int numDocs)
          Returns all annotations, which satisfy the specified conditions.
 java.util.List getAnnotationThread(AnnotableObject annotableObject)
          Returns the annotation thread of the specified annotable object
 java.lang.String getLocalName(java.lang.String uri)
          Returns the local name of the specified URI
 void removeAnnotation(Person user, Annotation annotation)
          Deletes the specified annotation
 void saveAnnotation(Person user, Annotation annotation)
          Saves the annotation (the modifications).
 void setBackendService(BackendAnnotationService backendServiceConnection)
          Sets the backend annotation service component
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backendService

protected BackendAnnotationService backendService
Connection to the backend annotation service

Constructor Detail

AnnotationService

public AnnotationService(BackendAnnotationService backendServiceConnection)
                  throws ModelException
Creates a new AnnotationService object.

Throws:
ModelException - if a model error occurs
Method Detail

setBackendService

public void setBackendService(BackendAnnotationService backendServiceConnection)
Sets the backend annotation service component

Parameters:
backendServiceConnection - backend annotation service component

getLocalName

public java.lang.String getLocalName(java.lang.String uri)
Returns the local name of the specified URI

Parameters:
uri - URI
Returns:
local name of the URI

addAnnotation

public void addAnnotation(Annotation annotation)
                   throws ModelException
Saves the specified annotation

Parameters:
annotation - annotation to save
Throws:
ModelException - if a model error occurs

getAnnotation

public Annotation getAnnotation(java.lang.String annotationUri)
                         throws ModelException,
                                ResourceNotFoundException
Returns the specified annotation

Parameters:
annotationUri - URI of the annotation
Returns:
Instance of Annotation
Throws:
ModelException
ResourceNotFoundException

getAnnotation

public Annotation getAnnotation(AnnotationUri annotation)
                         throws ModelException,
                                ResourceNotFoundException
Returns the annotation with the specified URI

Parameters:
annotation - AnnotationUri
Returns:
Instance of Annotation
Throws:
ModelException
ResourceNotFoundException
See Also:
getAnnotation(AnnotationUri)

getAnnotationThread

public java.util.List getAnnotationThread(AnnotableObject annotableObject)
                                   throws ModelException
Returns the annotation thread of the specified annotable object

Parameters:
annotableObject - Annotable Object
Returns:
List of Annotations
Throws:
ModelException

getAnnotations

public java.util.List getAnnotations(Annotation annotationPattern,
                                     java.lang.String fulltext,
                                     int numDocs)
                              throws ModelException
Returns all annotations, which satisfy the specified conditions. A condition will be ignored, if the parameter is null.

Parameters:
annotationPattern - Annotation pattern
fulltext - Terms (in title or text)
numDocs - Maximum number of results
Returns:
List of Annotation instances
Throws:
ModelException - if a model error occurs

saveAnnotation

public void saveAnnotation(Person user,
                           Annotation annotation)
                    throws ModelException,
                           NoPermissionException
Saves the annotation (the modifications).

Parameters:
user - Person, who wants to save the annotation
annotation - Modified annotation
Throws:
ModelException
NoPermissionException

removeAnnotation

public void removeAnnotation(Person user,
                             Annotation annotation)
                      throws ModelException,
                             ResourceNotFoundException,
                             NoPermissionException
Deletes the specified annotation

Parameters:
user - Person, who wants to delete the annotation
annotation - Annotation to delete
Throws:
ModelException
ResourceNotFoundException
NoPermissionException

addSubClasses

protected void addSubClasses(JenaModel model,
                             CheckNode rootNode,
                             java.lang.String subclass)
                      throws ModelException
Adds all subclasses of subclasses to the node rootNode

Parameters:
rootNode - Node
subclass - Subclass
Throws:
ModelException

addAnnotationType

public void addAnnotationType(Person user,
                              java.lang.String parentType,
                              java.lang.String typeName)
                       throws ModelException,
                              ResourceNotFoundException
Adds a user-defined annotation type to the ontology

Parameters:
user - User
parentType - parent type of the new type
typeName - new type (name)
Throws:
ModelException
ResourceNotFoundException

getAnnotationOntology

public CheckNode getAnnotationOntology(Person user)
                                throws ModelException
Returns the root element of the annotation (type) ontology

Parameters:
user - Person (user)
Returns:
root element of the annotation type tree
Throws:
ModelException