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

Inherits:
Operation show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/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



356
357
358
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 356

def uri
  @uri
end

Instance Method Details

#allself

Cause data to be cleared from all graphs

Returns:

  • (self)


390
391
392
393
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 390

def all
  @what = :all
  self
end

#defaultself

Cause data to be cleared from the default graph

Returns:

  • (self)


372
373
374
375
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 372

def default
  @what = :default
  self
end

#expects_statements?false

Clear always returns statements

Returns:

  • (false)


399
400
401
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 399

def expects_statements?
  false
end

#graph(uri) ⇒ self

Cause data to be cleared from graph specified by uri

Parameters:

Returns:

  • (self)


363
364
365
366
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 363

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

#namedself

Cause data to be cleared from named graphs

Returns:

  • (self)


381
382
383
384
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 381

def named
  @what = :named
  self
end

#to_sObject



403
404
405
406
407
408
409
410
411
412
413
414
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 403

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