Class: SPARQL::Client::Update::InsertData
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb
Overview
Instance Attribute Summary collapse
- #data ⇒ RDF::Enumerable readonly
Attributes inherited from Operation
Instance Method Summary collapse
-
#expects_statements? ⇒ true
InsertData always returns result set.
-
#graph(uri) ⇒ self
Cause data to be inserted into the graph specified by
uri
. -
#initialize(data, **options) ⇒ InsertData
constructor
Insert statements into the graph.
- #to_s ⇒ Object
Methods inherited from Operation
Constructor Details
#initialize(data, **options) ⇒ InsertData
Insert statements into the graph
174 175 176 177 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 174 def initialize(data, **) @data = data super(**) end |
Instance Attribute Details
#data ⇒ RDF::Enumerable (readonly)
161 162 163 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 161 def data @data end |
Instance Method Details
#expects_statements? ⇒ true
InsertData always returns result set
193 194 195 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 193 def expects_statements? false end |
#graph(uri) ⇒ self
Cause data to be inserted into the graph specified by uri
184 185 186 187 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 184 def graph(uri) self.[:graph] = uri self end |
#to_s ⇒ Object
197 198 199 200 201 202 203 204 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-client-464d3f76cfd5/lib/sparql/client/update.rb', line 197 def to_s query_text = 'INSERT DATA {' query_text += ' GRAPH ' + SPARQL::Client.serialize_uri(self.[:graph]) + ' {' if self.[:graph] query_text += "\n" query_text += RDF::NTriples::Writer.buffer { |writer| @data.each { |d| writer << d } } query_text += '}' if self.[:graph] query_text += "}\n" end |