Sha256: 040d282a9b73f82f3046d627536f05e6bd38509284a879e8d99bcbbf302fad44
Contents?: true
Size: 716 Bytes
Versions: 4
Compression:
Stored size: 716 Bytes
Contents
require 'sparql/client' require 'flavour_saver' module TogoStanza::Stanza module Querying MAPPINGS = { togogenome: 'http://togogenome.org/sparql' } def query(endpoint, text_or_filename) path = File.join(root, 'sparql', text_or_filename) if File.exist?(path) data = OpenStruct.new params text_or_filename = Tilt.new(path).render(data) end client = SPARQL::Client.new(MAPPINGS[endpoint] || endpoint, :method => "get") #Rails.logger.debug "SPARQL QUERY: \n#{sparql}" client.query(text_or_filename).map {|binding| binding.each_with_object({}) {|(name, term), hash| hash[name] = term.to_s } } end end end
Version data entries
4 entries across 4 versions & 1 rubygems