lib/sparql/client/update.rb in sparql-client-3.0.1 vs lib/sparql/client/update.rb in sparql-client-3.1.0
- old
+ new
@@ -10,16 +10,16 @@
# graph << [RDF::URI('http://example.org/jhacker'), RDF::Vocab::FOAF.name, "J. Random Hacker"]
# end
# insert_data(data)
#
# @example INSERT DATA \{ GRAPH <http://example.org/> \{\}\}
- # insert_data(RDF::Graph.new, :graph => 'http://example.org/')
+ # insert_data(RDF::Graph.new, graph: 'http://example.org/')
# insert_data(RDF::Graph.new).graph('http://example.org/')
#
# @param (see InsertData#initialize)
- def self.insert_data(*arguments)
- InsertData.new(*arguments)
+ def self.insert_data(*arguments, **options)
+ InsertData.new(*arguments, **options)
end
##
# Delete statements from the graph
#
@@ -28,16 +28,16 @@
# graph << [RDF::URI('http://example.org/jhacker'), RDF::Vocab::FOAF.name, "J. Random Hacker"]
# end
# delete_data(data)
#
# @example DELETE DATA \{ GRAPH <http://example.org/> \{\}\}
- # delete_data(RDF::Graph.new, :graph => 'http://example.org/')
+ # delete_data(RDF::Graph.new, graph: 'http://example.org/')
# delete_data(RDF::Graph.new).graph('http://example.org/')
#
# @param (see DeleteData#initialize)
- def self.delete_data(*arguments)
- DeleteData.new(*arguments)
+ def self.delete_data(*arguments, **options)
+ DeleteData.new(*arguments, **options)
end
##
# Load statements into the graph
#
@@ -51,12 +51,12 @@
# @example LOAD <http://example.org/data.rdf> INTO <http://example.org/data.rdf>
# 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))
#
# @param (see Load#initialize)
- def self.load(*arguments)
- Load.new(*arguments)
+ def self.load(*arguments, **options)
+ Load.new(*arguments, **options)
end
##
# Clear the graph
#
@@ -79,12 +79,12 @@
# @example CLEAR SILENT ALL
# clear.all.silent
# clear(:all, silent: true)
#
# @param (see Clear#initialize)
- def self.clear(*arguments)
- Clear.new(*arguments)
+ def self.clear(*arguments, **options)
+ Clear.new(*arguments, **options)
end
##
# Create a graph
#
@@ -94,12 +94,12 @@
# @example CREATE SILENT GRAPH <http://example.org/data.rdf>
# create(RDF::URI(http://example.org/data.rdf)).silent
# create(RDF::URI(http://example.org/data.rdf), silent: true)
#
# @param (see Create#initialize)
- def self.create(*arguments)
- Create.new(*arguments)
+ def self.create(*arguments, **options)
+ Create.new(*arguments, **options)
end
##
# Drop a graph
#
@@ -122,19 +122,19 @@
# @example DROP ALL SILENT
# drop.all.silent
# drop(:all, silent: true)
#
# @param (see Drop#initialize)
- def self.drop(*arguments)
- Drop.new(*arguments)
+ def self.drop(*arguments, **options)
+ Drop.new(*arguments, **options)
end
class Operation
attr_reader :options
- def initialize(*arguments)
- @options = arguments.last.is_a?(Hash) ? arguments.pop.dup : {}
+ def initialize(*arguments, **options)
+ @options = options.dup
unless arguments.empty?
send(arguments.shift, *arguments)
end
end
@@ -169,13 +169,13 @@
# end
# insert_data(data)
#
# @param [Array<RDF::Statement>, RDF::Enumerable] data
# @param [Hash{Symbol => Object}] options
- def initialize(data, options = {})
+ def initialize(data, **options)
@data = data
- super(options)
+ super(**options)
end
##
# Cause data to be inserted into the graph specified by `uri`
#
@@ -219,13 +219,13 @@
# end
# delete_data(data)
#
# @param [Array<RDF::Statement>, RDF::Enumerable] data
# @param [Hash{Symbol => Object}] options
- def initialize(data, options = {})
+ def initialize(data, **options)
@data = data
- super(options)
+ super(**options)
end
##
# Cause data to be deleted from the graph specified by `uri`
#
@@ -251,15 +251,15 @@
class DeleteInsert < Operation
attr_reader :insert_graph
attr_reader :delete_graph
attr_reader :where_graph
- def initialize(_delete_graph, _insert_graph = nil, _where_graph = nil, options = {})
+ def initialize(_delete_graph, _insert_graph = nil, _where_graph = nil, **options)
@delete_graph = _delete_graph
@insert_graph = _insert_graph
@where_graph = _where_graph
- super(options)
+ super(**options)
end
##
# Cause data to be deleted and inserted from the graph specified by `uri`
#
@@ -322,15 +322,14 @@
# load(RDF::URI(http://example.org/data.rdf), into: RDF::URI(http://example.org/data.rdf))
# @param [RDF::URI] from
# @param [Hash{Symbol => Object}] options
# @option [RDF::URI] :into
# @option [Boolean] :silent
- def initialize(from, options = {})
- options = options.dup
+ def initialize(from, into: nil,**options)
@from = RDF::URI(from)
- @into = RDF::URI(options.delete(:into)) if options[:into]
- super(options)
+ @into = RDF::URI(into) if into
+ super(**options)
end
##
# Cause data to be loaded into graph specified by `uri`
#
@@ -418,12 +417,12 @@
# @see http://www.w3.org/TR/sparql11-update/#create
class Create < Operation
attr_reader :uri
# @param [Hash{Symbol => Object}] options
- def initialize(uri, options = {})
+ def initialize(uri, **options)
@uri = RDF::URI(uri)
- super(options)
+ super(**options)
end
def to_s
query_text = 'CREATE '
query_text += 'SILENT ' if self.options[:silent]