Versions Compared

Key

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

Table of Contents

Panel

Remote applications can perform SPARQL Update calls to add RDF to VIVO, or to remove existing RDF. Since VIVO 1.6.

Purpose

Permits external applications to add or remove specific triples from the VIVO data model. These changes use the standard data channels in VIVO, so the search index will be updated as appropriate, and the reasoner will add or remove inferences as needed.

...

Code Block
languagexml
titleimport.sparql
update=LOAD <http://myserver.address.xxx/data.rdf> into graph <http://vitro.mannlib.cornell.edu/default/vitro-kb-2>
Note

Could you also handle large files by increasing the size limit on POST requests? The Tomcat configuration page says that maxPostSize is set to 2 megabytes, by default.

A Python example

...

Increase the default Tomcat maxPostSize

By default, Tomcat sets the default maximum of a POST request to 2 megabytes. If you want to increase this to be able to POST larger sets of triples to VIVO, you can use the maxPostSize attribute in server.xml. The example below would increase the maximum to 10 MB. See the Tomcat documentation for more details.


Code Block
languagexml
titleserver.xml
<Connector port="8080" protocol="HTTP/1.1"
    connectionTimeout="20000"
   URIEncoding="UTF-8"
   redirectPort="8443" 
   maxPostSize="10485760"/>

Enabling the API


Note

Before enabling the SPARQL update handler, you should secure the URL api/sparqlUpdate 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.

...

  •   uncomment the line references "UseSparqUpdateAPI" in [vitro]/rdf/auth/everytime/permission_config.n3 or
  •   create an RDF file in the [vitro]/rdf/auth/everytime directory that will authorize your site administrators to use the API. Below is an example of such a file, using N3 syntax.
Code Block
titleauthorizeSparqlUpdate.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 Update API
auth:ADMIN auth:hasPermission simplePermission:UseSparqlUpdateApi .

...