Versions Compared

Key

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

...

Note

By default, the SPARQL Update API is disabled in VIVO, for security reasons. See Enabling the API.

 


Use Cases

Harvester

Previous implementations of the Harvester and similar tools have written directly to the VIVO triple-store, bypassing the usual data channels in VIVO. After ingesting, it was necessary to rebuild the search index, and to run the reasoner to add or remove inferences. Since the search index and the reasoner were not aware of the exact changes, the entire data model was re-indexed and re-inferenced.

...

Code Block
titledelete.sparql
update=DELETE DATA { 
   GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> { 
      <http://test.domain/ns#book1> 
          <http://purl.org/dc/elements/1.1/title> 
          "Design Patterns" . 
    } 
}

Clear example

If you want to remove a named graph entirely, you can use the SPARQL CLEAR method. 

Code Block
titleCLEAR example
curl -i -d 'email=USER' -d 'password=PASSWORD' -d 'update=CLEAR GRAPH IRIRef' 'http://localhost:8080/vivo/api/sparqlUpdate'

Replace IRIRef with the URI of the named graph you want to delete, e.g. <http://localhost/data/people>

Large Files

For large files one can also use the SPARQL LOAD command.

...

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 .

 

...