Class: SPARQL::Client::Update::Clear

Inherits:
Operation show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb

Overview

Direct Known Subclasses

Drop

Instance Attribute Summary collapse

Attributes inherited from Operation

#options

Instance Method Summary collapse

Methods inherited from Operation

#initialize, #silent

Constructor Details

This class inherits a constructor from SPARQL::Client::Update::Operation

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



355
356
357
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 355

def uri
  @uri
end

Instance Method Details

#allself

Cause data to be cleared from all graphs

Returns:

  • (self)


389
390
391
392
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 389

def all
  @what = :all
  self
end

#defaultself

Cause data to be cleared from the default graph

Returns:

  • (self)


371
372
373
374
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 371

def default
  @what = :default
  self
end

#expects_statements?false

Clear always returns statements

Returns:

  • (false)


398
399
400
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 398

def expects_statements?
  false
end

#graph(uri) ⇒ self

Cause data to be cleared from graph specified by uri

Parameters:

Returns:

  • (self)


362
363
364
365
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 362

def graph(uri)
  @what, @uri = :graph, uri
  self
end

#namedself

Cause data to be cleared from named graphs

Returns:

  • (self)


380
381
382
383
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 380

def named
  @what = :named
  self
end

#to_sObject



402
403
404
405
406
407
408
409
410
411
412
413
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 402

def to_s
  query_text = 'CLEAR '
  query_text += 'SILENT ' if self.options[:silent]
  case @what.to_sym
    when :graph   then query_text += 'GRAPH ' + SPARQL::Client.serialize_uri(@uri)
    when :default then query_text += 'DEFAULT'
    when :named   then query_text += 'NAMED'
    when :all     then query_text += 'ALL'
    else raise ArgumentError, "invalid CLEAR operation: #{@what.inspect}"
  end
  query_text
end