Method: RDF::Query#variables

Defined in:
lib/rdf/query.rb

#variablesHash{Symbol => RDF::Query::Variable}

The variables used in this query. This includes variables used in patterns along with the graph_name itself, if it is a variable.

Returns:

Since:

  • 0.3.0



468
469
470
471
472
473
474
# File 'lib/rdf/query.rb', line 468

def variables
  # Set variables used in query
  vars = patterns.inject({}) do |memo, pattern|
    memo.merge(pattern.variables)
  end
  graph_name.is_a?(Variable) ? vars.merge(graph_name.to_sym => graph_name) : vars
end