Class PubmedEuropeMetadataSourceServiceImpl
- java.lang.Object
-
- org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
-
- org.dspace.importer.external.service.AbstractImportMetadataSourceService<org.jdom2.Element>
-
- org.dspace.importer.external.pubmedeurope.PubmedEuropeMetadataSourceServiceImpl
-
- All Implemented Interfaces:
MetadataSource,QuerySource
public class PubmedEuropeMetadataSourceServiceImpl extends AbstractImportMetadataSourceService<org.jdom2.Element> implements QuerySource
Implements a data source for querying PubMed Europe- Author:
- Mykhaylo Boychuk (mykhaylo.boychuk at 4science.com)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classPubmedEuropeMetadataSourceServiceImpl.FindMatchingRecordCallableThis class is a Callable implementation to search PubMed Europe entries using author, title and year.
-
Field Summary
-
Fields inherited from class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
error, exceptionHandlersMap, interRequestTime, lastRequest, lock, maxRetry, operationId, retry, warning
-
-
Constructor Summary
Constructors Constructor Description PubmedEuropeMetadataSourceServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integercount(String query)Returns the total number of PubMed Europe publications returned by a specific queryCollection<ImportRecord>findMatchingRecords(Item item)Finds records based on an item Delegates to one or more MetadataSource implementations based on the uri.Collection<ImportRecord>findMatchingRecords(Query query)Finds records based on query object.List<ImportRecord>getByPubmedEuropeID(String pubmedID, Integer start, Integer size)StringgetImportSource()The string that identifies this import implementation.ImportRecordgetRecord(String id)Get a single record from the PubMed Europe.ImportRecordgetRecord(Query query)Get a single record from the PubMed Europe.Collection<ImportRecord>getRecords(String query, int start, int count)Find records matching a string query.Collection<ImportRecord>getRecords(Query query)Find records based on a object query.intgetRecordsCount(String query)Find the number of records matching a query;intgetRecordsCount(Query query)Find the number of records matching a query;StringgetUrl()voidinit()Attempts to init a sessionList<ImportRecord>search(String query, Integer size, Integer start)Returns a list of PubMed Europe publication recordsList<ImportRecord>search(String title, String author, int year, int count, int start)voidsetUrl(String url)-
Methods inherited from class org.dspace.importer.external.service.AbstractImportMetadataSourceService
getGenerateQueryForItem, getMetadataFieldMapping, setGenerateQueryForItem, setMetadataFieldMapping, transformSourceRecords
-
Methods inherited from class org.dspace.importer.external.service.components.AbstractRemoteMetadataSource
getError, getExceptionHandler, getMaxRetry, getOperationId, getRetry, getWarning, handleException, initExceptionHandlers, retry, setError, setInterRequestTime, setMaxRetry, setWarning, throwSourceException, throwSourceExceptionHook
-
-
-
-
Method Detail
-
getImportSource
public String getImportSource()
Description copied from interface:MetadataSourceThe string that identifies this import implementation. Preferable a URI- Specified by:
getImportSourcein interfaceMetadataSource- Returns:
- the identifying uri
-
getRecord
public ImportRecord getRecord(String id) throws MetadataSourceException
Get a single record from the PubMed Europe.- Specified by:
getRecordin interfaceQuerySource- Parameters:
id- Identifier for the record- Returns:
- The first matching record
- Throws:
MetadataSourceException- If the underlying methods throw any exception.
-
getRecordsCount
public int getRecordsCount(String query) throws MetadataSourceException
Find the number of records matching a query;- Specified by:
getRecordsCountin interfaceQuerySource- Parameters:
query- a query string to base the search on.- Returns:
- the sum of the matching records over this import source
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
getRecordsCount
public int getRecordsCount(Query query) throws MetadataSourceException
Find the number of records matching a query;- Specified by:
getRecordsCountin interfaceQuerySource- Parameters:
query- A query string to base the search on.- Returns:
- The sum of the matching records over this import source
- Throws:
MetadataSourceException- If the underlying methods throw any exception.
-
getRecords
public Collection<ImportRecord> getRecords(String query, int start, int count) throws MetadataSourceException
Find records matching a string query.- Specified by:
getRecordsin interfaceQuerySource- Parameters:
query- A query string to base the search on.start- Offset to start atcount- Number of records to retrieve.- Returns:
- A set of records. Fully transformed.
- Throws:
MetadataSourceException- If the underlying methods throw any exception.
-
getRecords
public Collection<ImportRecord> getRecords(Query query) throws MetadataSourceException
Find records based on a object query.- Specified by:
getRecordsin interfaceQuerySource- Parameters:
query- A query object to base the search on.- Returns:
- A set of records. Fully transformed.
- Throws:
MetadataSourceException- If the underlying methods throw any exception.
-
getRecord
public ImportRecord getRecord(Query query) throws MetadataSourceException
Get a single record from the PubMed Europe.- Specified by:
getRecordin interfaceQuerySource- Parameters:
query- A query matching a single record- Returns:
- The first matching record
- Throws:
MetadataSourceException- If the underlying methods throw any exception.
-
findMatchingRecords
public Collection<ImportRecord> findMatchingRecords(Query query) throws MetadataSourceException
Finds records based on query object.- Specified by:
findMatchingRecordsin interfaceQuerySource- Parameters:
query- A query object to base the search on.- Returns:
- A collection of import records.
- Throws:
MetadataSourceException- If the underlying methods throw any exception.
-
findMatchingRecords
public Collection<ImportRecord> findMatchingRecords(Item item) throws MetadataSourceException
Description copied from interface:QuerySourceFinds records based on an item Delegates to one or more MetadataSource implementations based on the uri. Results will be aggregated.- Specified by:
findMatchingRecordsin interfaceQuerySource- Parameters:
item- an item to base the search on- Returns:
- a collection of import records. Only the identifier of the found records may be put in the record.
- Throws:
MetadataSourceException- if the underlying methods throw any exception.
-
init
public void init() throws ExceptionDescription copied from class:AbstractRemoteMetadataSourceAttempts to init a session- Specified by:
initin classAbstractRemoteMetadataSource- Throws:
Exception- on generic exception
-
getByPubmedEuropeID
public List<ImportRecord> getByPubmedEuropeID(String pubmedID, Integer start, Integer size) throws IOException, org.apache.http.HttpException
- Throws:
IOExceptionorg.apache.http.HttpException
-
count
public Integer count(String query) throws URISyntaxException, org.apache.http.client.ClientProtocolException, IOException, org.jaxen.JaxenException
Returns the total number of PubMed Europe publications returned by a specific query- Parameters:
query- A keyword or combination of keywords to be searched- Throws:
URISyntaxException- If URI syntax errororg.apache.http.client.ClientProtocolException- The client protocol exceptionIOException- If IO errororg.jaxen.JaxenException- If Xpath evaluation failed
-
search
public List<ImportRecord> search(String title, String author, int year, int count, int start) throws IOException
- Throws:
IOException
-
search
public List<ImportRecord> search(String query, Integer size, Integer start) throws IOException
Returns a list of PubMed Europe publication records- Parameters:
query- A keyword or combination of keywords to be searchedsize- The number of search results per pagestart- Start number for the acquired search result list- Throws:
IOException- If IO error
-
getUrl
public String getUrl()
-
setUrl
public void setUrl(String url)
-
-