Difference between revisions of "SPQL: SPecies Query Language"

From Gcube Wiki
Jump to: navigation, search
(Synopsis)
(SPQL 2.0)
Line 49: Line 49:
 
<code>
 
<code>
 
  CN ''common name'' RESOLVE [ WITH '''''datasource''''' [, ...] ] [EXPAND [ WITH '''''datasource''''' [, ...] ] ]
 
  CN ''common name'' RESOLVE [ WITH '''''datasource''''' [, ...] ] [EXPAND [ WITH '''''datasource''''' [, ...] ] ]
  SN ''scientific name'' [ RESOLVE [ WITH '''''datasource''''' [, ...] ] ] [EXPAND [ WITH '''''datasource''''' [, ...] ] ]
+
  SN ''scientific name'' [EXPAND [ WITH '''''datasource''''' [, ...] ] ]
 
</code>
 
</code>
  
Line 55: Line 55:
 
The ''Search by'' statement retrieves all available elements from the species service.
 
The ''Search by'' statement retrieves all available elements from the species service.
 
The general processing of ''Search by'' is as follows:
 
The general processing of ''Search by'' is as follows:
 +
# All the '''''term''''' are elaborated depending on the specified type:
 +
#* '''CN''' case:
 +
#** all the specified ''common name''s are mapped into ''scientific name''s using the specified datasources or all the available if no one as been specified
 +
#** if the EXPAND clause is specified the ''scientific name''s are expanded using the synonyms provided by the specified datasources or using all the available datasources if no one as been specified
 +
#* '''SN''' case:
 +
#** if the EXPAND clause is specified all the specified ''scientific name''s  are expanded using the synonyms provided by the specified datasources or using all the available datasources if no one as been specified
 
#
 
#

Revision as of 14:52, 3 April 2013

SPQL is a language used to query the Species Product Discovery Service

Grammar

query: terms (IN identifiers)? (WHERE expressions)? (RETURN returnExpression)?
 
terms: term  (',' term)*
 
term: words AS (('ScientificName'|'SN') | ('CommonName'|'CN'))
 
words: word (',' word)*
 
word : STRING
 
identifiers:  identifier (',' identifier)*
 
identifier: ID
 
expressions: expression (AND expression)*
 
expression:	(bc=boundCondition | dateCondition)
 
boundCondition: ('lowerBound' | 'upperBound') IS coordinate
 
dateCondition: ('fromDate' | 'toDate') IS date
 
date: INT '/' INT '/' INT
 
coordinate: FLOAT ',' FLOAT
 
returnExpression: '*' (havingExpression)? | 'Occurrence' | 'Taxon'
 
havingExpression: HAVING 'Occurrence' | 'Taxon'

SPQL 2.0

Synopsis

SEARCH BY term [, ...]
      [ IN datasource [, ...] ]
      [ WHERE condition [AND condition] ]
      [ RETURN {PRODUCT | OCCURRENCE | TAXON} ]
      [ HAVING having expression ]

Where term can be one of:

CN common name RESOLVE [ WITH datasource [, ...] ] [EXPAND [ WITH datasource [, ...] ] ]
SN scientific name [EXPAND [ WITH datasource [, ...] ] ]

Description

The Search by statement retrieves all available elements from the species service. The general processing of Search by is as follows:

  1. All the term are elaborated depending on the specified type:
    • CN case:
      • all the specified common names are mapped into scientific names using the specified datasources or all the available if no one as been specified
      • if the EXPAND clause is specified the scientific names are expanded using the synonyms provided by the specified datasources or using all the available datasources if no one as been specified
    • SN case:
      • if the EXPAND clause is specified all the specified scientific names are expanded using the synonyms provided by the specified datasources or using all the available datasources if no one as been specified