Class: SPARQL::Client::Update::Load

Inherits:
Operation show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb

Overview

Instance Attribute Summary collapse

Attributes inherited from Operation

#options

Instance Method Summary collapse

Methods inherited from Operation

#expects_statements?, #silent

Constructor Details

#initialize(from, options = {}) ⇒ Load

Load statements into the graph

Examples:

load(RDF::URI(http://example.org/data.rdf))

load(RDF::URI(http://example.org/data.rdf)).silent
load(RDF::URI(http://example.org/data.rdf), silent: true)

load(RDF::URI(http://example.org/data.rdf)).into(RDF::URI(http://example.org/data.rdf))
load(RDF::URI(http://example.org/data.rdf), into: RDF::URI(http://example.org/data.rdf))

Parameters:

  • from (RDF::URI)
  • options (Hash{Symbol => Object}) (defaults to: {})
  • [RDF::URI] (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options



327
328
329
330
331
332
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 327

def initialize(from, options = {})
  options = options.dup
  @from = RDF::URI(from)
  @into = RDF::URI(options.delete(:into)) if options[:into]
  super(options)
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from



306
307
308
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 306

def from
  @from
end

#into(uri) ⇒ self (readonly)

Cause data to be loaded into graph specified by uri

Parameters:

Returns:

  • (self)


339
340
341
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 339

def into
  @into
end

Instance Method Details

#to_sObject



344
345
346
347
348
349
350
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-client-204355edf946/lib/sparql/client/update.rb', line 344

def to_s
  query_text = 'LOAD '
  query_text += 'SILENT ' if self.options[:silent]
  query_text += SPARQL::Client.serialize_uri(@from)
  query_text += ' INTO GRAPH ' + SPARQL::Client.serialize_uri(@into) if @into
  query_text
end