lib/marc2linkeddata/parseMarcAuthority.rb
# BLOCK ----------------------------------------------------
# Parse authority record without RDF
BLOCK
Parse authority record without RDF
BLOCK Parse authority record without RDF
def parse_auth_name
       Create triples for various kinds of LOC authority.
      name = ''
      if person?
        name = field100[:name]
        graph_type_person(@lib.rdf_uri)
         TODO: find another way to get first and last names without VIAF
          VIAF extracts first and last name, try to use them. Note
          that VIAF uses schema:name, schema:givenName, and schema:familyName.
         if @@config.get_viaf && ! @viaf.nil?
           @viaf.family_names.each do |n|
              ln = URI.encode(n)
              TODO: try to get a language type, if VIAF provide it.
              name = RDF::Literal.new(n, :language => :en)
             ln = RDF::Literal.new(n)
             @graph.insert RDF::Statement(@lib.rdf_uri, RDF::FOAF.familyName, ln) if @@config.use_foaf
             @graph.insert RDF::Statement(@lib.rdf_uri, RDF::SCHEMA.familyName, ln) if @@config.use_schema
           end
           @viaf.given_names.each do |n|
              fn = URI.encode(n)
              TODO: try to get a language type, if VIAF provide it.
              name = RDF::Literal.new(n, :language => :en)
             fn = RDF::Literal.new(n)
             @graph.insert RDF::Statement(@lib.rdf_uri, RDF::FOAF.firstName, fn) if @@config.use_foaf
             @graph.insert RDF::Statement(@lib.rdf_uri, RDF::SCHEMA.givenName, fn) if @@config.use_schema
           end
         end
      elsif name_title?
         e.g. http://id.loc.gov/authorities/names/n79044934
         http://viaf.org/viaf/182251325/rdf.xml
        name = field100[:name]
        graph_insert_type(@lib.rdf_uri, RDF::URI.new('http://www.loc.gov/mads/rdf/v1NameTitle'))
      elsif corporation?
        name = field110[:name]
        graph_type_organization(@lib.rdf_uri)
      elsif conference?
         e.g. http://id.loc.gov/authorities/names/n79044866
        name = [field111[:name],field111[:date],field111[:city]].join('')
        graph_insert_type(@lib.rdf_uri, RDF::SCHEMA.event)
      elsif uniform_title?
        name = field130[:title]   use 'name' for code below, although it's a title
        graph_insert_type(@lib.rdf_uri, RDF::URI.new('http://www.loc.gov/mads/rdf/v1Title'))
        graph_insert_type(@lib.rdf_uri, RDF::SCHEMA.title)
      elsif geographic?
        name = field151[:name]   use 'name' for code below, although it's a place
        graph_insert_type(@lib.rdf_uri, RDF::SCHEMA.Place)
      else
         TODO: find out what type this is.
        binding.pry if @@config.debug
        name = ''
        graph_type_agent(@lib.rdf_uri)
      end
      if name != ''
        name = RDF::Literal.new(name)
        graph_insert_name(@lib.rdf_uri, name)
      end
    end
def parse_auth_name name = '' if person? name = field100 [ :name ] graph_type_person ( @lib . rdf_uri ) elsif name_title? name = field100 [ :name ] graph_insert_type ( @lib . rdf_uri , RDF :: URI . new ( 'http://www.loc.gov/mads/rdf/v1#NameTitle' ) ) elsif corporation? name = field110 [ :name ] graph_type_organization ( @lib . rdf_uri ) elsif conference? name = [ field111 [ :name ] , field111 [ :date ] , field111 [ :city ] ] . join ( '' ) graph_insert_type ( @lib . rdf_uri , RDF :: SCHEMA . event ) elsif uniform_title? name = field130 [ :title ] graph_insert_type ( @lib . rdf_uri , RDF :: URI . new ( 'http://www.loc.gov/mads/rdf/v1#Title' ) ) graph_insert_type ( @lib . rdf_uri , RDF :: SCHEMA . title ) elsif geographic? name = field151 [ :name ] graph_insert_type ( @lib . rdf_uri , RDF :: SCHEMA . Place ) else binding . pry if @@config . debug name = '' graph_type_agent ( @lib . rdf_uri ) end if name != '' name = RDF :: Literal . new ( name ) graph_insert_name ( @lib . rdf_uri , name ) end end
BLOCK
Parse authority record without RDF
BLOCK Parse authority record without RDF
# # Create triples for various kinds of LOC authority. # # TODO: find another way to get first and last names without VIAF # # VIAF extracts first and last name, try to use them. Note # # that VIAF uses schema:name, schema:givenName, and schema:familyName. # if @@config.get_viaf && ! @viaf.nil? #   @viaf.family_names.each do |n| #     # ln = URI.encode(n) #     # TODO: try to get a language type, if VIAF provide it. #     # name = RDF::Literal.new(n, :language => :en) #     ln = RDF::Literal.new(n) #     @graph.insert RDF::Statement(@lib.rdf_uri, RDF::FOAF.familyName, ln) if @@config.use_foaf #     @graph.insert RDF::Statement(@lib.rdf_uri, RDF::SCHEMA.familyName, ln) if @@config.use_schema #   end #   @viaf.given_names.each do |n| #     # fn = URI.encode(n) #     # TODO: try to get a language type, if VIAF provide it. #     # name = RDF::Literal.new(n, :language => :en) #     fn = RDF::Literal.new(n) #     @graph.insert RDF::Statement(@lib.rdf_uri, RDF::FOAF.firstName, fn) if @@config.use_foaf #     @graph.insert RDF::Statement(@lib.rdf_uri, RDF::SCHEMA.givenName, fn) if @@config.use_schema #   end # end # e.g. http://id.loc.gov/authorities/names/n79044934 # http://viaf.org/viaf/182251325/rdf.xml # e.g. http://id.loc.gov/authorities/names/n79044866 # use 'name' for code below, although it's a title # use 'name' for code below, although it's a place # TODO: find out what type this is.