1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html><head><!-- InstanceBegin template="/Templates/sru-template.dwt" codeOutsideHTMLIsLocked="false" --><!-- InstanceBeginEditable name="doctitle" --><title>Common Query Language (SRU: Search and Retrieve via URL - Standards, Library of Congress)</title><!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" -->
8 <meta name="keywords" content="sru srw protocol search retrieve via url search retrieve web services standards library of congress common query language cql">
9 <meta name="description" content="Common Query Language: SRU (Search/Retrieve via URL) is a standard search protocol for Internet search queries, utilizing CQL (Common Query Language), a standard query syntax for representing queries. SRW (Search Retrieve Web Service) is a companion protocol to SRU."><!-- InstanceEndEditable -->
11 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
12 <link href="cql_files/sru.css" rel="stylesheet" type="text/css">
13 <script type="text/javascript" src="cql_files/triggerParams.js"></script><script type="text/javascript" src="cql_files/stdLauncher.js"></script><script type="text/javascript">Poll();</script></head><body alink="#660000" link="#663300" text="#333333" vlink="#996633">
17 <div id="top-left"><a href="http://www.loc.gov/" class="white">The Library
18 of Congress</a><span class="white-text"> » </span><a href="http://www.loc.gov/library/" class="white">Librarians,
19 Archivists</a><span class="white-text"> »</span> <a href="http://www.loc.gov/standards/" class="white">Standards</a></div>
21 <form action="http://search.loc.gov:8765/query.html" accept-charset="utf-8" name="seek1" method="get">
22 <input name="col" value="loc" type="hidden">
23 <input name="sc" value="0" type="hidden">
24 <input name="ws" value="0" type="hidden">
25 <input name="la" value="en" type="hidden">
26 <input name="qm" value="0" type="hidden">
27 <input name="st" value="1" type="hidden">
28 <input name="nh" value="10" type="hidden">
29 <input name="lk" value="1" type="hidden">
30 <input name="rf" value="0" type="hidden">
31 <input name="oq" value="" type="hidden">
32 <input name="si" value="0" type="hidden">
33 <input name="rq" value="0" type="hidden">
34 <input name="qc" value="" type="hidden">
35 <select name="qp" tabindex="1" class="drop-box">
36 <option value="url:/standards/sru/" selected="selected">SRU Pages</option>
37 <option value="url:/standards/">All Standards Pages</option>
38 <option value="">All Library Pages</option>
40 <input name="qt" id="keyword" size="16" value="" tabindex="2" class="drop-box" type="text">
41 <input class="button" id="search_button" name="search_button" value="SEARCH" tabindex="3" type="submit">
45 <h1 class="graphic"><img src="cql_files/sru-title.gif" alt="SRU: Search/Retrieve via URL - SRU Version 1.1 - 13th February 2004" height="60" width="740"></h1>
47 <div id="top-bread"> <a href="http://www.loc.gov/standards/sru/index.html">Home</a> >> <!-- InstanceBeginEditable name="topbreadcrumb" --><span class="selected">CQL</span><!-- InstanceEndEditable --></div>
48 <div id="body"> <!-- InstanceBeginEditable name="content" -->
49 <h1>Common Query Language</h1>
50 <p><strong>CQL <a href="http://www.loc.gov/standards/sru/version.html">Version</a> 1.1</strong> <em>13th February
52 <p class="box"><a href="#sample">Sample Queries</a> - <a href="#bnf">BNF</a> - <a href="#rules"> Rules</a> - <a href="#features"> Features</a> - <a href="#conformance">Conformance</a>
53 - <a href="#context"> Context Sets</a> - <a href="http://www.loc.gov/standards/sru/cql/cql-context-set.html"> the
54 CQL Context Set</a> - <a href="#relations">Relations</a> <a href="#relmodifiers">Modifiers</a> - <a href="#masking">Masking</a> - <a href="#resultset">Result
55 Sets</a> - <a href="#proximity">Proximity</a> - Tutorial (temporarily unavailable)</p>
56 <p>CQL is a formal language for representing queries to information retrieval
57 systems such as web indexes, bibliographic catalogs and museum collection
58 information. The design objective is that queries be human readable and
59 writable, and that the language be intuitive while maintaining the expressiveness
60 of more complex languages.</p>
61 <p>Traditionally, query languages have fallen into two camps: Powerful, expressive
62 languages, not easily readable nor writable by non-experts (e.g. SQL, PQF,
63 and XQuery);or simple and intuitive languages not powerful enough to express
64 complex concepts (e.g. CCL and google). CQL tries to combine simplicity
65 and intuitiveness of expression for simple, every
66 day queries, with the richness of more expressive languages to accommodate
67 complex concepts when necessary.</p>
69 <h3><a name="sample"></a> Sample Queries</h3>
70 <p>Following are examples of simple CQL queries. These are all self-explanatory: </p>
71 <p class="box2">dinosaur<br>
72 "complete dinosaur"<br>
73 title = "complete dinosaur"<br>
74 title exact "the complete dinosaur"<br>
76 dinosaur and "ice age"<br>
77 dinosaur not reptile <br>
78 dinosaur and bird or dinobird <br>
79 (bird or dinosaur) and (feathers or scales)<br>
80 "feathered dinosaur" and (yixian or jehol) <br>
81 publicationYear < 1980 <br>
82 lengthOfFemur > 2.4<br>
83 bioMass >= 100 </p>
84 <p>The following are a bit more complicated:</p>
85 <table align="center" border="1" cellpadding="5" cellspacing="0" width="95%">
87 <th scope="col" bgcolor="#fff9e5" width="50%">Example</th>
88 <th scope="col" bgcolor="#fff9e5" width="50%">Explanation</th>
91 <td scope="row"><p>title all "complete dinosaur"</p></td>
92 <td><p>Title contains all of the words: "complete", and "dinosaur"</p></td>
95 <td scope="row"><p><br>
96 title any "dinosaur bird reptile"</p></td>
97 <td><p>Title contains any of the words: "dinosaur", "bird",
101 <td scope="row"><p>(caudal or dorsal) prox vertebra</p></td>
102 <td><p><em>A proximity query: either "caudal" or "dorsal" near
108 <p>ribs prox/distance<=5 chevrons </p>
110 <td><p><em>A more specific proximity query: "ribs" within
111 5 words of "chevrons"</em></p>
115 <td scope="row"><p>ribs prox/unit=sentence chevrons</p>
118 <p><em>"ribs" in the same sentence as "chevrons"</em></p>
123 <p>ribs prox/distance>0/unit=paragraph chevrons </p>
125 <td><p><em>"ribs" and "chevrons" occuring
126 in the same document in different paragraphs</em></p>
130 <td scope="row"><p>subject any/relevant "fish frog"</p>
132 <td><p><em>find documents that would seem relevant
133 either to "fish" or "frog"</em></p>
137 <td scope="row"><p>subject any/rel.lr "fish frog"</p>
139 <td><p><em>Same as previous, but use a specific relevance
140 algorithm (linear regression)</em></p>
145 <h2><a name="bnf"></a>Formal Definition: CQL BNF</h2>
146 <p>Following is the Backus Naur Form (BNF) definition for CQL. ["::=" represents
148 <table border="0" cellpadding="5" cellspacing="0" width="95%">
151 <td scope="row" align="right" width="24%">
154 <td width="1%"><p>::=</p>
156 <td width="75%"><p>prefixAssignment cqlQuery | scopedClause </p>
160 <td scope="row" align="right">
161 <p>prefixAssignment</p>
165 <td><p>'>' prefix '=' uri | '>' uri</p>
169 <td scope="row" align="right">
174 <td><p>scopedClause booleanGroup searchClause | searchClause</p>
178 <td scope="row" align="right">
183 <td><p>boolean [modifierList]</p>
187 <td scope="row" align="right" valign="top">
190 <td valign="top"><p>::=</p>
192 <td><p>'and' | 'or' | 'not' | 'prox'</p>
196 <td scope="row" align="right" valign="top">
199 <td valign="top"><p>::=</p>
202 <p>'(' cqlQuery ')'<br>
203 | index relation searchTerm<br>
208 <td scope="row" align="right">
213 <td><p>comparitor [modifierList]</p>
217 <td scope="row" align="right">
222 <td><p>comparitorSymbol | namedComparitor</p>
226 <td scope="row" align="right">
227 <p>comparitorSymbol</p>
231 <td><p>'=' | '>' | '<' | '>=' | '<=' | '<>'</p>
235 <td scope="row" align="right">
236 <p>namedComparitor</p>
240 <td><p>identifier</p>
244 <td scope="row" align="right">
249 <td><p>modifierList modifier<strong> | </strong>modifier</p>
253 <td scope="row" align="right">
258 <td><p>'/' modifierName [comparitorSymbol modifierValue] </p>
262 <td scope="row" align="right"><p align="right">prefix, uri, modifierName, modifierValue, searchTerm,
265 <td valign="top"><p>::=</p>
267 <td valign="top"><p>term</p>
271 <td scope="row" align="right">
276 <td><p>identifier | 'and' | 'or' | 'not' | 'prox'</p>
280 <td scope="row" align="right" valign="top">
283 <td valign="top"><p>::=</p>
285 <td><p>charString1 | charString2</p>
289 <td scope="row" align="right" valign="top">
290 <p><em>charString1</em></p>
292 <td valign="top"><p>:=</p>
294 <td><p><em>Any sequence of characters that does not include any of
295 the following:</em> </p>
296 <blockquote><em>whitespace<br>
297 </em><em>( (open parenthesis )</em><br>
298 <em>) (close parenthesis)</em><br>
301 </em><em>></em><br>
302 <em>'"' (double quote)<br>
303 </em><em>/</em></blockquote> <p><em> If the final sequence is a reserved word, that token is
304 returned instead. Note that '.' (period) may be included, and
305 a sequence of digits is also permitted. Reserved words are
306 'and', 'or', 'not', and 'prox' (case insensitive). When a reserved
307 word is used in a search term, case is preserved. </em> </p>
311 <td scope="row" align="right" valign="top">
312 <p><em>charString2</em></p>
314 <td valign="top"><p>:=</p>
316 <td><p><em>Double quotes enclosing a sequence of any characters except
317 double quote (unless preceded by backslash (\)). Backslash escapes
318 the character following it. The resultant value includes all
319 backslash characters except those releasing a double quote (this
320 allows other systems to interpret the backslash character). The
321 surrounding double quotes are not included. </em></p>
327 <h2><a name="rules"></a>General Rules</h2>
330 <p><strong>CQL Query<br>
331 </strong>A CQL query is essentially a search clause, or multiple search
332 clauses connected by boolean operators. (In addition it may include
333 prefix assignments which assign short names to known contexts. See <a href="#context">context
337 <p><strong>Search Clause</strong><br>
338 A search clause consists of an index, relation, and search term, or a search
339 term alone. Thus every search clause has a search term, but both the
340 index and relation may be omitted - the clause must include either
341 both or neither of the index and relation. (Note that the use of the "index" concept
342 in CQL is not intended to have any implementation implications; it does
343 not imply the presence of a physical index.)</p>
344 <p> Examples: <br>
345 Index/relation/search term: <strong>title
347 Search term only: <strong>cat</strong>
350 <p><strong>Search Term</strong><br>
351 Search terms <em>may</em> be enclosed in double quotes. Search terms <em>must</em> be
352 enclosed in double quotes if they contain any of the following characters: < > =
353 / ( ) and whitespace. The search term may be empty, but must be present
354 in a search clause. An empty search term is expressed as "" and has no
355 defined semantics. </p>
358 <p><strong>Index</strong> <strong>Name</strong><br>
359 An index name always includes a base name and may also include a prefix,
360 which provides a context for the index name, the name of the <a href="#context">context
361 set</a> of which the index is a part. If the context is not supplied,
362 it is determined by the server. If the index is not supplied it
363 is determined by the server. (Note that the index may be omitted only
364 when the relation is also omitted. Either both must be supplied, or both
367 title = cat <em>context determined
368 by the server</em><br>
369 dc.title = cat <em>index context is dc<br>
370 </em>cat <em>context and
371 index determined by the server</em></p>
374 <p><strong>Relation<br>
375 </strong>The relation in a search clause specifies the relationship
376 between the index and search term. It also always includes a
377 base name and may also include a prefix providing a context for the
378 relation. If a relation is supplied with no accompanying context, the
379 context is 'cql' (the <a href="http://www.loc.gov/standards/sru/cql/cql-context-set.html">cql context
380 set</a>). If no relation is supplied, then cql.scr (server choice)
381 is assumed, which means that the relation is determined by the server.
382 (Note that the relation may be omitted only when the index is also
383 omitted. Either both must be supplied, or both
387 title = cat <em> context for relation is 'cql' ; fully qualified
388 relation is cql.=<br>
389 </em>title cql.any cat <em>relation is 'any';
390 relation context is 'cql'. Equivalent to: </em>title any cat<em><br>
391 cat index and relation are determined
392 by the server (formally the relation is 'cql.scr')</em></p>
394 <li><a name="relmods"></a>
395 <strong>Relation Modifiers</strong><br>
396 Relation modifiers may accompany a relation. These also may be accompanied
397 by a context. If a context is not supplied for a modifier, the
398 default is the <a href="http://www.loc.gov/standards/sru/cql/cql-context-set.html">cql context set</a>. Relation
399 modifiers are separated from each other and from the relation by slashes
400 ( /). Whitespace may be present on either side of a / character, but
401 the relation plus modifiers group may not end in a /.
403 dc.title any/relevant/rel.CORI "cat fish" <br>
404 <em> the relation 'any'
405 is modified by (1) 'relevant' whose context is 'cql' and (2) 'CORI' whose context
407 dc.author exact/stem "smith, j." <em>the
408 relation 'exact' is modified by 'stem' whose context is 'cql'</em>.<em><br>
409 </em></p>
412 <p><strong>Boolean Operators</strong><br>
413 Search clauses may be linked by boolean operators. These are: <strong>and</strong>, <strong>or</strong>, <strong>not</strong> and <strong>prox</strong>.
414 (Note that <strong>not</strong> is really and-not, that is, it may
415 not be used as a unary operator.) Boolean operators all have the same
416 precedence; they are evaluated left-to-right. Parentheses
420 overide left-to-right
424 <p><strong>Boolean Modifiers</strong><br>
425 As a relation may have modifiers, similiarly, a
426 boolean operator may have modifiers, separated by '/' characters. Boolean
427 modifiers may come from
430 not supplied, the context is the <a href="http://www.loc.gov/standards/sru/cql/cql-context-set.html">CQL
431 context set</a>. (Note that Boolean operators themselves
432 are limited to the built-in set of four.)</p>
433 <p> Example: dc.title=cat and/rel.sum dc.title=dog</p></li>
435 <p><strong>Case Insensitive</strong> <br>
436 All parts of CQL are case insensitive apart from user supplied search terms,
437 which may or may not be case sensitive. 'OR','or', 'Or' and 'oR' are
438 all the same boolean operator, just as 'dc.title', 'DC.Title' and 'dC.TiTLe'
439 are all the same context set plus index name. </p>
442 <h2><a name="features"></a>Additional CQL Features</h2>
443 <p>The following are all formally defined by the CQL context set but described
444 here for convenience.</p>
445 <h3><a name="relations"></a>Relations </h3>
446 <p><strong>For ordered (e.g. numeric) terms: </strong><strong><br>
447 <</strong>, <strong>></strong>, <strong><=</strong>, <strong>>=</strong>,
448 and <strong><></strong> mean "less than", "greater than", "less
449 or equal", "greater or equal", and "not equal". </p>
451 <p><strong>when the term is a list of words</strong>: </p>
454 <p><strong> '='</strong> is used for word adjacency -- the words
455 appear in that order with no others intervening. (Note the dual
456 use of '=', it is used for numeric equality as described above.) </p></li>
458 <p> <strong>'any</strong>' means "any of these words" </p></li>
460 <p> '<strong>all</strong>' means "all of these words"</p>
462 <p><strong>When the term is a character string:<br>
463 </strong><strong>'</strong><strong>exact</strong>' is used for exact string
466 <p><strong>When the term has multiple dimensions:<br>
467 </strong><strong>'within</strong>' may be used to search for values that
468 fall within the range, area or volume described by the search
471 <strong>When the index's data has multiple dimensions:<br>
472 </strong><strong>'encloses</strong>' may be used to search for values of
473 the database's term fully encloses the search term.
478 <table border="1" cellpadding="5" cellspacing="0" width="95%">
479 <tbody><tr bgcolor="#fff9e5">
480 <th scope="col" width="28%"><em>This query </em></th>
481 <th scope="col" width="35%"><em>Would match this </em></th>
482 <th scope="col" width="37%"><em>but not this</em></th>
485 <td scope="row"><p><strong>title = "cat in the hat"</strong></p>
487 <td><p> "a day in the life of the cat in the hat"</p>
489 <td><p>"hat in the cat" or "cat in the green hat"</p>
493 <td scope="row"><p><strong>title all "cat hat"</strong></p>
495 <td><p>"hat in the cat"</p>
497 <td><p>"cat in the grass"</p>
501 <td scope="row"><p><strong>title any "cat hat"</strong></p>
503 <td><p>"cat in the grass"</p>
505 <td><p>"dog in the grass"</p>
509 <td scope="row"><p><strong>title exact "cat in the hat"</strong></p>
511 <td><p>"cat in the hat"</p>
513 <td><p>"a day in the life of the cat in the hat"</p>
517 <td scope="row"><p><strong>date within "2002 2005"</strong></p></td>
522 <td scope="row"><p><strong>dateRange encloses 2003</strong></p></td>
523 <td><p>"2002 2005"</p></td>
524 <td><p>"2004 2005"</p></td>
528 <a name="relmodifiers"></a>Relation Modifiers <strong>- Term Functions</strong></h3>
529 <p>These relation modifiers request that the server perform some algorithm
530 on the term before processing. </p>
533 <p><strong>stem</strong><br>
534 The server should apply a stemming algorithm to the words within the term.
535 for example, walked, walking, walker <i>etc.</i> would all be represented
536 by the stem word walk. This allows a search like title =/stem "these
537 completed dinosaurs" to match <i>The Complete Dinosaur</i>. </p></li>
539 <p><strong>relevant</strong><br>
540 The server should use a relevancy algorithm for determining matches and
541 the order of the result set. </p>
542 <p> Example: <em>subject any/relevant "fish frog"</em><br>
543 would find records relevant to "fish" or "frog" and order
544 the result set by relevance to fish or frog.<i><br>
548 <h3><strong>Relation Modifiers - Qualifiers</strong></h3>
549 <p> These modifiers qualify the relation to more precisely determine its
553 <p><strong>word</strong><br>
554 The term consists of words (rather than being an opaque string). </p>
557 <p><strong>string</strong><br>
558 The term is a single item, and should not be broken up. </p></li>
560 <p><strong>isoDate</strong><br>
561 Each item within the term conforms to the ISO 8601 specification for expressing
564 <p><strong>number</strong><br>
565 Each item within the term is a number. </p></li>
567 <p><strong>uri</strong><br>
568 Each item within the term is a URI. </p></li>
570 <p><strong>masked</strong><br>
571 This means that the masking rules (see next) apply. Masking is assumed
572 even if not specified, unless 'unmasked' is specified (so there is never
573 any reason to include 'masked').</p>
574 </li><li><strong>unmasked </strong><br>
575 Do not apply masking rules.
577 <h3><a name="masking"></a>Masking Rules</h3>
580 <p>A single asterisk (*) is used to mask zero or more characters. </p></li>
582 <p>A single question mark (?) is used to mask a single character, thus
583 N consecutive question-marks means mask N characters. </p></li>
585 <p>Carat/hat (^) is used as an anchor character for terms that are word
586 lists, that is, where the relation is 'all' or 'any', or '=' when used
587 for word adjacency. It may not be used to anchor a string, that is,
588 when relation is 'exact' (string matches are, by definition, anchored).
589 It may occur at the beginning or end of a word (with no intervening
590 space) to mean right or left anchored."^" has no special meaning when
591 it occurs within a word (not at the beginning or end) or string but
592 must be escaped nevertheless. </p>
595 <p> Backslash (\) is used to escape '*', '?', quote (") and '^' , as
596 well as itself. The use of a backslash not followed immediately by
597 one of these characters is reserved for future definition.</p>
600 <p>Masking examples: </p>
603 <p>dc.title = c*t <i>(matches cat and coast etc.)</i></p></li>
605 <p>dc.title = c?t <i>(matches cat and cot, not coast or ct)</i><br>
606 " ?" <i>(matches any single character)</i> </p></li>
608 <p>dc.title = "^cat in the hat" <i>(matches 'cat in the hat' where it
609 is at the beginning of the field)</i></p>
612 <p>dc.title any "^cat eats rat" <i>(matches 'cat eats rat', 'cat eats
613 dog', 'cat', but not 'rat eats cat')</i> </p>
617 dc.title any "^cat ^dog eats rat" <i>(matches 'cat eats rat', 'dog
619 loves bat', but not 'bat loves cat')</i> </p>
622 <p>dc.title = "\"Of Couse\" she said"</p>
625 <h3><strong><a name="resultset"></a>Result Set Name Used in Query</strong></h3>
626 <p>A search clause may be a result set name. This is a special case, employing
627 the context set '<a href="http://www.loc.gov/z3950/agency/zing/cql/context-sets/cql.html">cql</a>'.
628 The index and relation are expressed as "cql.resultSetId =" and
629 the term is a result set name that has been returned by the server in the
630 'resultSetName' parameter of the response. It may be used by itself in
631 a query to refer to an existing result set from which records are desired.
632 It may also be used in conjunction with other resultSetName clauses or
633 other indexes, combined by boolean operators. The semantics of resultSetId
634 with relations other than "=" is undefined. </p>
635 <p> Example: cql.resultSetId = "resultA" and cql.resultSetId = "resultB" </p>
636 <h3><strong><a name="proximity"></a>Proximity</strong></h3>
637 <p>The proximity boolean boolean operator is expressed in terms of distance,
638 unit, and ordering.</p>
641 <li> dc.title = "cat" prox/distance=1/unit=word dc.title
643 <li>"cat" prox/distance>2/ordered "hat" </li>
645 <p><strong>distance</strong> takes the form:<br>
646 distance [relation] [value] <br>
647 where relation is one of: "<", ">" ,"<=" ,">=" ,"=" , "<>"; <i>default "<="</i><br>
648 and value is a non-negative integer; <i>default: 1 for word, zero otherwise</i></p>
649 <p><strong>unit</strong> takes the form<br>
650 unit=[value] <br>
651 where value is one of "word", "sentence", "paragraph", or "element"<i>(default "word"</i>),</p>
652 <p><strong>ordering</strong> is "ordered" or "unordered"; <i>default "unordered"</i></p>
655 <h2><a name="context"></a>CQL Context Sets</h2>
656 <p>Context sets permit CQL users to create their own indexes, relations,
657 relation modifiers and boolean modiers without fear of chosing the same
658 name as someone else and thereby having an ambiguous query. All of these
659 four aspects of CQL must come from a context set, however there are rules
660 for determining the prevailing default if one is not supplied. Context
661 sets allow CQL to be used by communities in ways which the designers could
662 not have foreseen, while still maintaining the same rules for parsing which
663 allow interoperability.</p>
664 <p>When defining a new context set, it is necessary to provide a description
665 of the semantics of each item within it. While context sets may contain
666 indexes, relations, relation modifiers and boolean modifiers, there is
667 no requirement that all should be present; in fact it is expected that
668 most context sets will only define indexes.</p>
669 <p>Each context set has a unique identifier, a URI. When sending the context
670 set in a query, a short form is used. These short names may be sent as
671 a mapping within the query itself (see next), or be published by the recipient
672 of the query in some protocol dependent fashion. The prefix 'cql' is reserved
673 for the CQL context set, but authors may wish to recommend a short name
674 for use with their set. </p>
675 <p> An index, relation, or modifier qualified by a context is represented
676 in the form <i>prefix</i>.<i>value</i>, where <i>prefix</i> is a short
677 name for a unique context set identifier. </p>
678 <p><strong>Binding Short Name to URI<br>
679 </strong>The binding of short name to
680 URI is defined either within the query or by the server. A prefix map
681 may occur at any place in the query and applies to anything which follows.
683 <p class="box2">>dc="http://www.dublincore.org/" dc.title = "cat"</p>
685 </p><p>In the following query:
688 </p><p class="box2">>a="http:/x.com/y" a.title=cat and (>a="http:/f.com/g" a.title=hat)
691 </p><p>both the "a" in "a.title=cat" and in "a.title=rat" refer
692 to http:/x.com/y, while the "a" in "a.title=rat" refers
693 to http:/f.com/g.</p>
694 <p> <strong>Default Context</strong><br>
695 When no context is attached to a relation, relation modifier,
696 or boolean modifier, the context is the cql context set. When no
697 context is attached to an index the context is determined by the server.</p>
698 <p><strong>Known Context Sets</strong><br>
699 The following context sets have been defined and made
700 public. If you wish to have your context set listed here, please provide
703 the <a href="mailto:z950@loc.gov">SRU Maintenance Agency</a>.</p>
704 <table align="center" border="1" cellpadding="5" cellspacing="0" width="95%">
707 <th scope="col" bgcolor="#fff9e5" width="15%">Short Name</th>
708 <th scope="col" bgcolor="#fff9e5" width="60%">Identifier</th>
709 <th scope="col" bgcolor="#fff9e5" width="25%">Reference</th>
712 <td scope="row"><p><strong>cql</strong></p>
714 <td><p>info:srw/cql-context-set/1/cql-v1.1</p>
716 <td><p><a href="http://www.loc.gov/standards/sru/cql/cql-context-set.html">CQL context set</a></p>
720 <td scope="row"><p>dc</p>
722 <td><p>info:srw/cql-context-set/1/dc-v1.1</p>
724 <td><p><a href="http://www.loc.gov/standards/sru/cql/dc-context-set.html">Dublin Core Context Set</a></p>
728 <td scope="row"><p>bath</p>
731 <p>http://zing.z3950.org/cql/bath/2.0/</p>
733 <td><p><a href="http://zing.z3950.org/srw/bath/2.0/#2">Bath Context
738 <td scope="row"><p>zthes</p>
740 <td><p>http://zthes.z3950.org/cql/1.0/</p>
742 <td><p><a href="http://zthes.z3950.org/cql/">ZThes thesaurus context
747 <td scope="row"><p>ccg</p>
749 <td><p>http://srw.cheshire3.org/contextSets/ccg/1.1/</p>
751 <td><p><a href="http://srw.cheshire3.org/contextSets/ccg/">Collectable
756 <td scope="row"><p>rec</p>
758 <td><p>info:srw/cql-context-set/2/rec-1.1</p>
760 <td><p><a href="http://srw.cheshire3.org/contextSets/rec/1.1/">Record metadata</a></p>
764 <td scope="row"><p>net</p>
766 <td><p>info:srw/cql-context-set/2/net-1.0</p>
768 <td><p><a href="http://srw.cheshire3.org/contextSets/net/">Network
769 resource information</a></p>
773 <td scope="row"><p>music</p>
775 <td><p>info:srw/cql-context-set/3/music-1.0 </p>
777 <td><p><a href="http://www.ceridwen.com/srw/music-contextset.html">Music
782 <td scope="row"><p>rel</p>
784 <td><p>info:srw/cql-context-set/2/relevance-1.0</p>
786 <td><p><a href="http://srw.cheshire3.org/contextSets/rel/">Relevance
791 <td scope="row"><p>zeerex</p>
794 <p>info:srw/cql-context-set/2/zeerex-1.1</p>
796 <td><p><a href="http://srw.cheshire3.org/contextSets/ZeeRex/">ZeeRex
801 <td scope="row"><p>marc</p>
803 <td><p>info:srw/cql-context-set/1/marc-1.0</p></td>
804 <td><p><a href="http://www.loc.gov/standards/sru/cql/marc-context-set.html">MARC Context Set</a></p></td>
810 <h2><a name="conformance"></a>Conformance</h2>
811 <p>In order to claim conformance to CQL a server must support one of the
812 following three levels:</p>
813 <p><strong>Level 0</strong></p>
816 <p>Must be able to process a term-only query.<br>
817 (The term is either a single word or if multiple words separated by spaces
818 then the entire search term is quoted). If the term includes quote marks,
819 they must be a escaped by preceding them with a backslash, e.g."raising
820 the \"titanic\"".)</p>
823 <p>If an unsupported query is supplied, must be able to respond with
824 a diagnostic to say that the query is not supported.</p>
827 <p><strong>Level 1</strong></p>
830 <p> Support for Level 0.</p>
833 <p> Ability to <em>parse</em> both: <br>
834 (a) search clauses consisting of 'index relation searchTerm'; and <br>
835 (b) queries where search terms are combined with booleans, e.g. "term1
838 <p><em>Support</em> for at least one of (a) and (b). </p></li>
840 <p>Note that (b) does not necessarily include queries such as:</p>
842 <p> index relation term1 AND index relation term2</p>
844 <p> but rather queries where the search clauses are terms-only (do not include
845 index or relation).</p>
846 <p><strong>Level 2</strong></p>
849 <p> Support for Level 1. </p>
852 <p>Ability to <em>parse</em> all of CQL and respond with appropriate
856 <p>Note that Level 2 does not require <em>support</em> for all of CQL, it
857 requires that the server be able to <em>parse</em> all of CQL (and respond
858 with proper diagnostics for the parts not supported.).</p>
859 <!-- InstanceEndEditable -->
860 <div id="bottom-bread"> <a href="http://www.loc.gov/standards/sru/index.html">Home</a> >> <!-- InstanceBeginEditable name="bottombreadcrumb" --><span class="selected">CQL</span><!-- InstanceEndEditable --></div>
863 <div id="bottom-left"><a href="http://www.loc.gov/" class="white">The Library
864 of Congress</a><span class="white-text"> » </span><a href="http://www.loc.gov/library/" class="white">Librarians,
865 Archivists</a><span class="white-text"> »</span> <a href="http://www.loc.gov/standards/" class="white">Standards</a><br>
866 <span class="white-text">
867 <!-- #BeginDate format:Am1 -->March 8, 2007<!-- #EndDate -->
869 <div class="white-text" id="contactus"><a href="mailto:z3950@loc.gov" class="white">Contact
873 <script type="text/javascript" src="cql_files/s_code.js"></script><img src="cql_files/s61224011715843.gif" name="s_i_locgovprod" alt="" border="0" height="1" width="1"><!-- InstanceEnd --></body></html>