Create Relationships between Resources
On a resource's Details page, there is a link to view relationships the resource has with other resources in the geoportal catalog. The mechanism for defining relationships between resources is through the metadata for the resource itself.
The syntax for defining the relationship tree is similar to the syntax used for defining the nodes in the Browse tab's tree, but instead of defining REST filters for specific search criteria, filters for relationships are defined. This topic describes how to define those filters, and how to prepare metadata such that it includes elements that allow relationships between resources.
Defining Relationships
Although it is possible to configure a REST search request for each relationship node, the resource relationship mechanism is primarily designed for searching resources having a given property matching a specific property of the selected resource. This differs from the Browse tab's query syntax, in that the searchText REST query is not used, but instead a query for the specific relationship.
The browsing structure to view resource relationships is defined in the \\geoportal\WEB-INF\classes\gpt\search\browse\browse-resource.xml file. Open this file, and you will see the definitions for the nodes that appear in the Relationship page's Resource tree. Each node has a <query> tag associated with it, and it is in this <query> tag that the search for a relationship is defined. The query within the <query> tag consists of three parts:
- urn:esri:geoportal:browse:resourceRelationship:means that the query will depend on both a property of the selected resource and a property of related resources.
- <property-meaning for selected resource>indicates the property-meaning of the selected resource used to set the search matching value.
- <property-meaning for related resources>indicates the property-meaning against which the related resources must match the search value.
注:
The available property-meanings can be found in the property-meanings.xml file, in the \\geoportal\WEB-INF\classes\gpt\metadata folder.
For example, the second <query> tag in the default browse-resource.xml file defines the usedBy relationship, which is usually used with services that operate on specified datasets. Within it the <query> tag, you will see the following string:
urn:esri:geoportal:browse:resourceRelationship:apiso.ResourceIdentifier-apiso.OperatesOn
The query expresses a search seeking for resources having the apiso.OperatesOn property matching the apiso.ResourceIdentifier property value of the selected resource.
For example, consider the following two INSPIRE metadata records, Example A and Example B. Example A has its apiso.ResourceIdentifier property set to {FC784D97-30F7-4AB0-A9EA-A690D43E1295}. Example B has its apiso.OperatesOn property set to the same value. Under these circumstances, the resources related with Example A according to a "usedBy" relationship would include Example B:
Example A | Example B |
---|---|
< MD_Metadata xmlns =" http://www.isotc211.org/2005/gmd " xmlns:gco =" http://www.isotc211.org/2005/gco " xmlns:gmd = http://www.isotc211.org/2005/gmd …> <…INSPIRE metadata for datasets..> < identifier > < MD_Identifier > < code > < gco:CharacterString > {FC784D97-30F7-4AB0-A9EA-A690D43E1295} </ gco:CharacterString > </ code > </ MD_Identifier > </ identifier > <…..> </ MD_Metadata > | < MD_Metadata xmlns =" http://www.isotc211.org/2005/gmd " xmlns:gco =" http://www.isotc211.org/2005/gco " xmlns:gmd = http://www.isotc211.org/2005/gmd …> <…INSPIRE metadata for services ..> < srv:operatesOn xmlns:xlink =" http://www.w3.org/1999/xlink " uuidref =" {FC784D97-30F7-4AB0-A9EA-A690D43E1295} "/> <…..> </ MD_Metadata > |
Similarly, it is possible to implement relationships based on the fact that the resource has the same value in a given field (e.g. title, content type).