def do_update(email, password, base, graph, named_graph, action):
    # Define the VIVO store
    query_endpoint = base.rstrip('/') + '/api/sparqlQuery'
    update_endpoint = base.rstrip('/') + '/api/sparqlUpdate'

    # Setup the VIVO store
    store = VIVOUpdateStore(email, password)
    store.open((query_endpoint, update_endpoint))

    if action == "add":
        added = store.bulk_add(named_graph, graph)
        console("{} triples added to {}.".format(added, named_graph.n3()))
    else:
        removed = store.bulk_remove(named_graph, graph)
        console("{} triples added to {}.".format(removed, named_graph.n3()))
from rdflib import Graph, URIRef, RDF, Literal
from rdflib.graph import Resource
from rdflib.namespace import SKOS, RDFS

from vstore import VIVOUpdateStore, VIVOStore

VIVO_EMAIL = os.environ['VIVO_EMAIL']
VIVO_PASSWORD = os.environ['VIVO_PASSWORD']
VIVO_BASE = os.environ['VIVO_BASE']

# Define the VIVO store
query_endpoint = VIVO_BASE + '/api/sparqlQuery'
update_endpoint = VIVO_BASE + '/api/sparqlUpdate'

# Setup the VIVO store
store = VIVOUpdateStore(VIVO_EMAIL, VIVO_PASSWORD)
store.open((query_endpoint, update_endpoint))

# Identify a named graph where we will be adding our instances.
default_graph = URIRef('http://example.org/vstore-test-graph')
named_graph = Graph(store, identifier=default_graph)

g = Graph()
g.parse(data=
"""
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .