Filtering a GetMetadataObjects Request |
The AttributeCriteria component is optional. It enables you to filter the objects that are selected to objects matching a specified attribute=value pair. The syntax of AttributeCriteria is as follows:
[@attrname cop 'value' lop AttributeCriteria]
@attrname specifies an attribute name; for example, @Name or @Desc.
cop is a comparison operator. The supported comparison operators are described in the following table:
Note: The NE, GE, and LE operators (and their lowercase aliases) are new in SAS 9.2. Also in SAS 9.2, GT and LT have been expanded to operate on character string values and numeric values. The expanded functionality allows comparisons to be performed on ranges of character string and numeric values.
'value' is a character or numeric string enclosed within single quotation marks.
Character Strings:
Searches of character strings compare the <XMLSELECT> search pattern value with the attribute data value and determine which string appears first in a sorted list. The sort order is based on the collation sequence for the specified locale. If either the data or pattern values contain any characters that are not in the locale's collation list, the locale determines how to order the unknown characters.
Missing Values:
To search for a MISSING numeric or datetime attribute value, specify a period enclosed within single quotation marks.
To search for a MISSING character attribute value, specify two adjacent single quotation marks.
Datetime Values:
In the current release, searches by date or by time are not supported. However, the SAS Metadata Server supports datetime queries on the MetadataCreated= and MetadataUpdated= attributes. The supported DATETIME formats are the following:
ddmmmyyyy:hh:mm:ss.s
ddmmmyyyy:hh:mm:ss
a SAS date value that represents a ddmmmyyyy:hh:mm:ss value
a MISSING datetime '.' value
The DATE format ddmmmyyyy is not supported.
Datetime queries are supported only in the standard interface. For more information about how to issue SAS Open Metadata Interface methods, see Communicating with the SAS Metadata Server.
Note: Objects are persisted to disk with a GMT datetime value. Therefore, an object created in local time might have a different datetime value on disk. For example, an object created at '30May2003:16:20:01' CST could have a persisted datetime value of '30May2003:21:20:01'. To accommodate the storage conversion, the SAS Metadata Server converts values that you specify in an <XMLSELECT> search string to GMT values for you. However, the datetime values returned by the server look different than the values that you submitted in the search string.
The following are examples of queries in the supported formats:
<XMLSELECT search="*[@MetadataCreated GT '27May2003:09:20:17.2']"/> <XMLSELECT search="*[@MetadataCreated LT '27May2010:09:20:17']"/> <XMLSELECT search="*[@MetadataCreated GT '1309907400']"/> <XMLSELECT search="*[@MetadataUpdated EQ '.']"/>
In the third example, '1309907400' is the SAS date value for '30May2003:19:03:11' GMT.
lop is the logical operator AND or OR. It enables you to specify an additional AttributeCriteria string that is appended to and concatenated with the first AttributeCriteria string. AND specifies that both conditions must be met for an object to be selected for retrieval. OR specifies that either condition can be met for an object to be selected. An example of an OR comparison is the following:
[@Name = 'John Doe' or @Name = 'Jane Doe']
Compound attribute criteria are also supported. Use parentheses to control evaluation order. For example:
search="*[@ProductName='SAS/CONNECT' and (@Name contains 'test - SAS/CONNECT Server' or @Name='test')]"In this example, the expression enclosed within the parenthesis is evaluated first.
Note: Whether single, concatenated, or compound attribute criteria are used, the attribute test is applied only if all of the specified attribute names are valid for the object. That is, if one of the attribute names in the attribute string is misspelled, then no objects are selected.
If the OMI_INCLUDE_SUBTYPES flag is set with OMI_XMLSELECT, the metadata type and subtype objects to be tested might support a different set of attribute names. Only objects that contain all of the specified attribute names are tested for a match.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.