Module: Tripod::SparqlClient::Update

Defined in:
lib/tripod/sparql_client.rb

Class Method Summary collapse

Class Method Details

.update(sparql) ⇒ true

Runs a sparql update against the endpoint. Returns true if success.

Examples:

Run a query

Tripod::SparqlClient::Update.update('DELETE {?s ?p ?o} WHERE {?s ?p ?o};')

Returns:

  • (true)


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/tripod/sparql_client.rb', line 69

def self.update(sparql)

  begin
    RestClient::Request.execute(
      :method => :post,
      :url => Tripod.update_endpoint,
      :timeout => Tripod.timeout_seconds,
      :payload => {:update => sparql}
    )
    true
  rescue RestClient::BadRequest => e
    # just re-raise as a BadSparqlRequest Exception
    raise Tripod::Errors::BadSparqlRequest.new(e.http_body, e)
  end
end