Integrate with swh-alter inventory code for subdataset exports
The documentation about exporting subdataset currently reads:
Step 2. Build the list of SWHIDs
To generate a subdataset from an existing dataset, you need to generate the list of all the SWHIDs to include in the subdataset. The best way to achieve that is to use the compressed graph to perform a full visit of the compressed graph starting from the origin nodes, and to return the list of all the SWHIDs that are reachable from these origins.
Unfortunately, there is currently no endpoint in the HTTP API to start a traversal from multiple nodes. The current best way to achieve this is therefore to visit the graph starting from each origin, one by one, and then to merge all the resulting lists of SWHIDs into a single sorted list of unique SWHIDs.
If you use the internal graph API, you might need to convert the origin URLs in the Extended SWHID format (
swh:ori:1:<sha1(url)>
) to query the API.
This is exactly what the inventory code in swh-alter is doing, so I guess it would be smart to re-used here one way or another.