/************************************************************/
/*                           nnmqry                         */
/************************************************************/

/* :SUMMARY: queries for objects whose name is a number
:PRIORITY: 3
:STATUS: ok
:FEATURE: 
The query "Find class pattern" retrieves the objects from class class
whose name matches pattern.
Beware if the pattern is a tag name. Then it finds all objects having
the tag called pattern.
:HISTORY: bug discovered by Natassa, both in query and tablemaker
:MODEL: 
?Individual genotypes latest ?Polym_system UNIQUE Int UNIQUE ?Allele UNIQUE ?Allele

?Polym_system    chromosome UNIQUE ?Chromosome XREF polym_system

:DATA: 
:RESULT: 
1. find a certain individual and get is polymorphic systems
   the : in the object name confuses new acedb versions.
   works in: ace35b        -- finds 53 objects
   fails in: ace950716, 4_7  (finds 0 objects)
1new. same as 1, but object name quoted, should work in new versions.
      works in: 4_8-990615
2. select the polymorphic systems that have a tag Chromosome followed by
   the value 17
   fails in: ace950716 -- finds no objects
   fails in: ace950829a4 -- finds no objects
   works in: ace35b  (selects 2 objects)
3. put the same query Chromosome = "17" into a table definition
   fails in: ace35b  (empty result)
             ace950716 (empty result)
             ace950829a4  (empty result)
2s. the same as 2, but with a more general pattern (Chromosome = "*17")
   works in: ace35b, ace950716  (selects 2 objects)
   fails in: ace950829a4  (selects no objects)
3s. same table definition as 3, but with query  (Chromosome = "*17")
   fails in: ace950716  (0 rows retrieved)
   fails in: ace950829a4  (0 rows retrieved)
   works in: ace35b; result:
"ceph:35:3";"euro:16C17:HAE III";
"ceph:35:3";"euro:AFM044xg3:CAn";
   works in: ace950522a4n
1q/2q/3q: since ace9511 onwards : is a special character, put quotes
        around the object name; correct result is
"ceph:35:3"	"euro:16C17:HAE III"	
"ceph:35:3"	"euro:AFM044xg3:CAn"	
//# 2 lines in this table
works in: ace951109

:SCRIPT: */
nnmqry: dbinit wspec.igd-fred   // numerical name queries
  tace
    parse: do parse $data/igd.indiv.ace    // prepare data
    1: do Query Find Individual ceph:35:3 ; Follow latest
    2: do Query Chromosome = "17"
             write
    3: do table $data/tables/igd.indiv.def
    1s: do Query Find Individual ceph:35:3 ; Follow latest
    2s: do Query Chromosome = "*17"
           write
    3s: do table $data/tables/igd.indiv2.def

    1q: do Query Find Individual "ceph:35:3" ; Follow latest
    2q: do Query Chromosome = 17
    3q: do table $data/tables/igd.indiv3.def
  exit