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

Inherits:
Operation
  • Object
show all
Defined in:
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 SILENT<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})
  • [RDF::URI] (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options



327
328
329
330
331
# File '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 '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:

  • uri (RDF::URI)

Returns:

  • (self)


338
339
340
# File 'lib/sparql/client/update.rb', line 338

def into
  @into
end

Instance Method Details

#to_sObject



343
344
345
346
347
348
349
# File '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