Class: SPARQL::Client::Update::DeleteInsert
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb
Overview
Instance Attribute Summary collapse
-
#delete_graph ⇒ Object
readonly
Returns the value of attribute delete_graph.
-
#insert_graph ⇒ Object
readonly
Returns the value of attribute insert_graph.
-
#where_graph ⇒ Object
readonly
Returns the value of attribute where_graph.
Attributes inherited from Operation
Instance Method Summary collapse
-
#graph(uri) ⇒ self
Cause data to be deleted and inserted from the graph specified by
uri
. -
#initialize(_delete_graph, _insert_graph = nil, _where_graph = nil, **options) ⇒ DeleteInsert
constructor
A new instance of DeleteInsert.
- #to_s ⇒ Object
Methods inherited from Operation
Constructor Details
#initialize(_delete_graph, _insert_graph = nil, _where_graph = nil, **options) ⇒ DeleteInsert
Returns a new instance of DeleteInsert.
256 257 258 259 260 261 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 256 def initialize(_delete_graph, _insert_graph = nil, _where_graph = nil, **) @delete_graph = _delete_graph @insert_graph = _insert_graph @where_graph = _where_graph super(**) end |
Instance Attribute Details
#delete_graph ⇒ Object (readonly)
Returns the value of attribute delete_graph.
253 254 255 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 253 def delete_graph @delete_graph end |
#insert_graph ⇒ Object (readonly)
Returns the value of attribute insert_graph.
252 253 254 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 252 def insert_graph @insert_graph end |
#where_graph ⇒ Object (readonly)
Returns the value of attribute where_graph.
254 255 256 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 254 def where_graph @where_graph end |
Instance Method Details
#graph(uri) ⇒ self
Cause data to be deleted and inserted from the graph specified by uri
268 269 270 271 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 268 def graph(uri) self.[:graph] = uri self end |
#to_s ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 273 def to_s buffer = [] if self.[:graph] buffer << "WITH" buffer << SPARQL::Client.serialize_uri(self.[:graph]) end if delete_graph and !delete_graph.empty? serialized_delete = SPARQL::Client.serialize_patterns delete_graph, true buffer << "DELETE {\n" buffer += serialized_delete buffer << "}\n" end if insert_graph and !insert_graph.empty? buffer << "INSERT {\n" buffer += SPARQL::Client.serialize_patterns insert_graph, true buffer << "}\n" end buffer << "WHERE {\n" if where_graph buffer += SPARQL::Client.serialize_patterns where_graph, true elsif serialized_delete buffer += serialized_delete end buffer << "}\n" buffer.join(' ') end |