Dartmouth VIVO - Screenshot showing Selected Publications with links to PubMed, PubMedCentral, and Altmetric


VIVO is member-supported, open source software and an ontology for representing scholarship. VIVO encourages research discovery, expert finding, network analysis and assessment of research impact. That is, you can use VIVO to find and highlight researchers and research at your institution. A feature of VIVO is the ability to display a list of publications. In this article, I'll show you how you can automatically link directly to an article, specifically, articles listed in PubMed.

While there are a number of ways of auto-populating a VIVO profile's publications, assume that you have the PMID (PubMed ID number) for a researcher's article. The PubMed website uses URL query strings to list articles, meaning if you know the PMID, you can link directly to a PubMed article. VIVO uses freemarker, a JAVA template system, and SPARQL to make database queries; I'll show you how to set up a vanilla VIVO install to include PubMed links.

Adding PubMed links to VIVO publications

The process is generally the following:
  • Set up SPARQL query
  • Set up template
  • Adjust css to taste

Let's see the actual code used to make this happen:

(NOTE: code shown was used on VIVO version 1.9.2)

Set up SPARQL query

Modify the file listViewConfig-authorInAuthorship.xml. It's in VIVO/webapp/src/main/webapp/config/

We are going to extend the query to include PMID. First we need to modify the <query-select> by adding the variable ?pubid :

        SELECT DISTINCT ?subclass 
                        ?infoResource ?infoResourceName 
                        ?pubid     <!-- VARIABLE FOR PMID -->

Then set the variable for an article with pmid to ?pubid :

                ?infoResource core:relatedBy ?editorship .
                ?editorship a core:Editorship .
                ?editorship core:relates ?editorObj .
                ?editorObj rdfs:label ?editor .
            OPTIONAL { ?authorship core:hideFromDisplay ?hideThis }
            OPTIONAL { ?infoResource bibo:pmid ?pubid }			<!-- ADD PMID QUERY HERE -->

Now we need to do a similar process to <query-construct>. Set the variable for an article with a pmid to ?pubid :

            ?infoResource core:relatedBy ?editorship .
            ?editorship a core:Editorship .
            ?editorship core:relates ?editorObj .
            ?editorObj a foaf:Person .
            ?editorObj rdfs:label ?editor .
            ?infoResource bibo:pmid ?pubid .   <!-- ADD PMID QUERY HERE -->

Then insert a query for pmid in the WHERE clause:

            } UNION {
               ?subject ?property ?authorship .
               ?authorship a core:Authorship .
               ?authorship core:relates ?infoResource .
               ?infoResource a <http://purl.obolibrary.org/obo/IAO_0000030> .
               ?infoResource bibo:pmid ?pubid .

Set up template

With the SPARQL query created, we can now call and display the ?pubid variable in the Freemarker template file.

In your VIVO install, search for the file propStatement-authorInAuthorship.ftl (for example, there's a copy in VIVO/webapp/src/main/webapp/templates/freemarker/body/partials/individual/) and copy it into your theme/templates folder. For example, if you're using the default wilma theme, it'll be


In this copied file, add code to display a PubMed link. Add the following code just before the final </#if> tag:

    ${resourceTitle} ${citationDetails} <@dt.yearSpan "${statement.dateTime!}" /> ${altMetric}

		<!-- ADDED CODE -->
		<#if statement.pubid??>
		        <a href="http://www.ncbi.nlm.nih.gov/pubmed/?term=${statement.pubid!}" target="_blank" class="pubid">PubMed</a> &nbsp;

What this code does is, if a publication has a PMID, then add a link that points to its PubMed page at ncbi.nlm.nih.gov.

If you recompiled the code and ran VIVO (e.g., mvn install -s settings.xml), you should see something like the following:

Adjust css to taste

Clicking on "PubMed" link will take you to the article's PubMed page at ncbi.nlm.nih.gov. For better visibility, I updated the wilma theme's css to make the link into a button.

Note in the template code above I also added a css class of "pubid". So, for this example, in wilma.css, in VIVO/webapp/src/main/webapp/themes/wilma/css, I added the following styles:

/* PubMed button */
.pubid {
    background-color: #00693e;  /* green background */
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8em;

The publication page should now look something like this:



You can also use the same workflow to create a link to PubMed Central page, ie, a full-text version of the article if it's available, or grant info if you have a grant.gov ID (e.g., FIND ID). If you know the URL query link, you just have to copy the link format and follow the workflow I listed above.

This is definitely not the only way, and you can abstract the functionality further. My hope is that if you're setting up a VIVO at your institution, that it is easy to add links directly to the article information, and adding value to your VIVO site. The next step for us is to try and use DOI as a publication identifier and list non-pubmed articles. If you have feedback on improving access to the articles, contact us!


For more info on modifying VIVO templates, here's a few useful links:

Structure of VIVO page (VIVO wiki) https://wiki.duraspace.org/display/VIVODOC19x/How+VIVO+creates+a+page

SPARQL intro https://www.w3.org/2009/Talks/0615-qbe/

SPARQL VIVO recipes http://mconlon17.github.io/sparql/

FreeMarker resources https://wiki.duraspace.org/display/VIVO/FreeMarker