lib/sparql.rb in sparql-1.1.5 vs lib/sparql.rb in sparql-1.1.6

- old
+ new

@@ -19,17 +19,19 @@ # @example # query = SPARQL.parse("SELECT * WHERE { ?s ?p ?o }") # # @param [IO, StringIO, String, #to_s] query # @param [Hash{Symbol => Object}] options + # @option options [Boolean] :update (false) + # Parse starting with UpdateUnit production, QueryUnit otherwise. # @return [SPARQL::Query] # The resulting query may be executed against # a `queryable` object such as an RDF::Graph # or RDF::Repository. # @raise [Parser::Error] on invalid input def self.parse(query, options = {}) - query = Grammar::Parser.new(query, options).parse + query = Grammar::Parser.new(query, options).parse(options[:update] ? :UpdateUnit : :QueryUnit) end ## # Parse and execute the given SPARQL `query` string against `queriable`. # @@ -80,10 +82,10 @@ queryable = queryable.class.new [options[:default_graph_uri]].flatten.each do |uri| queryable.load(uri) end [options[:named_graph_uri]].flatten.each do |uri| - queryable.load(uri, :context => uri) + queryable.load(uri, context: uri) end end query.execute(queryable, &block) rescue SPARQL::Grammar::Parser::Error => e raise MalformedQuery, e.message