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 ClassesModifier and TypeClassDescriptionclassThis 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 -
Method Summary
Modifier and TypeMethodDescriptionReturns the total number of PubMed Europe publications returned by a specific queryfindMatchingRecords(Item item) Finds records based on an item Delegates to one or more MetadataSource implementations based on the uri.findMatchingRecords(Query query) Finds records based on query object.getByPubmedEuropeID(String pubmedID, Integer start, Integer size) The string that identifies this import implementation.Get a single record from the PubMed Europe.Get a single record from the PubMed Europe.getRecords(String query, int start, int count) Find records matching a string query.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;getUrl()voidinit()Attempts to init a sessionReturns a list of PubMed Europe publication recordsvoidMethods inherited from class org.dspace.importer.external.service.AbstractImportMetadataSourceService
getGenerateQueryForItem, getMetadataFieldMapping, setGenerateQueryForItem, setMetadataFieldMapping, transformSourceRecordsMethods 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
-
Constructor Details
-
PubmedEuropeMetadataSourceServiceImpl
public PubmedEuropeMetadataSourceServiceImpl()
-
-
Method Details
-
getImportSource
Description copied from interface:MetadataSourceThe string that identifies this import implementation. Preferable a URI- Specified by:
getImportSourcein interfaceMetadataSource- Returns:
- the identifying uri
-
getRecord
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
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
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
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
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
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
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
Description 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
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
-
setUrl
-