public class LocalEntityServiceImpl extends DefaultComponent implements LocalEntityService
Modifier and Type | Field and Description |
---|---|
static String |
ENTITY_CONTAINER_PATH |
static String |
ENTITY_CONTAINER_TITLE |
static Log |
log |
Constructor and Description |
---|
LocalEntityServiceImpl() |
Modifier and Type | Method and Description |
---|---|
OccurrenceRelation |
addOccurrence(CoreSession session,
DocumentRef docRef,
DocumentRef entityRef,
String quoteContext,
int startPosInContext,
int endPosInContext)
Assert that an entity is referred to in the text content of a document.
|
OccurrenceRelation |
addOccurrences(CoreSession session,
DocumentRef docRef,
DocumentRef entityRef,
List<OccurrenceInfo> occurrences)
Add several occurrences of the same entity in to a given document
(occurring in several text snippets).
|
void |
addOccurrences(CoreSession session,
DocumentRef docRef,
EntitySuggestion entitySuggestion,
List<OccurrenceInfo> occurrences)
Add several occurrences of the same entity in to a given document
(occurring in several text snippets).
|
DocumentModel |
asLocalEntity(CoreSession session,
EntitySuggestion suggestion)
Ensure that the suggestion is local.
|
static String |
cleanupKeywords(String keywords) |
DocumentModel |
getEntityContainer(CoreSession session)
The entity container is a singleton container document where to create
the entities.
|
Set<String> |
getEntityTypeNames() |
DocumentModel |
getLinkedLocalEntity(CoreSession session,
URI remoteEntityURI)
Lookup the local repo to find a local entity that is linked to the given
remote entity URI through a owl:sameAs relationship.
|
DocumentModel |
getOccurrenceContainer(CoreSession session) |
OccurrenceRelation |
getOccurrenceRelation(CoreSession session,
DocumentRef docRef,
DocumentRef entityRef)
Find the occurrence relation instance linking a document to an entity.
|
OccurrenceRelation |
getOccurrenceRelation(CoreSession session,
DocumentRef docRef,
DocumentRef entityRef,
boolean createIfMissing) |
PageProvider<DocumentModel> |
getRelatedDocuments(CoreSession session,
DocumentRef entityRef,
String documentType)
Find entities of a given type related to a given document.
|
PageProvider<DocumentModel> |
getRelatedEntities(CoreSession session,
DocumentRef docRef,
String entityType)
Find entities of a given type related to a given document.
|
void |
removeOccurrences(CoreSession session,
DocumentRef docRef,
DocumentRef entityRef,
boolean forcePhysicalDelete)
Remove any occurrence information of an entity on the specified
documents.
|
List<DocumentModel> |
suggestDocument(CoreSession session,
String keywords,
String type,
int maxSuggestions)
Helper method to suggest documents by keyword match on fulltext content.
|
List<EntitySuggestion> |
suggestEntity(CoreSession session,
OccurrenceGroup group,
int maxSuggestions)
Helper method to suggest entities by keyword match on names.
|
List<EntitySuggestion> |
suggestEntity(CoreSession session,
String keywords,
String type,
int maxSuggestions)
Helper method to suggest entities by keyword match on names.
|
List<EntitySuggestion> |
suggestLocalEntity(CoreSession session,
String keywords,
String type,
int maxSuggestions)
Helper method to suggest local entities by keyword match on names.
|
activate, applicationStarted, deactivate, getAdapter, registerContribution, registerExtension, unregisterContribution, unregisterExtension
public static final Log log
public static final String ENTITY_CONTAINER_PATH
public static final String ENTITY_CONTAINER_TITLE
public DocumentModel getEntityContainer(CoreSession session) throws ClientException
LocalEntityService
getEntityContainer
in interface LocalEntityService
ClientException
public DocumentModel getOccurrenceContainer(CoreSession session) throws ClientException
ClientException
public OccurrenceRelation addOccurrence(CoreSession session, DocumentRef docRef, DocumentRef entityRef, String quoteContext, int startPosInContext, int endPosInContext) throws ClientException
LocalEntityService
addOccurrence
in interface LocalEntityService
session
- active session to the repository holding the document and
entitiesdocRef
- the id of the document referring to the entityentityRef
- the id of the entity referred to by the document snippetquoteContext
- the text snippet holding the expression pointing to
the entitystartPosInContext
- the position of the start of the expressionClientException
public OccurrenceRelation getOccurrenceRelation(CoreSession session, DocumentRef docRef, DocumentRef entityRef) throws ClientException
LocalEntityService
getOccurrenceRelation
in interface LocalEntityService
session
- the repository session where the document is storeddocRef
- the reference of the source documententityRef
- the reference of the targeted entityClientException
public void removeOccurrences(CoreSession session, DocumentRef docRef, DocumentRef entityRef, boolean forcePhysicalDelete) throws ClientException
LocalEntityService
removeOccurrences
in interface LocalEntityService
session
- active session to the repository holding the document and
entitiesdocRef
- the id of the document referring to the entityentityRef
- the id of the entity to remove occurrences forforcePhysicalDelete
- perform physical deletion (no trash)ClientException
- if the repository fails or the document does not
exist.public OccurrenceRelation getOccurrenceRelation(CoreSession session, DocumentRef docRef, DocumentRef entityRef, boolean createIfMissing) throws ClientException
ClientException
public void addOccurrences(CoreSession session, DocumentRef docRef, EntitySuggestion entitySuggestion, List<OccurrenceInfo> occurrences) throws ClientException, IOException
LocalEntityService
addOccurrences
in interface LocalEntityService
session
- active session to the repository holding the document and
entitiesentitySuggestion
- entity to dereference if not local, and link to
itoccurrences
- list of occurrence data to add to the relationshipIOException
- if dereferencing remote entity failsClientException
public OccurrenceRelation addOccurrences(CoreSession session, DocumentRef docRef, DocumentRef entityRef, List<OccurrenceInfo> occurrences) throws ClientException
LocalEntityService
addOccurrences
in interface LocalEntityService
session
- active session to the repository holding the document and
entitiesdocRef
- the id of the document referring to the entityentityRef
- the id of the entity referred to by the document snippetoccurrences
- list of occurrence data to add to the relationshipClientException
public PageProvider<DocumentModel> getRelatedDocuments(CoreSession session, DocumentRef entityRef, String documentType) throws ClientException
LocalEntityService
getRelatedDocuments
in interface LocalEntityService
session
- the repository session where the document is storedentityRef
- the reference of the entities to search documents fordocumentType
- the Nuxeo type of documents to lookup (can be null)ClientException
public PageProvider<DocumentModel> getRelatedEntities(CoreSession session, DocumentRef docRef, String entityType) throws ClientException
LocalEntityService
getRelatedEntities
in interface LocalEntityService
session
- the repository session where the document is storeddocRef
- the reference of the document to seach entities forentityType
- the Nuxeo type of entities to lookup (can be null)ClientException
public List<EntitySuggestion> suggestLocalEntity(CoreSession session, String keywords, String type, int maxSuggestions) throws ClientException
LocalEntityService
suggestLocalEntity
in interface LocalEntityService
keywords
- keywords to match the entity namestype
- the Nuxeo type name of entity to match (or null)maxSuggestions
- maximum number of entities to suggestClientException
public List<EntitySuggestion> suggestEntity(CoreSession session, OccurrenceGroup group, int maxSuggestions) throws DereferencingException, ClientException
LocalEntityService
suggestEntity
in interface LocalEntityService
session
- an active CoreSession used for local entity queries.group
- a group of occurrence pointing to a supposedly unique entity
to be resolved in the various local and remote entity sources.maxSuggestions
- maximum number of entities to suggestDereferencingException
ClientException
public List<EntitySuggestion> suggestEntity(CoreSession session, String keywords, String type, int maxSuggestions) throws ClientException, DereferencingException
LocalEntityService
suggestEntity
in interface LocalEntityService
session
- an active CoreSession used for local entity queries.keywords
- keywords to match the entity namestype
- the Nuxeo type name of entity to match (or null)maxSuggestions
- maximum number of entities to suggestClientException
DereferencingException
public List<DocumentModel> suggestDocument(CoreSession session, String keywords, String type, int maxSuggestions) throws Exception
LocalEntityService
suggestDocument
in interface LocalEntityService
keywords
- keywords to match the document namestype
- the Nuxeo type name of documents to match (or null)maxSuggestions
- maximum number of entities to suggestException
public Set<String> getEntityTypeNames() throws Exception
getEntityTypeNames
in interface LocalEntityService
Exception
- thrown if the TypeManager is not availablepublic DocumentModel getLinkedLocalEntity(CoreSession session, URI remoteEntityURI) throws ClientException
LocalEntityService
getLinkedLocalEntity
in interface LocalEntityService
remoteEntityURI
- the entity URI to lookup locallyClientException
- in case of problem accessing the local repopublic DocumentModel asLocalEntity(CoreSession session, EntitySuggestion suggestion) throws ClientException, IOException
LocalEntityService
asLocalEntity
in interface LocalEntityService
ClientException
IOException
Copyright © 2011 Nuxeo SA. All Rights Reserved.