|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.dfki.lt.hog.database.AnnotationDatabase
de.dfki.lt.hog.database.XMLDBAnnotationDatabase
public class XMLDBAnnotationDatabase
The XML:DB-based database interface for the Deepthought annotation. This class uses concepts like session and document (identified via Strings and implemented as collections in the database) that are used to structure the Deepthought annotation database. In the Deepthought annotation database, a session comprises a collection of documents. A document itself is a collection (!) of XML annotations that are produced from different modules and can be accessed via annotation layer names.
For performance reasons, it is highly recommended to make use of the addIndex() method for every collection that is added.
Constructor Summary | |
---|---|
XMLDBAnnotationDatabase()
The method openDatabase() should be called after this empty constructor. |
|
XMLDBAnnotationDatabase(java.lang.String databaseLocation)
|
Method Summary | |
---|---|
boolean |
addAnnotation(java.lang.String sessionID,
java.lang.String docName,
java.lang.String layerName,
org.w3c.dom.Node domTree)
Adds XML annotation (as DOM tree) for specified document. |
boolean |
addAnnotation(java.lang.String sessionID,
java.lang.String docName,
java.lang.String layerName,
java.lang.String annotation)
Adds XML annotation (as String) for the specified document. |
boolean |
addDocument(java.lang.String sessionID,
java.lang.String docName)
Adds a new, empty annotation collection for a document. |
boolean |
addIndex(java.lang.String sessionID,
java.lang.String indexID,
java.lang.String indexPattern)
Adds an index to the annotation database. |
boolean |
addSession(java.lang.String sessionID)
Adds a new session to the annotation database. |
boolean |
addSession(java.lang.String sessionID,
org.w3c.dom.Node metaInfo)
Adds a new session to the annotation database. |
boolean |
addSession(java.lang.String sessionID,
java.lang.String metaInfo)
Adds a new session to the annotation database. |
void |
closeDatabase()
Closes the annotation database . |
boolean |
deleteDocument(java.lang.String sessionID,
java.lang.String docName)
delete an annotation collection for a document |
boolean |
deleteSession(java.lang.String sessionID)
Deletes a session from the annotation database. |
org.w3c.dom.Node |
getAnnotationAsDOM(java.lang.String sessionID,
java.lang.String docName,
java.lang.String layerName)
Returns the annotation for the specified document and layer as DOM tree. |
java.lang.String |
getAnnotationAsString(java.lang.String sessionID,
java.lang.String docName,
java.lang.String layerName)
Returns the annotation for the specified document and layer as String. |
boolean |
openDatabase(java.lang.String connectString)
Opens the annotation database. |
java.lang.String |
readFileFromDisk(java.io.File file,
java.lang.String charset)
Auxiliary method that reads an XML file into a String object. |
long |
XUpdateQuery(java.lang.String sessionID,
java.lang.String query)
Executes an XUpdate `query'. |
Methods inherited from class de.dfki.lt.hog.database.AnnotationDatabase |
---|
getDatabaseLocation, setDatabaseLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLDBAnnotationDatabase()
public XMLDBAnnotationDatabase(java.lang.String databaseLocation)
databaseLocation
- an XML:DB URI like "xmldb:xindice://localhost:8080/db"Method Detail |
---|
public boolean openDatabase(java.lang.String connectString)
AnnotationDatabase
openDatabase
in class AnnotationDatabase
connectString
- optional connection String for the underlying database
public void closeDatabase()
AnnotationDatabase
closeDatabase
in class AnnotationDatabase
public boolean addSession(java.lang.String sessionID, java.lang.String metaInfo)
AnnotationDatabase
addSession
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)metaInfo
- metainformation associated with the session (XML String)
public boolean addSession(java.lang.String sessionID)
AnnotationDatabase
addSession
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)
public boolean addSession(java.lang.String sessionID, org.w3c.dom.Node metaInfo)
AnnotationDatabase
addSession
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)metaInfo
- metainformation associated with the session (DOM object)
public boolean deleteSession(java.lang.String sessionID)
AnnotationDatabase
deleteSession
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)
public boolean addDocument(java.lang.String sessionID, java.lang.String docName)
addDocument
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)docName
- identifier of the added document (must be unique within the same session collection)
AnnotationDatabase.addDocument(java.lang.String, java.lang.String)
public boolean deleteDocument(java.lang.String sessionID, java.lang.String docName)
deleteDocument
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)docName
- identifier of the document to be deleted
AnnotationDatabase.deleteDocument(java.lang.String, java.lang.String)
public boolean addAnnotation(java.lang.String sessionID, java.lang.String docName, java.lang.String layerName, java.lang.String annotation)
AnnotationDatabase
addAnnotation
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)docName
- identifier of the document for which annotation is to be addedlayerName
- name of the layer type (such as Tokens, NamedEntities etc.) of the annotationannotation
- the XML annotation as String
public boolean addAnnotation(java.lang.String sessionID, java.lang.String docName, java.lang.String layerName, org.w3c.dom.Node domTree)
AnnotationDatabase
addAnnotation
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)docName
- identifier of the document for which annotation is to be addedlayerName
- name of the layer type (such as Tokens, NamedEntities etc.) of the annotationdomTree
- the XML annotation as DOM object
public java.lang.String getAnnotationAsString(java.lang.String sessionID, java.lang.String docName, java.lang.String layerName)
AnnotationDatabase
getAnnotationAsString
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)docName
- identifier of the document for which annotation is to be addedlayerName
- name of the layer type (such as Tokens, NamedEntities etc.) of the annotation
public org.w3c.dom.Node getAnnotationAsDOM(java.lang.String sessionID, java.lang.String docName, java.lang.String layerName)
AnnotationDatabase
getAnnotationAsDOM
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)docName
- identifier of the document for which annotation is to be retrievedlayerName
- name of the layer type (such as Tokens, NamedEntities etc.) of the annotation
public long XUpdateQuery(java.lang.String sessionID, java.lang.String query)
AnnotationDatabase
XUpdateQuery
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)query
- the XUpdate query (XML syntax) as String
public boolean addIndex(java.lang.String sessionID, java.lang.String indexID, java.lang.String indexPattern)
AnnotationDatabase
addIndex
in class AnnotationDatabase
sessionID
- the session Identifier (single token starting with a non-numerical character)indexID
- name of the index (must be unique within a collection)indexPattern
- pattern for the indexer to be generated
public java.lang.String readFileFromDisk(java.io.File file, java.lang.String charset) throws java.io.IOException
file
- The file to be opened
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |