To understand how an
association path is evaluated, we must consider each association path
level that is specified. The
AssociationPathLevel specifies an association name and an associated object that is evaluated,
as well as optional attribute criteria that the associated objects
must meet to be selected.
The first
AssociationPathLevel in
AssociationPath sets the context for the request. It specifies the association that
an object must have defined to be evaluated. When considered in the
context of
Object, the syntax
of the first
AssociationPathLevel looks like the following:
Object[AssociationName/AssociatedObject[AttributeCriteria]]
Object can be the same metadata type name that is specified in the GetMetadataObjects
TYPE parameter, a subtype of the metadata type in TYPE, or an asterisk,
which defaults to the value in the TYPE parameter. The value that
you specify in
Object indicates
what association names are valid. In the first
AssociationPathLevel, the following is true:
-
If
Object is a metadata type, then
AssociationName must be an association name that is valid for that metadata type
as defined in the SAS Metadata Model. For example, if
Object is Report, then
AssociationName must be an association name that is defined for the Report metadata
type in the SAS Metadata Model.
-
If
Object is an *, then
AssociationName must be an association name that is valid for the metadata type
specified in the TYPE parameter.
The
AssociatedObject in the
AssociationPathLevel specification can also be a metadata type name or an asterisk. However,
in this position, the specified value stipulates whether associated
objects of one metadata type should be evaluated, or, that associated
objects of all of the potential associated metadata types defined
for the association name should be evaluated. For example:
-
When
AssociatedObject is a metadata type, this says, “Give me only object instances
of this metadata type that are related under the specified association
name.”
-
When
AssociatedObject is an asterisk, this says “Give me object instances of all
potential metadata types that are defined for the specified association
name.”
Consider the following
AssociationPathLevel specifications to understand
how the asterisk and metadata type names are evaluated in the
Object and
AssociatedObject positions. For these examples, assume that Report is the metadata
type specified in the TYPE parameter.
*[ReportLocation/*]
Report[ReportLocation/Email]
The first specification
selects objects of the metadata type specified in the TYPE parameter
(Report) that have a ReportLocation association and associated objects
of any of the metadata types that are valid for the ReportLocation
association name. The ReportLocation association name supports associations
to objects of 19 metadata types.
The second specification
selects Report objects that have a ReportLocation association to an
Email object. (Email is one of the 19 supported associated metadata
types.)
If a subtype were specified
in either the
Object or
AssociatedObject positions, then the SAS Metadata
Server would select only objects and associated objects of the specified
subtype. Report is a subtype of the Classifier metadata type. If Classifier
were the metadata type specified in the TYPE parameter, the first
specification above would apply to the Classifier metadata type. The
second specification would still only apply to Report objects.
The
AttributeCriteria component in
AssociationPathLevel further limits the
Objects that are selected to objects whose associated
objects meet the specified attribute criteria. For example, consider
the following request:
Report[ReportLocation/Document[@TextType='XML']]
The attribute criteria
limit the Report objects that are selected to objects that have associated
Document objects that have the attribute TextType="XML". When attribute
criteria are specified in a query that has an * in the
AssociatedObject component, the attribute criteria
are applied to all associated objects.
Subsequent
AssociationPathLevels in an
AssociationPath get their context from the
AssociatedObject in the preceding level.
-
When the preceding associated object
is a metadata type,
AssociationName must be an association name that is valid for that metadata type.
-
When the preceding associated object
is an *,
AssociationName can
be any association name defined for one of the metadata types supported
by the preceding association name.
Consider the following
AssociationPath. The
AssociationPathLevels are separated by a / (slash):
Report[ReportLocation/Document[@TextType='XML']/AssociationName/AssociatedObject]
AssociationName must be an association that is valid for the Document metadata
type.
AssociatedObject must
be a metadata type that is supported by
AssociationName or an *.
Consider the following
AssociationPath:
Report[ReportLocation/*/AssociationName/AssociatedObject]
AssociationName can be an association name that is valid for any of the 19 metadata
types supported by the ReportLocation association.
AssociatedObject must be a metadata type that
is supported by
AssociationName or an *.
The following is an
example of an
AssociationPath that specifies multiple
AssociationPathLevels and specifies metadata types in the
AssociatedObject positions:
Report[ResponsibleParties/ResponsibleParty/Persons/Person
/Locations/Location[@Area='New York']]
The request selects
Report objects that have a ResponsibleParties association to a ResponsibleParty
object that has a Persons association to a Person who has a Locations
association to a Location object that has the attribute value Area=“New
York”. It has three
AssociationPathLevels:
-
ResponsibleParties/ResponsibleParty
-
-
The following is an
example of an
AssociationPath that specifies multiple
AssociationPathLevels and specifies asterisks in the
AssociatedObject positions:
Report[ResponsibleParties/*[@Role='OWNER']/Persons/*[@Name='John Doe']]
The request selects
Report objects that have a ResponsibleParties association to any object
that has a Role attribute value of Owner and a Persons association
to any object that has a Name attribute value of John Doe. It has
two
AssociationPathLevels: