Module: Marc2LinkedData

Defined in:
lib/marc2linkeddata/parseMarcAuthority.rb,
lib/marc2linkeddata.rb,
lib/marc2linkeddata/cap.rb,
lib/marc2linkeddata/loc.rb,
lib/marc2linkeddata/isni.rb,
lib/marc2linkeddata/viaf.rb,
lib/marc2linkeddata/utils.rb,
lib/marc2linkeddata/cap_db.rb,
lib/marc2linkeddata/sparql.rb,
lib/marc2linkeddata/lib_auth.rb,
lib/marc2linkeddata/resource.rb,
lib/marc2linkeddata/oclc_work.rb,
lib/marc2linkeddata/configuration.rb,
lib/marc2linkeddata/oclc_identity.rb,
lib/marc2linkeddata/oclc_resource.rb,
lib/marc2linkeddata/sparql_pubmed.rb,
lib/marc2linkeddata/sparql_dbpedia.rb,
lib/marc2linkeddata/sparql_local_loc.rb,
lib/marc2linkeddata/oclc_creative_work.rb

Overview

Defined Under Namespace

Classes: Cap, CapDb, Configuration, Isni, LibAuth, Loc, OclcCreativeWork, OclcIdentity, OclcResource, OclcWork, ParseMarcAuthority, Resource, Sparql, SparqlDbpedia, SparqlLocalLoc, SparqlPubmed, Utils, Viaf

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



13
14
15
# File 'lib/marc2linkeddata.rb', line 13

def self.configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



21
22
23
# File 'lib/marc2linkeddata.rb', line 21

def self.configure
  yield(configuration)
end

.http_head_request(url) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/marc2linkeddata.rb', line 25

def self.http_head_request(url)
  uri = nil
  begin
    response = RestClient.head(url)
    uri = response.args[:url]
  rescue
    @configuration.logger.error "RestClient.head failed for #{url}"
    begin
      response = RestClient.get(url)
      uri = response.args[:url]
    rescue
      @configuration.logger.error "RestClient.get failed for #{url}"
    end
  end
  uri
end

.resetObject



17
18
19
# File 'lib/marc2linkeddata.rb', line 17

def self.reset
  @configuration = Configuration.new
end

.write_prefixes(file) ⇒ Object



42
43
44
45
# File 'lib/marc2linkeddata.rb', line 42

def self.write_prefixes(file)
  @configuration.prefixes.each_pair {|k,v| file.write "@prefix #{k}: <#{v}> .\n" }
  file.write("\n\n")
end