Related resources

Resources can be linked by relating them in order to help find and group sets of similar, or mutually relevant resources, not to be confused with Alternative files.

 

How to relate resources

Relate all resources in a collection

  1. Add resources to your selected collection, see Adding to a collection
  2. From the collection actions list select "Relate all resources in this collection"

You will see a confirmation message to say all resources are now related.

While collections are a convenient way to relate a large number of resources, resources are related at the resource level. The relationship is not connected to the collection used.

From version 10.2, the option to "Un-relate all resources in this collection" is also available. This will remove the relationships between the resources in the collection without affecting relationships to resources outside of the collection. 

Manually relate resources

You can also relate resources manually: edit each resource individually, make a selection and choose 'Edit selected', or from a collection or set of search results, choose 'Edit all resources'. On the edit page, scroll down to 'Status and relationships', and enter any IDs of resources you'd like to relate into the 'Related Resources' box. 

related

Relate on upload

This requires some additional configuration to apply the below option and to set the correct PHP path for you system, often $php_path="/usr/bin";.

$relate_on_upload=true;

Once enabled, you'll see a check box option on the upload page: select this to relate all resources in that upload batch. If using the 'Set metadata first' sequence, this option will be at the bottom of the metadata form. If adding the files first, the option will be in the expandable 'Upload options' section, below the uploader box.

Viewing related resources

By default, related resources appear as thumbnails in a panel located below the resource metadata on the resource view page.

related_resource_standard_view

You'll see a link to 'View these resources as a result set', which allows you to see all resources related to your current resource as a set. Enabling the option below will also include the current resource in that set:
$related_search_show_self=true;
Showing related resources alongside resource metadata
Related resources of specific resource types (e.g. consent forms or product information sheets) can be configured to appear alongside the current resource metadata by adding the resource type ID (see Resource Types) to the system configuration variable $related_type_show_with_data.
e.g.
$related_type_show_with_data= array(6);

Showing related resources in a tab

With the above option configured, the related resource can also be set to appear in a metadata tab. The allocated tab for each resource type is defined by the 'Tab name' option on the resource type configuration page (Admin->System->Resource types). Edit the type you wish to promote, for example 'Consent Form', and select the relevant tab option.
 
Once configured, you'll be able to click through to the related consent form from its title, displayed on the allocated tab in the image metadata. You'll also have the option to un-relate the form and to upload other forms which should be related to the image (see below).

To make it easier to upload important related resources in this way, a link will appear by default in the related resources tab. This automatically sets the appropriate resource type and returns the user to the current resource once the upload is completed. The following option can be set to disable this:

$related_type_upload_link = false;

Showing related resources alongside metadata as thumbnails

Instead of the related resource title showing in the metadata tab, you can display a thumbnail of the resource. To do this, add the resource type identifier to the system configuration variable $related_type_thumbnail_view.

e.g.
$related_type_thumbnail_view = array(6);

For more options on displaying related resources, see push metadata.

Other ways to add new related resources

  • Directly from the resource view page

    In standard view, a link 'Create new related resource' is located on the resource view page below any existing related resources. This allows you to create a new empty resource (with no file attached), although depending on your setup, a file for the resource can still be uploaded later.

    Remember, if you have the configuration option $related_type_show_with_data enabled for a resource type, you'll also see an 'upload' link on the relevant tab.

  • Using a server script

    A CSV file containing details of related resources can be used with the aid of a server script.
    Note that existing relationships will be kept and new resource relationships will be added.

    For this to work:

    • You need command line access to your ResourceSpace server
    • The CSV used should have no header row
    • The first CSV column must contain a single resource ID
    • The second CSV column will contain a comma separated list of all related resource IDs and must be quoted so that commas are not interpreted as part of the CSV structure e.g.

    An example CSV line to relate resource ID 15882 to resources 16401, 16402 and 16403 would look like this:
    15882,"16401,16402,16403"

    To run the script, run pages/tools/add_related_resources.php as below:

cd [webroot]/pages/tools
php pages/tools/add_related_resources.php --csv [path to CSV file]

e.g. 

cd /var/www/resourcespace/pages/tools
php add_related_resources.php --csv ~/related_resources.csv

or

D:
cd inetpub/resourcespace/pages/tools
php add_related_resources.php --csv %HOME%/related_resources.csv

# To run without making changes but see what would be changed you can use the --dryrun option e.g.
php add_related_resources.php --csv [path to CSV file] --dryrun