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

Inherits:
Operation show all
Defined in:
vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/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, into: nil, **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:



327
328
329
330
331
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 327

def initialize(from, into: nil,**options)
  @from = RDF::URI(from)
  @into = RDF::URI(into) if into
  super(**options)
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



306
307
308
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/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)


338
339
340
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 338

def into
  @into
end

Instance Method Details

#to_sObject



343
344
345
346
347
348
349
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 343

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