public class DataStore
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INDEX_FOLDER_DIR |
static java.lang.String |
SENTENCE_PREFIX |
| Constructor and Description |
|---|
DataStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeSession()
Close the session with Hibernate.
|
void |
commitTransaction()
Commit changes through Hibernate.
|
java.util.List<Entity> |
getEntities(int sourceID)
Retrieve entities of a source document by source ID.
|
Entity |
getEntity(int entityID)
Retrieve a entity by entity ID.
|
Paragraph |
getParagraph(int paragraphID)
Retrieve a paragraph by paragraph ID.
|
Paragraph |
getParagraph(int sourceID,
int parentOrder)
Retrieve a paragraph by source ID and the order of the paragraph on the source.
|
java.util.List<Paragraph> |
getParagraphs(int sourceID)
Retrieve paragraphs of a source document by source ID.
|
Sentence |
getSentence(int sentenceID)
Retrieve a sentence by sentence ID.
|
Sentence |
getSentence(int paragraphID,
int parentOrder)
Retrieve a sentence by paragraph ID and the order of the sentence on the paragraph.
|
java.util.List<Sentence> |
getSentences(int paragraphID)
Retrieve sentences of a paragraph by paragraph ID.
|
org.hibernate.Session |
getSession()
Get the current session.
|
Source |
getSource(java.lang.Class classType,
int id)
Retrieve a source information by paragraph/entity ID and the class type.
|
Source |
getSource(int id)
Retrieve a source information by source ID.
|
Source |
getSource(java.lang.String url)
Retrieve a source information by source name.
|
void |
removeAllDataAndIndexes()
Remove all sentences, entities, paragraphs, and sources.
|
void |
removeEntitiesAndIndexes(java.util.List<Entity> entities)
Remove entities and the lucene index from the database.
|
void |
removeParagraphs(int sourceID)
Remove paragraphs of a source document by source ID.
|
void |
removeSentencesAndIndexes(java.util.List<Sentence> sentences)
Remove sentences and the lucene index from the database.
|
void |
removeSource(int sourceID)
Remove source information of a source document by source ID.
|
void |
rollbackTransaction()
Rollback a transaction with Hibernate.
|
java.util.List<Suggestion> |
searchEntity(java.lang.String userInput,
Preference prefs,
boolean autoTrigger)
Search a list of relevant entities by user input and user preferences.
|
java.util.List<Suggestion> |
searchText(java.lang.String userInput,
Preference prefs,
boolean autoTrigger)
Search a list of relevant suggestions by user input and user preferences.
|
void |
startSession()
Start a session with Hibernate.
|
void |
startTransaction()
Start a transaction with Hibernate.
|
int |
storeEntity(Entity entity)
Insert an entity object
|
int |
storeMetadata(Source metadata)
Insert a source object
|
int |
storeParagraph(Paragraph paragraph)
Insert a paragraph object
|
int |
storeSentence(Sentence sentence)
Insert a sentence object
|
public static final java.lang.String SENTENCE_PREFIX
public static final java.lang.String INDEX_FOLDER_DIR
public void removeAllDataAndIndexes()
public void removeParagraphs(int sourceID)
sourceID - source id of the source document.public void removeSentencesAndIndexes(java.util.List<Sentence> sentences)
sentences - list of Sentence object to be removed.public void removeEntitiesAndIndexes(java.util.List<Entity> entities)
entities - list of Entity object to be removed.public void removeSource(int sourceID)
sourceID - source ID of the source document.public Paragraph getParagraph(int paragraphID)
paragraphID - paragraph ID of the source document.public Paragraph getParagraph(int sourceID, int parentOrder)
sourceID - source ID of the source document.parentOrder - order of the paragraph on the source.public java.util.List<Paragraph> getParagraphs(int sourceID)
sourceID - source ID of the source document.public Entity getEntity(int entityID)
entityID - entity ID of the source document.public java.util.List<Entity> getEntities(int sourceID)
sourceID - source ID of the source document.public Sentence getSentence(int sentenceID)
sentenceID - sentence ID of the source document.public Sentence getSentence(int paragraphID, int parentOrder)
paragraphID - paragraph ID of the paragraph document.parentOrder - order of the sentence on the paragraph.public java.util.List<Sentence> getSentences(int paragraphID)
paragraphID - paragraph ID of the paragraph.public Source getSource(java.lang.String url)
url - source name of the source document.public Source getSource(java.lang.Class classType, int id)
classType - class type of Paragraph/Entity class.id - paragraph/entity ID.public Source getSource(int id)
id - source ID of the source document.public java.util.List<Suggestion> searchText(java.lang.String userInput, Preference prefs, boolean autoTrigger)
userInput - search string input from the user.prefs - user preferences of ACP.public java.util.List<Suggestion> searchEntity(java.lang.String userInput, Preference prefs, boolean autoTrigger)
userInput - search string input from the user.prefs - user preferences of ACP.public int storeEntity(Entity entity)
entity - entity object.public int storeMetadata(Source metadata)
metadata - source object.public int storeParagraph(Paragraph paragraph)
paragraph - paragraph object.public int storeSentence(Sentence sentence)
sentence - sentence object.public void startSession()
public org.hibernate.Session getSession()
public void closeSession()
public void startTransaction()
public void commitTransaction()
public void rollbackTransaction()