public class SemanticAnalysisServiceImpl extends DefaultComponent implements SemanticAnalysisService
Modifier and Type | Class and Description |
---|---|
static class |
SemanticAnalysisServiceImpl.NamedThreadFactory
Creates non-daemon threads at normal priority.
|
Constructor and Description |
---|
SemanticAnalysisServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
List<OccurrenceGroup> |
analyze(CoreSession session,
DocumentModel doc)
Synchronous analysis of a document (without linking).
|
List<OccurrenceGroup> |
analyze(CoreSession session,
String textContent)
Synchronous analysis of pre-extracted text content (without linking).
|
String |
callSemanticEngine(String textContent,
String outputFormat,
int retry) |
void |
clearProgressStatus(String repositoryName,
DocumentRef docRef)
Mark the status as complete (even though the document might still be
under processing).
|
void |
createLinks(DocumentModel doc,
CoreSession session,
List<OccurrenceGroup> groups)
Save semantic links in the repository to materialize the occurrence
relationships between documents and entities
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
List<OccurrenceGroup> |
findStanbolEntityOccurrences(CoreSession session,
com.hp.hpl.jena.rdf.model.Model model) |
ProgressStatus |
getProgressStatus(String repositoryName,
DocumentRef docRef)
Return a description of the state of the analysis of the document or null
if no analysis is in progress.
|
boolean |
isActive() |
void |
launchAnalysis(String repositoryName,
DocumentRef docRef)
Launch an asynchronous analysis of a document.
|
void |
launchSynchronousAnalysis(DocumentModel doc,
CoreSession session)
Launch a analysis of a document and wait for the result before returning.
|
void |
scheduleSerializationTask(SerializationTask task)
Asynchronously save the result of the analyze using a dedicated
sequential thread.
|
applicationStarted, getAdapter, registerContribution, registerExtension, unregisterContribution, unregisterExtension
public void activate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void deactivate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void scheduleSerializationTask(SerializationTask task)
SemanticAnalysisService
scheduleSerializationTask
in interface SemanticAnalysisService
task
- a DTO that contains the reference of a document and the
occurrence groups to link to itpublic void launchAnalysis(String repositoryName, DocumentRef docRef) throws ClientException
SemanticAnalysisService
launchAnalysis
in interface SemanticAnalysisService
repositoryName
- the repository where the document is storeddocRef
- the reference of the document to analyzeClientException
- if a property of the document to analyze is not
available due to a database connection issue for instance.public void launchSynchronousAnalysis(DocumentModel doc, CoreSession session) throws ClientException, IOException
SemanticAnalysisService
launchSynchronousAnalysis
in interface SemanticAnalysisService
doc
- the document to analyzeClientException
- if a property of the document to analyze is not
available due to a database connection issue for instance.IOException
- if the connection to the analysis engine fails, or if
the engine it-self failsDereferencingException
- if the dereferencing process fails (e.g.
due to a network failure to a remote knowledge base).public void createLinks(DocumentModel doc, CoreSession session, List<OccurrenceGroup> groups) throws ClientException, IOException
SemanticAnalysisService
createLinks
in interface SemanticAnalysisService
ClientException
- if the document repository fails during local
lookups or saving entities and occurrencesIOException
- if the remote entity sources fail during lookupspublic List<OccurrenceGroup> findStanbolEntityOccurrences(CoreSession session, com.hp.hpl.jena.rdf.model.Model model) throws DereferencingException, ClientException
public List<OccurrenceGroup> analyze(CoreSession session, String textContent) throws IOException, ClientException
SemanticAnalysisService
analyze
in interface SemanticAnalysisService
session
- used to create in-memory prefetched entity suggestions if
available in the analysis engine response.textContent
- the text to send to the enginesIOException
- if the engine is not reachable or failsClientException
- if the in-memory creation of prefetched entity
suggestions fails (very unlikely)public List<OccurrenceGroup> analyze(CoreSession session, DocumentModel doc) throws IOException, ClientException
SemanticAnalysisService
analyze
in interface SemanticAnalysisService
session
- used to create in-memory prefetched entity suggestions if
available in the analysis engine response.doc
- the document to analyze (must be attached to an active core
session to extract the text content)IOException
- if the engine is not reachable or failsClientException
- if the text extraction failspublic String callSemanticEngine(String textContent, String outputFormat, int retry) throws IOException
IOException
public ProgressStatus getProgressStatus(String repositoryName, DocumentRef docRef)
SemanticAnalysisService
getProgressStatus
in interface SemanticAnalysisService
public void clearProgressStatus(String repositoryName, DocumentRef docRef)
SemanticAnalysisService
clearProgressStatus
in interface SemanticAnalysisService
public boolean isActive()
isActive
in interface SemanticAnalysisService
Copyright © 2011 Nuxeo SA. All Rights Reserved.