Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


VIVO Widgets

This project is built to work with an instance of VIVO. Vivo widgets provides a method for easily embeding a script tag into your site that includes things like publications, grants and courses. It can provide data for both individuals in VIVO and on organizations in VIVO. A few examples of VIVO instances:


VIVO Widgets is made of up the following parts.

  1. The web service which used indexed data from VIVO pulled via SPARQL.

  2. Web page widget builder for creating the JavaScript snippets to be included in other sites.

  3. Web Page Widgets: Embeddable JavaScript that allows content to be easily added to other website from VIVO.


  1. Clone the VIVO Widgets project.

  2. Change into the project directory and launch sbt and tell it to create an executable jar.

    $ bin/sbt assembly

This will create an executable jar located at




Widgets uses a very similar file that is used by VIVO. It actually reuses some of the same database connection information, but it also adds a few properties.

Path to solr configuration files on your solr server.


Name of the theme to use.


The URI for your top level organization


Username for updating or rebuilding the index


Password for updating or rebuilding the index

See in the root directory.


Vivo widgets needs a running instance of SOLR. It has been tested with solr 4.7.

You will need to copy the solr/main directory located here into the directory on the server where you have solr running. That is determined by property in the file (see above).

If you are starting from scratch (without an already existing SOLR instance) you can follow steps such as the following:

  1. Download SOLR from

  2. This will likely be a file such as solr_4.7_examples.tar.gz. Try downloading it. You can put that in a tmp directory (for instance).

    cd tmp
    tar xvzf solr_4.7_examples.tar.gz.
    cd .. 
  3. Copy the solr configuration files in ```solr/main`` `into the configuration area of the local solr server. For instance:

    mkdir tmp/solr_4.7_examples/solr/widgetsolr
    cp -R solr/main tmp/solr_4.7_examples/solr/widgetsolr
  4. Start the server with a command much like this. The directories may be different depending on where you put the solr_examples files etc... following the example above:

    java -Dsolr.home=tmp/solr_4.7_examples -Djetty.home=tmp/solr_4.7_examples -server \
     -DSTOP.PORT=8079 -DSTOP.KEY=pleasestop -jar tmp/solr_4.7_examples/start.jar 2> tmp/solr.log &

If you go somwhere like here (depending on the port) you should be able to verify it's running:


And when you are done, remember to make it stop, by running something like this:
  java -Dsolr.home=tmp/solr_4.7_examples  -server -DSTOP.PORT=8079 -DSTOP.KEY=pleasestop -jar tmp/solr_4.7_examples/start.jar --stop

3. Finally, to start vivo_widgets using the jar file run something like the following command:


  $ PORT=8888 java -jar -Xmx500m \
    -Dproperties.location=/path/to/ \
    -Dwidget.logging.dir=/var/log/vivo_widgets/ \

4. Browse to `http://localhost:8888/widgets/builder?uri=.`

5. This will likely say "No Content" - because the Solr index is much like a database, and the database is empty at this point.  But
 it means it is running.  In order to give it content, see the Solr Index section below.

## Solr Index

1. When you first start widgets and setup your database and solr location, you
will need to reindex.  To reindex, run (assuming you are running from the jar file on port 8888):

  $ curl -s -u username:password -X POST  \

For the username and password, these are set in the ```` as
WidgetUpdateSetup.username and WidgetUpdateSetup.password.

2. You can also reindex a specific person or organization. To reindex person, run:

  $ curl -s -u username:password -X POST \

substituting in the person's uri.

3. Once you have data - you can see a page via id by sending the uri paramater. This is just an example:, 


You can query for uri ids via solr itself:


## Developing Locally

1. Clone the project.

2. Change into the project directory.  Put a copy of your with your local config into the following directory
 (see Configuration section for details about this file).


3. To start the application follow the commands based on
 [Scalatra First Project](

  $ bin/sbt
  > container:start 

If you want automatic code reloading, do the following:

  $ bin/sbt
  > container:start
  > ~ ;copy-resources;aux-compile

4. Browse to http://localhost:8080/builder?uri=.

5. NOTE: Building the solr index will be a slightly different command in this case, because running via sbt does NOT add /widgets to 
 the base url, and the default port is 8080:

   $ curl -s -u username:password -X POST  \

### Run the tests

  $ bin/sbt
  > test

or to run only a few tests:

   > test-only edu.duke.oit.solr.test.GrantSpec edu.duke.oit.solr.test.CourseSpec

## Known Issues

* There is an old version of a Jena listener in ``listener/src`` that will no
longer work with this version of vivo widgets.  It needs to be updated to
support a new format of the json to update widgets.
You can’t perform that action at this time.