Entrez

Entrez query syntax

Nicknames based on the Entrez wrapper generally require the use of a special function. The Entrez wrapper must translate the SQL query into a query that the Entrez API will understand and not all elements of a standard SQL where clause can be so translated.

The schema description tables for datasets that make use of the Entrez wrapper include two extra columns:
  • The 'Q' column designates that a given field can be used when searching an Entrez table.
  • One queries such a column using a request containing a clause or clauses containing the 'CONTAINS' function, as in:
    SELECT * FROM NCBI.PMARTICLES 
    WHERE
       ( ENTREZ.CONTAINS( ARTICLETITLE, 'drosophila') = 1 )
    
    or
    SELECT AUTHORLIST, ARTICLETITLE FROM NCBI.PMARTICLES 
    WHERE
       ( ENTREZ.CONTAINS( ARTICLETITLE, 'drosophila') = 1 ) 
       AND
       ( ENTREZ.CONTAINS( AUTHORLIST, 'Kaufmann OR Ito') = 1 )
    
    or
    SELECT * FROM NCBI.GBSEQ 
    WHERE
       ( ENTREZ.CONTAINS( ORGANISM, 'drosophila') = 1 ) 
       AND 
       ( ENTREZ.CONTAINS( SEQLENGTH, '25' ) = 1 ) 
    
    or
    SELECT PRIMARYACCESSION, SEQLENGTH, DEFINITION, SEQUENCE 
    FROM NCBI.GBSEQ
    WHERE ( ENTREZ.CONTAINS( ORGANISM, 'HUMAN') = 1 ) 
          AND 
          ( ENTREZ.CONTAINS( DEFINITION, 'JAK3' ) = 1 )
    

    or

    SELECT PMID, AUTHORLIST, ARTICLETITLE FROM NCBI.PMARTICLES 
    WHERE
      ( ENTREZ.CONTAINS(AUTHORLIST, 'kaufmann OR ito') = 1 )
      AND
      (
         ( ENTREZ.CONTAINS (ARTICLETITLE, 'drosophila') = 1 )
         OR
         ( ENTREZ.CONTAINS(ABSTRACT, 'drosophila OR "fruit fly"') = 1 )
      )
    
  • The 'F' column designates for a given column that a query that uses the standard relational predicates '=' or 'IN' will be translated into a similar Entrez predicate. Otherwise, the predicate will be applied in the DB2 engine.
NOTE: If an Entrez nickname has no search terms designated in the 'Q' column, then information can only be retrieved from that nickname by joining it to another nickname that does have a search term listed in the 'Q' column.