Class: SPARQL::Algebra::Operator::Describe
- Inherits:
-
Binary
- Object
- SPARQL::Algebra::Operator
- Binary
- SPARQL::Algebra::Operator::Describe
- Includes:
- Query
- Defined in:
- lib/sparql/algebra/operator/describe.rb
Overview
The SPARQL GraphPattern describe operator.
Generages a graph across specified terms using RDF::Queryable#concise_bounded_description.
Constant Summary
- NAME =
[:describe]
Constants inherited from Binary
Constants inherited from SPARQL::Algebra::Operator
Instance Attribute Summary
Attributes included from Query
Attributes inherited from SPARQL::Algebra::Operator
Instance Method Summary (collapse)
-
- (RDF::Query::Solutions) execute(queryable, options = {})
Executes this query on the given RDF::Queryable object.
-
- (Union, RDF::Query) optimize
Returns an optimized version of this query.
Methods included from Query
#context=, #each_solution, #failed?, #matched?, #unshift, #variables
Methods inherited from Binary
Methods inherited from SPARQL::Algebra::Operator
arity, base_uri, #base_uri, base_uri=, #boolean, #constant?, #eql?, #evaluatable?, evaluate, #executable?, for, #initialize, #inspect, #operand, prefixes, #prefixes, prefixes=, #to_sse, #to_sxp, #variable?
Methods included from Evaluatable
Methods included from Expression
cast, #constant?, #evaluate, for, new, open, parse, #to_sse, #variable?
Constructor Details
This class inherits a constructor from SPARQL::Algebra::Operator::Binary
Instance Method Details
- (RDF::Query::Solutions) execute(queryable, options = {})
Executes this query on the given RDF::Queryable object. Generates a graph containing the Concise Bounded Description variables and URIs listed in the first operand.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sparql/algebra/operator/describe.rb', line 39 def execute(queryable, = {}) debug("Describe #{operands.first}, #{.inspect}", ) # Describe any constand URIs to_describe = operands.first.select {|t| t.uri?} to_describe.each {|t| debug("=> describe #{t}", )} operands.last.execute(queryable).each do |solution| solution.each_variable do |v| if operands.first.any? {|bound| v.eql?(bound)} debug("=> describe #{v}", ) to_describe << v.value end end end # Return Concise Bounded Description queryable.concise_bounded_description(*to_describe) end |
- (Union, RDF::Query) optimize
Returns an optimized version of this query.
Return optimized query
66 67 68 |
# File 'lib/sparql/algebra/operator/describe.rb', line 66 def optimize operands = operands.map(&:optimize) end |