Old Release

This documentation relates to an old version of VIVO, version 1.9.x. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Overview

SPARQL is a query language for RDF-based systems such as Vitro and VIVO.  Using SPARQL one can extract any information from VIVO or Vitro, producing reports, or providing data for other software such as visualizations or user interfaces.

Running SPARQL queries

To run a SPARQL query, navigate to Site Admin > Sparql query.  You will see a page similar to the one below.  Note that the text is in various colors.  VIVO uses the YASQE editor for SPARQL.  You can read more about its features at their web site. See http://yasqe.yasgui.org/  At the top of the Query window are SPARQL prefix declarations for VIVO.  These provides abbreviations for various URLs you use in your SPARQL queries.  For more on SPARQL, see Learning SPARQL.  http://learningsparql.com   Below the prefix declarations is the actual SPARQL query.  

The query in the figure above asks for a sorted list of the entities in VIVO that have type Relationship.  RS_TEXT has been selected as an output format.  This will display in a browser window.  Note that you can select CSV, or TSV.  These will download to your computer.  You may also select RS_XML and RS_JSON – these will also display in your browser window.

Using SPARQL to manage data

ASK Queries

Vitro SPARQL supports ASK queries which return either true (there are triples that satisfy the pattern), or false (there are no triples that satisfy the pattern).  The query below will return true in most VIVOs and false in a new VIVO.

ASK Query
ASK { ?s a vivo:Relationship . }


Additional SPARQL Resources

  • No labels