Difference between revisions of "Species Product Discovery: client library"
From Gcube Wiki
Lucio.lelii (Talk | contribs) m (→QueryManager API) |
Lucio.lelii (Talk | contribs) m (→Architecture) |
||
Line 24: | Line 24: | ||
* ''QueryManager'': helps clients submitting queries to the service; | * ''QueryManager'': helps clients submitting queries to the service; | ||
* ''OccurrencesManager'': helps clients retrieving occurrences and generating maps using retrieved occurrences; | * ''OccurrencesManager'': helps clients retrieving occurrences and generating maps using retrieved occurrences; | ||
− | * '' | + | * ''ClassificationManager'': help clients retrieving taxa and their ancestor by ids. |
* ''ExecutorManager'': helps clients submitting jobs to the system. | * ''ExecutorManager'': helps clients submitting jobs to the system. | ||
Line 90: | Line 90: | ||
− | === | + | === ClassificationManager API === |
+ | |||
+ | * <source lang="java">public Stream<TaxonomyItem> getTaxonChildrenById(final String id) throws UnsupportedPluginException,UnsupportedCapabilityException, InvalidIdentifierException;</source> | ||
+ | |||
+ | * <source lang="java">public Stream<TaxonomyItem> getTaxaByIds(final Stream<String> ids);</source> | ||
+ | |||
+ | * <source lang="java">public Stream<TaxonomyItem> getTaxonTreeById(final String id) throws UnsupportedPluginException,UnsupportedCapabilityException, InvalidIdentifierException;</source> | ||
+ | |||
+ | * <source lang="java">public Stream<TaxonomyItem> getSynonymsById(String id) throws UnsupportedPluginException,UnsupportedCapabilityException, InvalidIdentifierException;</source> | ||
=== ExecutorManager API === | === ExecutorManager API === |
Revision as of 20:55, 20 March 2013
This client library allows user to contact the Species Product Discovery Service.
The spd-client-library is a client library for the Species Product Discovery Service. It helps clients interacting with the service and processing result. This library is part of the FeatherWeight Stack.
Contents
Download
The maven coordinates to get the spd-client-library is:
<dependency> <groupId>org.gcube.data.spd</groupId> <artifactId>spd-client-library</artifactId> <version>${version}</version> </dependency>
the latest released version is : 2.0.0
the latest under development version is : 2.1.0-SNAPSHOT
Architecture
The spd-cl is divided into 4 parts:
- QueryManager: helps clients submitting queries to the service;
- OccurrencesManager: helps clients retrieving occurrences and generating maps using retrieved occurrences;
- ClassificationManager: help clients retrieving taxa and their ancestor by ids.
- ExecutorManager: helps clients submitting jobs to the system.
QueryManager API
-
public Stream<ResultElement> search(String query) throws InvalidQueryException, UnsupportedPluginException;
This method is used to submit a query to the system. The query MUST be defined following the SPQL grammar.
-
public List<PluginDescription> getPluginsDescription();
This method is used to get the list of all external repositories available in the infrastructure and their capabilities.
Example
ScopeProvider.instance.set(...); Manager manager = manager().withTimeout(3, TimeUnit.MINUTES).build(); //returns all taxa points for Melastomataceae found in CatalogueOfLife Stream<ResultElement> stream = manager.search(" 'Melastomataceae' as SN in CatalogueOfLife return Taxon"); while (stream.hasNext()){ TaxonomyItem ti = (TaxonomyItem) stream.next(); ... }
ScopeProvider.instance.set(...); Manager manager = manager().withTimeout(3, TimeUnit.MINUTES).build(); //returns all occurrence points for Melastomataceae found in all external repositories Stream<ResultElement> stream = manager.search(" 'Melastomataceae' as SN return Occurrence"); while (stream.hasNext()){ OccurrencePoint ti = (OccurrencePoint) stream.next(); ... }
ScopeProvider.instance.set(...); Manager manager = manager().withTimeout(3, TimeUnit.MINUTES).build(); //returns all results (grouped by DataSet) for common name Shark with at least 1 occurrence found in Obis or GBIF Stream<ResultElement> stream = manager.search(" 'Shark' as CN in Obis, GBIF return * HAVING Occurrence"); while (stream.hasNext()){ ResultItem ti = (ResultItem) stream.next(); ... }
ScopeProvider.instance.set(...); Manager manager = manager().build(); List<PluginDescription> pluginDescriptions = manager.getPluginsDescription(); for (PluginDescription description : pluginDescriptions){ System.out.println(description.getName()); ... }
OccurrenceManager API
ClassificationManager API
-
public Stream<TaxonomyItem> getTaxonChildrenById(final String id) throws UnsupportedPluginException,UnsupportedCapabilityException, InvalidIdentifierException;
-
public Stream<TaxonomyItem> getTaxaByIds(final Stream<String> ids);
-
public Stream<TaxonomyItem> getTaxonTreeById(final String id) throws UnsupportedPluginException,UnsupportedCapabilityException, InvalidIdentifierException;
-
public Stream<TaxonomyItem> getSynonymsById(String id) throws UnsupportedPluginException,UnsupportedCapabilityException, InvalidIdentifierException;