Functions

Use the following function arguments and functions to construct function-based query clauses.

Function arguments

The function arguments are as follows:

attr_name
Specifies the name of any attribute, such as is_product or platform.
object_name
Specifies the object reference form of any object version:

name-version:type:instance (assuming version delimiter is ’-’)

name:version:type:instance

order_spec
Specifies the search order. If the value depth is used for the order_spec, the value indicates that a depth-first search is done. Use breadth to specify a breadth-first search. If the value "none" is used for the order_spec, it indicates that the order is not significant and the search can be done in any order. The fastest method is used.

none | depth | breadth

privilege_name
Specifies the name of a permission such as read or write.
project_name
Specifies the name of any project object version:

project_name-version (assuming version delimiter is ’-’)

project_name:version

project_name-version:project:instance

project_name:version:project:instance

Function definitions

The query functions are as follows:

baseline(’baselinename’)
Queries for baselines that have the specified baseline name. In a DCM-initialized database, the baseline name can optionally include a DCM database ID and a DCM delimiter prefix. If no baseline name argument is specified, it queries for all baselines.
baseline_tasks(’baselinename’)
Queries for the tasks that were included in the specified baseline. In a DCM-initialized database, the baseline name can optionally include a DCM database ID and a DCM delimiter prefix. This query function cannot be used with other query clauses or with nested queries.
cr(’crid’)
Queries for change requests that have the specified change request ID. In a DCM-initialized database, the change request ID can optionally include a DCM database ID and a DCM delimiter prefix. If no change request ID argument is specified, it queries for all change requests.
folder(’folderid’)
Queries for folders that have the specified folder ID. In a DCM-initialized database, the folder ID can optionally include a DCM database ID and a DCM delimiter prefix. If no folder ID argument is specified, it queries for all folders.
has_attr(’attr_name’)
Queries the database for all object versions that have the attribute attr_name (for example, is_product or platform).
has_child(’object_name’,’project_name’)
Queries the database for all directory object versions in project_name that have object_name as a member.
has_member(’object_name’)
Queries the database for all project object versions that have the specified object version as a member.
has_model(’object_name’)
Queries the database for all of the object versions that use the specified model object version as their model.

For example, if you use the Base Model, this query is has_model(’base-1:model:base’).

has_no_relation()
Queries for objects that have no relation named relation from them to some other object. For example, to query for a task that has no associated objects, you might carry out the following command:

ccm query "cvtype='task' and has_no_associated_cv()"

has_predecessor(’object_name’)
Queries the database for all object versions that have the specified object version as an immediate predecessor.
has_priv(’privilege_name’)
Queries the database for objects that match the specified name of a privilege, such as read or write.
has_purpose(’purpose’)
Queries for objects whose member_status matches the specified purpose.
has_relationship(’object_name’)
Queries the database for all object versions that have a relationship of type relationship with object_name.

The relationship can be any established relationship such as associated_cv or associated_task.

has_relationship(’object_name’,’operator’,time)
Queries the database for all objects having the specified relation to the specified object whose relation create time matches the specified operator (that is, =, !=, >,<=, >, or >=) and time value.

The relationship can be any established relationship such as associated_cv or associated_task.

The is_relationship(’objectspec’, ’operator’, time) is the inverse query of has_relationship_of(’objectspec’, ’operator’, time).

has_type(’type_name’)
Queries the database for all object versions of type type_name. For example, a query of has_type(’csrc-1:cvtype:base’) might find HelloWorld-1:csrc:1.
hierarchy_project_members(’project_name’, order_spec)
Queries the database for all projects in the project hierarchy specified by project_name. The order_spec argument specifies the search order, as described in recursive_is_member_of.

The query returns an ordered list of object version names. Use of other queries with this query can change the order of the result.

The project_name is returned from this query.

