class Marc2LinkedData::SparqlPubmed

Public Class Methods

new() click to toggle source
Calls superclass method Marc2LinkedData::Sparql::new
# File lib/marc2linkeddata/sparql_pubmed.rb, line 7
def initialize
  # config = Marc2LinkedData.configuration
  super('http://pubmed.bio2rdf.org/sparql')
end

Public Instance Methods

find_author(last_name, first_name=nil, middle_initial=nil) click to toggle source

Note, might have to use first name initial for matching.

# File lib/marc2linkeddata/sparql_pubmed.rb, line 28
def find_author(last_name, first_name=nil, middle_initial=nil)
  q  = 'SELECT DISTINCT ?author ?fn WHERE { '
  q += '?author a <http://bio2rdf.org/pubmed_vocabulary:Author> . '
  q += '?author <http://bio2rdf.org/pubmed_vocabulary:fore_name> ?fn . '
  q += "?author <http://bio2rdf.org/pubmed_vocabulary:last_name> \"#{last_name}\"^^<http://www.w3.org/2001/XMLSchema#string> . "
  q += '}'
  result = @sparql.query(q)
  result.each_solution do |s|
    # match on first_name? or initials?
    puts s.inspect
  end
  binding.pry
end