Class: LD::Patch::Algebra::Index
- Inherits:
-
SPARQL::Algebra::Operator::Unary
- Object
- SPARQL::Algebra::Operator
- SPARQL::Algebra::Operator::Unary
- LD::Patch::Algebra::Index
- Includes:
- SPARQL::Algebra::Query
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/index.rb
Overview
The LD Patch index
operator.
Presuming that the input term identifies an rdf:List, returns the list element indexted by the single operand, or an empty solution set
Constant Summary collapse
- NAME =
:index
Constants inherited from SPARQL::Algebra::Operator::Unary
SPARQL::Algebra::Operator::Unary::ARITY
Constants inherited from SPARQL::Algebra::Operator
SPARQL::Algebra::Operator::ARITY, SPARQL::Algebra::Operator::IsURI, SPARQL::Algebra::Operator::URI
Constants included from SPARQL::Algebra::Expression
SPARQL::Algebra::Expression::PATTERN_PARENTS
Constants included from RDF::Util::Logger
Instance Attribute Summary
Attributes included from SPARQL::Algebra::Query
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary collapse
-
#execute(queryable, options = {}) ⇒ RDF::Query::Solutions
Executes this upate on the given
writable
graph or repository.
Methods included from SPARQL::Algebra::Query
#each_solution, #empty?, #failed?, #graph_name=, #matched?, #query_yields_boolean?, #query_yields_solutions?, #query_yields_statements?, #unshift, #variables
Methods inherited from SPARQL::Algebra::Operator::Unary
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_sparql, #to_sxp, #to_sxp_bin, #validate!, #variable?, #variables, #vars
Methods included from SPARQL::Algebra::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::Unary
Instance Method Details
#execute(queryable, options = {}) ⇒ RDF::Query::Solutions
Executes this upate on the given writable
graph or repository.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/ld-patch-a8edc852261e/lib/ld/patch/algebra/index.rb', line 21 def execute(queryable, = {}) debug() {"Index"} terms = Array(.fetch(:terms)) index = operand(0) results = terms.map do |term| list = RDF::List.new(subject: term, graph: queryable) list.at(index.to_i) end.flatten RDF::Query::Solutions.new(results.map {|t| RDF::Query::Solution.new(path: t)}) end |