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
- Add resources to your selected collection, see Adding to a collection
- 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
Edit each resource individually and place the IDs of the resources you wish to relate into the "Related Resources" box (See Below).
This relate will only apply to the resource you are editing, you will need to do the same for all of the resources that you wish to relate to each other.
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 will see a check box option on the upload page which you can select 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
$related_search_show_self=true;
$related_type_show_with_data= array(6);
Showing related resources in a tab
To make it easier to upload these important related resources, a link will appear by default in the related resources tab. This will automatically set the appropriate resource type and return 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 may choose to show a thumbnail of the resource. To do this, add the resource type identifier to the system configuration variable $related_type_thumbnail_view.
$related_type_thumbnail_view = array(6);
For further options on displaying related resources, please see our article on 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 system configuration a file for the resource may still be uploaded later.
As mentioned earlier, if you have the configuration option $related_type_show_with_data enabled for a resource type, you will 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