Debian Codegraph @

whelp/Query_syntax.html

raw
1 <!-- $Id: Query_syntax.html,v 1.4 1999/04/29 16:17:03 fw Exp $ -->
2 <head>
3 <title>Query_syntax</title>
4 </head>
5
6 <BODY BGCOLOR=#ffffff>
7
8 <h2>Query_syntax</h2>
9
10 [Related to the query language: see help for <A
11 HREF="Query_By_Example.html">Query By Example</a>, the <A
12 HREF="Query_Builder.html">Query Builder</a>, the <A
13 HREF="Query.html">Query Command Window</a>, and the <A
14 HREF="Table_Maker.html">TableMaker</a>. The help for <A
15 HREF="KeySet.html"> KeySet windows</a> is also important. A more
16 formal description of the language is presented in the manual
17 doc/query_language_guide.tex]<p>
18
19 There are 3 general forms for a query command:<p>
20 <dl>
21 <dt><strong>Find Class xxxxxx</strong>
22 <dd>The command xxx is applied to all the keys of the (sub)Class.
23 Can be abbreviated as<br>
24 <pre>&gt;?Class xxxxxx</pre>
25 <dt><strong>Follow Tag xxxx</strong>
26 <dd>The command xxx is applied to all the keys following
27 tag in the objects of the active key set. Can be abbreviated as:<br>
28 <pre>&gt; Tag xxxxxx</pre>
29 <dt><strong>xxxx</strong>
30 <dd>The command xxx is applied directly to the active key set.
31 </dl>
32
33 A command is a logical expression evaluating to True or False. It is
34 applied to a key which is discarded or retained in a KeySet based on
35 the outcome of the test.<p>
36
37 A composite query can be formed by chaining a series of queries
38 separated by semicolons, in which case the active KeySet obtained
39 as intermediate results are passed into the next query.<p>
40
41 <h3>Operators</h3>
42
43 Recognised operators are, in order of increasing precedence:<p>
44
45 <pre>
46 $| SETOR
47 $&amp; SETOR
48 $^ SETXOR
49 $- SETMINUS
50 $= SETDEFINE (possibly bugged)
51 NEIGHBOURS
52 | OR
53 ^ XOR
54 & AND
55 ! NOT
56 # Jumps in constructed types.
57 &lt; to compare numbers
58 &lt;= &quot;
59 &gt; &quot;
60 &gt;= &quot;
61 = to compare numbers or match the left hand side
62 to a template, i.e a word with wild chars *, ?.
63 COUNT Counts the number of entries to right of its rhs
64 IS xxx Checks if name of the active object matches xxx
65 CLASS xxx Checks if active object belongs to (sub)class xxx
66 </pre>
67
68 Parentheses of all sorts "( [" can be used freely, but must be
69 matched.<p>
70
71 Words are matched to a tag or treated just as text. They must be put
72 in "double quotes" if they include spaces or any operator &, |, ^,
73 &lt;, &gt;, =, (, ), [, ], {, }. Wild cards can be used in words but
74 then they are not at present matched to tags except in a redirection.
75 Numbers are parsed as floats.<p>
76
77 <h3>Examples</h3>
78 <pre>
79 1. &gt;?Chrom*
80 </pre>
81 lists all chromosomes<p>
82 <pre>
83 2. &gt;?Author s* | a*
84 </pre>
85 lists all authors whose name begins with s or a<p>
86 <pre>
87 3. &gt;?Au* s?s* OR b*s*
88 </pre>
89 lists all authors whose name matches s?s* or b*s*<p>
90 <pre>
91 4. &gt;Pap* Journal = N* OR Year &gt; 1987
92 </pre>
93 Checks the previous list from query 3; redirect to papers then lists
94 all papers published in N(ature) or after 1987<p>
95 <pre>
96 5. Year = 1988
97 </pre>
98 Restricts to the papers of exactly 1987<p>
99 <pre>
100 6. &gt;?Gen* myo* Clone
101 </pre>
102 All the cloned myosin genes<p>
103 <pre>
104 7. Find Author IS "Sulston JE" ; &gt;Paper ; &gt;Author
105 </pre>
106 Finds all the coauthors of papers by Sulston.<p>
107
108 <h3>Subfields, Subtypes, and COUNT</h3>
109
110 <strong>Subfields</strong>: some tags are followed by more than one
111 value. To test the value of subfields you must first locate yourself
112 on the tag then move right from it using NEXT (move right) or HERE
113 (move here) for multiple checks. For example, suppose there were a
114 class "Chemical" with a tag identifying the boiling and freezing
115 points of compounds, e.g. for water:<p>
116
117 <pre>
118 B_F 100 0
119 </pre>
120
121 to identify compounds with boiling and freezing points in a
122 certain range:<p>
123
124 <pre>
125 Find Chemical B_F &gt;50 AND NEXT &gt;100 AND HERE &lt;250
126 </pre>
127 i.e., with boiling points &gt; 50 and freezing points between
128 100 and 250 degrees.<p>
129
130 This is clearly hard to read. Also, it will be evaluated at execution
131 left to right as it should only if the precedence of the operators
132 allows it. Be careful.<p>
133
134 <strong>Subtypes</strong>: to locate a tag in a subtytpe, you must
135 indicate the path using the operator #, for example:<p>
136
137 <pre>
138 Find Gene Lab AND NEXT#freezer = 4
139 </pre>
140
141 To find all the genes in your freezer number 4<p>
142
143 <strong>COUNT</strong>: this operator can be used to test the number
144 of entries. For example, to find prolific authors:<p>
145
146 <pre>
147 Find Author COUNT Paper &gt; 100
148 </pre>
149
150 to <a href="TOC.html">Table of Contents</a><p>
151
152 last edited: July 1994<p>
153
154 </BODY>