lib/marc2linkeddata/sparql_pubmed.rb
# Note, might have to use first name initial for matching.
Note, might have to use first name initial for matching.
Note might have to use first name initial for matching .
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|
        puts s.inspect
      end
      binding.pry
    end
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 | puts s . inspect end binding . pry end
Note, might have to use first name initial for matching.
Note might have to use first name initial for matching .
# match on first_name? or initials?
last_name
first_name
middle_initial