is_available_task_of_release(’task_release’, ’baseline_release’, ’baseline_purpose’)
Queries for completed tasks for the specified task release that are not in the latest baseline matching the specified baseline release and purpose.
is_bound()
Queries the database for object versions that are members of any project. This function is best used when specifying other limiting options, such as the name of a project.
is_child_of(’object_name’,’project_name’)
Queries the database for all object versions that are members of directory or project object_name in project project_name.
is_cr_of_baseline(’baseline_id’)
Queries for the change requests that are in the specified baseline. These change requests are the ones that are associated to tasks associated to objects in the baseline or predecessors of those objects.
is_missing_cr_of_baseline(’baseline_id’,’release_name’)
Queries for the change requests with a specified release that are not in the specified baselined.
is_missing_cr_of_release(’release_name’)
Queries for the change requests for a specified release that are not associated to any tasks for that release.
is_unique_cr_of_baseline(’baseline_id’,’reference_baseline_id’)
Queries for the change requests that are unique to a baseline when compared with reference baseline.
is_hist_leaf()
Queries the database for objects that are leaf nodes in the history (for example, queries for objects that do not have successors).
is_hist_root()
Queries the database for objects that are root nodes in the history (for example, queries for objects that do not have predecessors).
is_member_of(’project_name’)
Queries the database for all object versions that are members of the specified project.
is_model_of(’object_name’)
Queries the database for the model object version associated with the specified object version.
is_no_relation()
Queries for objects that do not have a relation named relation from some other object to them. For example, query for an object of type ascii that is not associated with any task:

ccm query "cvtype='ascii' and is_no_associated_cv()"

is_predecessor_of(’object_name’)
Queries the database for all object versions that are immediate predecessors of the specified object version.
is_relationship_of(’object_name’)
Queries the database for all object versions that have a relationship of type relationship with the object_name object.

The has_relationship(’object_name’) function is the inverse query of is_relationship_of(’object_name’).

is_relationship_of(’object_name’, ’operator’, time)
Queries for all objects having the specified relation from the specified object whose relation create time matches the specified operator (that is, =, !=, >,<=, >, or >=) and time value.

For example:

is_associated_cv_of(’task23-1:taks:M’, ’>’, time(’1 May 2010’))

This query finds all the associated objects of task M#23 that were related to the task after May 1, 2010.

The has_relationship(’objectspec’, ’operator’, time) function is the inverse query of is_relationship_of(’objectspec’, ’operator’, time).

For information about creating a relationship, see relate command.

is_type_of(’object_name’)
Queries for the type object version in the model that was used to create object_name.
latest_baseline_tasks(’release’,’purpose’)
Queries the database for the tasks included in the most recently created baseline that has the specified release and purpose. A purpose of Any means match any purpose. This query function cannot be used with other query clauses or with nested queries.
latest_baseline_tasks_db(’dbid’,’release’,’purpose’)
Queries the database for the tasks included in the most recently created baseline from the specified database that has the specified release and purpose. A purpose of Any means match any purpose. This query function cannot be used with other query clauses or with nested queries.
recursive_has_relation(’object_name’, inclusive)
Queries the database for all object versions that have a relationship of type relationship to the object_name object, recursing through each such object.

The inclusive argument is a boolean TRUE or FALSE. The value TRUE means include the object specified by object_name in the results.

recursive_is_member_of(’project_name’, order_spec)
Queries the database for all members of all projects of the project hierarchy specified by project_name.

The query returns a list of object version names, with all non-projects occurring first in the list followed by the projects that are members of the hierarchy. Only the positions of the projects within the results are significant to the search order. Use of other queries with this query can change the order of the result.

The project_name is not returned from this query.

recursive_is_relation_of(’object_name’, inclusive)
Queries the database for all object versions that have a relationship of type relationship from the object_name object, recursing through each such object.

The inclusive argument is a boolean TRUE or FALSE. The value TRUE means include the object specified by object_name in the results.

For example "recursive_is_predecessor_of(’example.txt-1:ascii:1’, FALSE)" finds all of the recursive predecessors of example.txt-1:ascii:1 going back to the history root.

task(’taskid’)
Queries for tasks that have the specified task ID. In a DCM-initialized database, the task ID can optionally include a DCM database ID and a DCM delimiter prefix. If no task ID argument is specified, it queries for all tasks.

Feedback