Selects objects by their metadata
ClearCase (general information)
The ClearCase query language is used to formulate queries on VOBs. It includes logical operators similar to those in the C programming language. ClearCase uses a query to search one or more VOBs and returns the names of objects: versions, branches, and/or elements. A query may return a single object, many objects, or no objects at all.
A query primitive evaluates to TRUE or FALSE. A TRUE value selects an object, such as an element, branch, or version; a FALSE value excludes it.
A query must be enclosed in quotes if it includes spaces. You may also need to enclose a query in quotes to prevent shell-level interpretation of characters such as ( (open parenthesis); using interactive cleartool removes this need. Quoting parentheses in config specs is not required.
You can use a query in a version selector in these contexts:
describe, merge, mkattr, mkbranch, mklabel, rmattr, rmlabel, rmver
A query in a version selector must be enclosed in braces ( {} ).
When a query is applied to a single branch, ClearCase selects the most recent version on that branch that satisfies the query. For example:
cmd-context describe -ver "\main\{attype(QAed)}" util.c
Using a query without a branch pathname causes an element's entire version tree to be searched. If the query returns a single version, the version-selection operation succeeds; the operation fails if the query returns no version (not found) or returns more than one version (ambiguous). For example:
cmd-context describe -ver "{attype(QAed)}" util.c
cleartool: Error: Ambiguous query: "{attype(QAed)}"
You can also use queries in the find and findmerge commands. In this context, the query can be enclosed in braces ({...}). The query returns the names of all matching objects. For example:
cleartool find util.c -ver "attype(QAed)" -print
util.c@@\main\1
util.c@@\main\3
The query language includes these primitives:
attribute-type-name comparison-operator value
TRUE if the object itself has an attribute of that type and the value comparison is true. To test whether an object or its subobjects has a particular attribute (for example, an element or its branches and versions), use the attr_sub primitive.TRUE, but BugNum!=671 is FALSE. The second query would be true if an attribute of type BugNum existed, but had a different value.attr_sub (attribute-type-name, comparison-operator, value)
With elements |
|
With branches |
|
With versions |
|
With elements |
|
With branches |
|
With versions |
|
attype_sub (attribute-type-name)
With elements |
|
With branches |
|
With versions |
|
With elements |
|
With branches |
|
With versions |
|
created_by (login-name)
In all cases, TRUE if the object was created by the user login-name (as shown by the describe command).
TRUE if the object was created since date-time. The date-time argument can have any of the following formats:date | := | day-of-week | long-date |
time | := | h[h]:m[m][:s[s]] [UTC [ [ + | - ]h[h][:m[m] ] ] ] |
day-of-week | := | today |yesterday |Sunday | ... |Saturday |Sun | ... |Sat |
long-date | := | d[d]-month[-[yy]yy] |
month | := | January |... |December |Jan |... |Dec |
eltype (element-type-name)
In all cases, TRUE if the element to which the object belongs is of type element-type-name.
TRUE if the object is either end of a hyperlink (first form) named hlink-type-name, or is the from-end of a hyperlink (second form), or is the to-end of a hyperlink (third form)
lbtype (label-type-name)
In all cases, TRUE if the object itself is labeled label-type-name. (Because elements and branches cannot have labels, this primitive can be true only for versions.)
With elements |
|
With branches |
|
With versions |
|
pool (pool-name)
In all cases, TRUE if the element to which the object belongs has a source pool or cleartext pool named pool-name.
trtype (trigger-type-name)
In all cases, TRUE if the element to which the object belongs has an attached or inherited trigger named trigger-type-name.
With elements |
|
With branches |
|
With versions |
|
Primitives can be combined into expressions with logical operators. An expression can take any of these forms, where query is a primitive or another expression:
query || query | (logical OR) |
query && query | (logical AND) |
! query | (logical NOT) |
( query ) | (grouping to override precedence) |
The precedence and associativity of the operators for attribute comparisons and formation of logical expressions are the same as in the C programming language:
highest precedence: ! | (right associative) |
lower precedence: < <= > >= | (left associative) |
lower precedence: == != | (left associative) |
lower precedence: && | (left associative) |
lowest precedence: || | (left associative) |
Examples including wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.
In cleartool single-command mode, cmd-context represents the command interpreter prompt. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt. In Attache, cmd-context represents the workspace prompt.
Z:\vob2\src>cleartool mklabel -ver "{lbtype(REL5)}" REL6 test.c
Created label "REL6" on "test.c" version "\main\4".
cleartool>mkattr -ver "{created_since(yesterday.13:00)&&created_by(asd)}" QAed ^ \"No\" test.c
Created attribute "QAed" on "test.c@@\main\5".
Z:\vob2\src>cleartool find . -branch "brtype(rel2_bugfix)&&trtype(mail_all)" -print
.\util.c@@\main\rel2_bugfix
config_spec, pathnames_ccase, version_selector
|
Feedback on the documentation in this site? We welcome any comments!
Copyright © 1999 by Rational Software Corporation. All rights reserved. |