compare Command

The compare command lets you compare an item with a specified string against the contents of a file.

This page discusses:

User Level

Business Administrator

Syntax

The command uses this syntax.

compare | admin            | PATTERN 
        | association      |
        | channel          |
        | command          |
        | attribute        |
        | form             |
        | format           |
        | group            |
        | index            |
        | inheritancerule  |
        | inquiry          |
        | location         |
        | menu             |
        | pathtype         |
        | person           |
        | policy           |
        | portal           |
        | program          |
        | relationship     |
        | role             |
        | rule             |
        | server           |
        | store            |
        | type             |
        | uniquekey        |
        | vault            |
    [ workspace ]
  from file FILENAME
  [ use [ map FILENAME ] [ exclude FILENAME ] 
        [ log FILENAME ] [ exception FILENAME ];
  • PATTERN is the string you want to compare.
  • FILENAME is the file for that clause.

Admin Types

You can specify which administrative types to compare, or use admin to compare all administrative types of the name or pattern that follows. Valid values are:

admin format menu relationship unique key
association group path type role vault
attribute index person rule
channel inheritance rule policy server
command inquiry portal store
form location program type

For example, the clause admin New* compares all administrative objects with the prefix "New." All other admin type values compare specific administrative types. For example, to compare all policies, you could use:

compare policy * from file d:\enoviaV6R2011\studio\xml\policy.xml;

To compare objects of a particular type whose names match a character pattern, include the pattern after the ADMIN_TYPE clause. For example, to compare only relationships that have the prefix "Customer", you could use:

compare relationship Customer* from file d:\enoviaV6R2011\studio\xml\relationship.xml;

workspace Clause

The workspace clause applies only when comparing administrative types that can have associated workspace objects: persons, groups, roles, or associations. When you add the keyword "workspace" to the compare command, any workspace objects (filters, toolsets, sets, and tables) owned by the persons, groups, roles, or associations being compared are included in the comparison operation.

For example, suppose you compare the Software Engineer role and the only change for the role is that a filter has been added. If you do not use the workspace option, the compare operation will find no changes because workspace objects are not included in the comparison. If you use the workspace option, the comparison operation will report that the role has changed and the filter has been added.

from file Clause

The from file FILENAME clause specifies the path and name of the existing XML export file. This file contains the baseline objects you want to compare with objects from the current schema. The ematrixml.dtd file (or a copy of it) must be in the same directory as the baseline XML file.

use Clause

Use the use keyword once for any optional files specified in the compare command: map files, exclude files, log files, or exception files. If more than one file type is to be used, the use keyword should be stated once only.

The use clause lets you specify optional files to be used in the compare operation. You can specify one of these items for the use clause:

Use Clause Description
mapA map file is a text file that lists administrative objects that have been renamed since the baseline file was created. The map file maps names found in the given baseline file with those found in the database (where renaming has taken place). Use the map file option to prevent the compare operation from finding a lot of changes simply because administrative objects had their names changed. The map file must use the following format: ADMIN_TYPE OLDNAME NEWNAME ADMIN_TYPE OLDNAME NEWNAME

OLDNAME is the name of the object in the baseline export file. NEWNAME is the name of the object in the current schema (the schema you are comparing against the baseline file). Include quotes around the names if the names include spaces. Make sure you press Enter after each NEWNAME so each renamed object is on a separate line (press Enter even if only one object is listed). For example, if the Originator attribute was renamed to Creator, the map file would contain this line:

attribute Originator Creator

If no map file is specified, the compare operation assumes that any renamed objects are completely new and that the original objects in the baseline were deleted.

logThe use log FILENAME option creates a file that contains the report for the compare operation. The compare command can be issued without identifying a log file, in which case just a summary of the analysis is returned in the MQL window—total number of objects analyzed, changed, added, deleted. The log file report lists exactly which objects were analyzed and describes the differences. More information appears in the report if verbose mode is turned on. For more information about the report, see MQL Concepts: Comparing a Schema with the Baseline.

An efficient approach is to run the compare command without a log file to see if any changes have occurred. If changes have occurred, you could turn on verbose mode, rerun the compare command and supply a log file to capture the changes.

excludeAn exclude file is a text file that lists administrative objects that should not be included in the comparison. The exclude file must use the following format:

ADMIN_TYPE NAME
ADMIN_TYPE NAME

NAME is the name of the administrative object that should be excluded in the compare operation. Make sure you press Enter after each NAME so each excluded object is on a separate line (press Enter even if only one object is listed). Wildcard patterns are allowed. Include quotes around the names if the names include spaces. For example, if you don't want to compare the Administration Manager role, the exclude file would contain this line:

role "Administration Manager"

exceptionThe use exception FILENAME clause creates a file that lists objects that could not be compared. If a transaction aborts, all objects from the beginning of that transaction up to and including the "bad" object are written to the exception file.

FILENAME is the path and name of the file to be created (log and exception files) or used (map and exclude files). If you don't specify a path, 3DSpace uses the directory that contains the mql.exe file.