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, getApplicationStartedOrder, getLastModified, registerContribution, registerExtension, setLastModified, unregisterContribution, unregisterExtensionpublic void activate(ComponentContext context) throws Exception
ComponentThis method is called by the runtime when a component is activated.
activate in interface Componentactivate in class DefaultComponentcontext - the runtime contextException - if an error occurs during activationpublic void deactivate(ComponentContext context) throws Exception
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextException - if an error occurs during activationpublic void scheduleSerializationTask(SerializationTask task)
SemanticAnalysisServicescheduleSerializationTask in interface SemanticAnalysisServicetask - 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
SemanticAnalysisServicelaunchAnalysis in interface SemanticAnalysisServicerepositoryName - 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
SemanticAnalysisServicelaunchSynchronousAnalysis in interface SemanticAnalysisServicedoc - 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
SemanticAnalysisServicecreateLinks in interface SemanticAnalysisServiceClientException - 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
SemanticAnalysisServiceanalyze in interface SemanticAnalysisServicesession - 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
SemanticAnalysisServiceanalyze in interface SemanticAnalysisServicesession - 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
IOExceptionpublic ProgressStatus getProgressStatus(String repositoryName, DocumentRef docRef)
SemanticAnalysisServicegetProgressStatus in interface SemanticAnalysisServicepublic void clearProgressStatus(String repositoryName, DocumentRef docRef)
SemanticAnalysisServiceclearProgressStatus in interface SemanticAnalysisServicepublic boolean isActive()
isActive in interface SemanticAnalysisServiceCopyright © 2012 Nuxeo SA. All Rights Reserved.