Versions Compared

Key

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

...

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" . 
    } 
}

A more complex deletion

This update removes an Email address from a Person in VIVO. The Person is related to a VCard:ContactInfo object, which is related to a VCard:EMail object, which has the email address in a data property.

Code Block
languagebash
curl -i -d 'email=testAdmin@mydomain.edu' -d 'password=Password' -d '@delete_email.ru' 'http://localhost:8080/vivo/api/sparqlUpdate'
Code Block
titledelete_email.ru
update=
PREFIX obo:      <http://purl.obolibrary.org/obo/>
PREFIX vcard:    <http://www.w3.org/2006/vcard/ns#>

DELETE {
  GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> {
    ?contactInfo vcard:hasEmail ?emailObject .
    ?emailObject ?p1 ?o .
  }
} WHERE {
  GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> {
    <http://vivo.mydomain.edu/individual/n4295> obo:ARG_2000028 ?contactInfo .
    ?contactInfo vcard:hasEmail ?emailObject .
    ?emailObject vcard:email "my.primary@email.com"^^<http://www.w3.org/2001/XMLSchema#string> .
    ?emailObject ?p1 ?o .
  }
}

 

Big Files

For big files one can also use the SPARQL LOAD command. For this, you have to first create the RDF file with the triples that you want to add make it accessible at a URL that VIVO can access. In the example below, the RDF file containing the triples are the data.rdf (available in the root directory of the web server that respond by the address myserver.address.xxx) and the sparql file below contains the LOAD command to be execute by the SPARQL VIVO API.

...