Skip to content

This guide provides instructions and information about Stanford Web Services Jumpstart platform, based on Drupal 7.

We've released our new Stanford Sites on Drupal 8 (D8) platform — the new framework for Stanford Sites in 2020 and beyond. Check out our new User Guide to help you set up your website on the D8 platform. 

Read more about our road to D8 

Using Entity References for Importing Publications with CAPx

Importing and Linking Publications to People Profiles from CAP

Want to link the publications imported from CAP to their respective people profiles? CAPx 2.0 and newer can automatically create entity relationships between imported publication nodes with imported person nodes. To do so, you will first create a mapper and an importer for the profiles, and then a mapper and an importer for the publications.

Prerequisites

  1. Ensure that the Stanford CAPx 2.0 or newer, Stanford Person, and Stanford Publication modules are enabled for your site. If you are unsure, please contact us for support.

  2. Ensure that CAPx is Connected for your site.

Create a New Person Mapping

  1. Log into your site as an administrator.

  2. Create a mapper for the Person bundle by following the Configuring CAPx instructions

  3. Ensure that the Would you like to create multiple entities per imported bundle for the type of content you're importing? box is not checked.

  4. Save your mapper.

Create a New Importer for Importing People

  1. Create an importer using the Person mapper above by following the Configuring CAPx instructions

  2. Save and run the Person importer to create the Person nodes.

Create a New Publication Mapping

  1. Create a new mapper for the Publications bundle by following the Configuring CAPx instructions.

  2. Check the box for Would you like to create multiple entities per imported bundle for the type of content you're importing?

  3. In the Multiple entity creation sub query text field, enter the CAP API Path for subquery data in a CAP profile. For publications, it is: $.publications.*

    1. Alternatively, you can use this feature to import other types of CAP data into your site if you have a suitable bundle to map to. For example, use $.patents.* to import a person’s patents.

  4. In the Unique ID of entity text field, enter the CAP API Path for the unique ID of the subquery data. For publications, it is: $.publications.*.publicationId

    1. The Unique ID does not need to be a number from a sequential series; any unique set of characters could work in the field. For example, a Patent Number field for importing Patents: $.patents.*.number

    2. If there is no unique ID available or specified, the CAPx module will delete and re-import those entities every time there is a change to the profile.

 

 

  1. Under Entity References, select the Referencing Importer that contains the profiles you would like to connect these imported publications to as entity references. This would most likely be the importer you created in the Create a New Importer for Importing People step.

  2. Save your mapping.

 

Create a New Importer for Importing Publications

  1. Start creating an Importer using the Publication mapper above by following the Configuring CAPx instructions.

  2. Ensure that the profiles being imported in this importer are the same as the profiles in the importer from Create a New Importer for Importing People. Only profiles that are in both importers will have the publication nodes’ entity references set to link to the profiles created from the profile importer.

  3. Save and run your Publication importer.

    1. Ensure that the first Person importer is run first before running the Publication importer. Otherwise, Publication nodes may not be created for missing Person nodes until the next time the importers are run.

Notes and Troubleshooting

  • If a Unique ID of entity is specified for the multiple entity (Publication) mapper, CAPx will automatically update the imported nodes using the Unique ID.

    • If there is no unique ID available or specified, the CAPx module will delete and re-import those entities every time there is a change to the profile.

  • Ensure that the profiles being imported in this importer are the same as the profiles in the importer from Create a New Importer for Importing People. Only profiles that are in both importers will have the publication nodes’ entity references set to link to the profiles created from the profile importer.

  • Ensure that the Person importer is run first before running the Publication importer. Otherwise, Publication nodes may not be created for missing Person nodes.

  • The node view for Stanford Person may need to be customized to suit your needs on displaying the imported publications. You may want to build/customize your own view, especially if you wanted to show something like a featured publications section on a Person node.

  • Imported Publication nodes are not listed in the CAPx module admin pages; please use the Manage Content section of your site to manage your publication nodes.