Class: SPARQL::Algebra::Operator::Load
- Inherits:
-
SPARQL::Algebra::Operator
- Object
- SPARQL::Algebra::Operator
- SPARQL::Algebra::Operator::Load
- Includes:
- Update
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/load.rb
Overview
The SPARQL UPDATE load
operator.
The LOAD operation reads an RDF document from a IRI and inserts its triples into the specified graph in the Graph Store. The specified destination graph should be created if required; again, implementations providing an update service over a fixed set of graphs must return with failure for a request that would create a disallowed graph. If the destination graph already exists, then no data in that graph will be removed.
[31] Load ::= 'LOAD' 'SILENT'? iri ( 'INTO' GraphRef )?
Constant Summary collapse
- NAME =
[:load]
Constants inherited from SPARQL::Algebra::Operator
Constants included from Expression
Constants included from RDF::Util::Logger
Instance Attribute Summary
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
-
#execute(queryable, **options) ⇒ RDF::Queryable
Executes this upate on the given
writable
graph or repository. -
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
Methods included from Update
#graph_name=, #unshift, #variables
Methods inherited from SPARQL::Algebra::Operator
#aggregate?, arity, base_uri, #base_uri, base_uri=, #bind, #boolean, #constant?, #deep_dup, #each_descendant, #eql?, #evaluatable?, evaluate, #executable?, #first_ancestor, for, #formulae, #initialize, #inspect, #mergable?, #ndvars, #node?, #operand, #optimize, #optimize!, #parent, #parent=, #prefixes, prefixes, prefixes=, #rewrite, #to_binary, to_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars
Methods included from Expression
cast, #constant?, #evaluate, extension, extension?, extensions, for, #invalid?, new, #node?, open, #optimize, #optimize!, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?
Methods included from RDF::Util::Logger
#log_debug, #log_depth, #log_error, #log_fatal, #log_info, #log_recover, #log_recovering?, #log_statistics, #log_warn, #logger
Constructor Details
This class inherits a constructor from SPARQL::Algebra::Operator
Instance Method Details
#execute(queryable, **options) ⇒ RDF::Queryable
Executes this upate on the given writable
graph or repository.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/load.rb', line 38 def execute(queryable, **) debug() {"Load"} silent = operands.first == :silent operands.shift if silent raise ArgumentError, "load expected one or two operands, got #{operands.length}" unless [1,2].include?(operands.length) location, name = operands queryable.load(location, graph_name: name) rescue IOError, Errno::ENOENT raise unless silent ensure queryable end |
#to_sparql(**options) ⇒ String
Returns a partial SPARQL grammar for this operator.
58 59 60 61 62 63 64 65 66 67 68 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/sparql-796d3be4aa08/lib/sparql/algebra/operator/load.rb', line 58 def to_sparql(**) silent = operands.first == :silent ops = silent ? operands[1..-1] : operands location, name = ops str = "LOAD " str << "SILENT " if silent str << location.to_sparql(**) str << " INTO GRAPH " + name.to_sparql(**) if name str end |