Linked catalogs
You can combine data of different catalogs by linking them together. For example, if you have a catalog with additional layers for a particular region, you can link it to the base catalog of the world for a better user experience.
Add linked catalogs
When linking catalogs, you need to select the main catalog to which you add other catalogs. Each catalog can only be linked to one main catalog, and versions of the main and linked catalogs can differ.
To link two or more catalogs:
-
Create a DataStoreServer
instance.
For more information, see the related instruction.
-
Create LinkedCatalogsRequest
and specify the HRN of the main catalog, HRNs of the catalogs that you want to link, and the linkage type.
Note: Only the Indirect
linkage type is currently available, which means that data from catalogs is combined.
LinkedCatalogsRequest request;
request.WithLinkedCatalogs(LinkedCatalogs("hrn:here:data::olp-here:ocm", "hrn:here:data::olp-here:ocm-japan", CatalogLinkType::kIndirect))
.WithLinkedCatalogs(LinkedCatalogs("hrn:here:data::olp-here:ocm", "hrn:here:data::olp-here:ocm-germany", CatalogLinkType::kIndirect));
-
Run the request and check the result.
bool result = server->AddLinkedCatalogs(request);
-
Add the main and linked catalogs to the DataStoreServer
instance.
For more information, see the related instruction.
You can now use the combined data from the main and linked catalogs.
Important: When you work with map regions API, use the main catalog handle in all your operations. Use the linked catalog handle only for update operations.
The linking is only valid for the lifecycle of the DataStoreServer
instance. Reset it at every start-up before you add catalogs to the DataStoreServer
instance.
Remove linked catalogs
You can remove one or several catalogs linked to the main catalog during the lifecycle of the DataStoreServer
instance.
To remove linked catalogs:
-
Create the RemoveLinkedCatalogs
request and specify the handle of the main catalog, handles of the linked catalogs that you want to remove, and the linkage type.
RemoveLinkedCatalogs request;
request.WithLinkedCatalogs(LinkedCatalogs("hrn:here:data::olp-here:ocm", "hrn:here:data::olp-here:ocm-japan", CatalogLinkType::kIndirect))
.WithLinkedCatalogs(LinkedCatalogs("hrn:here:data::olp-here:ocm", "hrn:here:data::olp-here:ocm-germany", CatalogLinkType::kIndirect));
-
Run the request and check the result.
bool result = server->RemoveLinkedCatalogs(request);
The catalogs are no longer linked, and you cannot use the combined data.