Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

 

Panel
Excerpt

Remote applications can submit SPARQL queries to obtain data from VIVO. Since VIVO 1.7.

Purpose

Permits external applications to obtain data from the VIVO data model.

...

Code Block
@prefix vitro:   <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://dbpedia.org/resource/Connecticut>
      a       <http://vivoweb.org/ontology/core#StateOrProvince> , 
              <http://purl.obolibrary.org/obo/BFO_0000006> , 
              <http://vivoweb.org/ontology/core#Location> , 
              owl:Thing , 
              <http://vivoweb.org/ontology/core#GeopoliticalEntity> , 
              <http://purl.obolibrary.org/obo/BFO_0000002> , 
              <http://vivoweb.org/ontology/core#GeographicRegion> , 
              <http://purl.obolibrary.org/obo/BFO_0000001> , 
              <http://purl.obolibrary.org/obo/BFO_0000141> , 
              <http://vivoweb.org/ontology/core#GeographicLocation> , 
              <http://purl.obolibrary.org/obo/BFO_0000004> ;
      <http://www.w3.org/2000/01/rdf-schema#label>
              "Connecticut"@en ;
      <http://purl.obolibrary.org/obo/BFO_0000050>
              <http://aims.fao.org/aos/geopolitical.owl#United_States_of_America> ;
      vitro:mostSpecificType
              <http://vivoweb.org/ontology/core#StateOrProvince> .

Enabling the SPARQL Query API

Note

Before enabling the SPARQL Query handlerAPI, you should secure the URL api/sparqlQuery with HTTPS. Otherwise, email/password combinations will be sent across the network without encryption. Methods for securing the URL will depend on your site's configuration.

By default, the SPARQL Query handler API is disabled in VIVO for all users except the root user. To enable it for non-root users, you must create an RDF file in edit the RDF file [vivo]/home/rdf/auth/everytime directory of the VIVO source code that will /permission_config.n3 to authorize your site administrators to use the API. This file is in the vdata/rdf/auth/everytime directory of your vivo install path. The directory path only exists up to rdf, in order to add this file you must create the directory auth inside rdf and then create everytime directory inside of auth. Here is an example of such a file, using N3 syntaxFind the permissions for auth:ADMIN and include the following permission:

Code Block
titleauthorizeSparqlQuerypermission_config.n3
@prefix auth: <http://vitro.mannlib.cornell.edu/ns/vitro/authorization#> .
@prefix simplePermission: <java:edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission#> .
 
# Authorize the ADMIN role to use the SPARQL Query API
auth:ADMIN auth:hasPermission simplePermission:UseSparqlQueryApi .;

After creating editing this file you need to restart tomcat.

...