Class: HarvesterTools::MetadataObject
- Inherits:
-
Object
- Object
- HarvesterTools::MetadataObject
- Defined in:
- lib/metadata_object.rb
Instance Attribute Summary collapse
-
#all_uris ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#comments ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#date ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#full_response ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#graph ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#guidtype ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#hash ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#id ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#links ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#score ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#tested_guid ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#url_header_hash ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#version ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
-
#warnings ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response.
Instance Method Summary collapse
- #add_warning(warning) ⇒ Object
-
#initialize(id: "urn:local:unidentified_metadata") ⇒ MetadataObject
constructor
get a name from the “new” call, or set a default.
- #merge_hash(hash) ⇒ Object
-
#merge_rdf(triples) ⇒ Object
incoming list of triples.
- #rdf ⇒ Object
Constructor Details
#initialize(id: "urn:local:unidentified_metadata") ⇒ MetadataObject
get a name from the “new” call, or set a default
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/metadata_object.rb', line 5 def initialize(id: "urn:local:unidentified_metadata") # get a name from the "new" call, or set a default @id = id @hash = {} @graph = RDF::Graph.new @comments = [] @warnings = [] @full_response = [] @links = [] @guidtype = "" @all_uris = [] @tested_guid = "" @score = 0 @version = '0.0' @date = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%L%z') @url_header_hash = Hash.new(false) # the combinarion of URL and the accept headers, sha1 hashed, for quick lookup if it has already been processed w = RestClient.get("https://raw.githubusercontent.com/markwilkinson/FAIR-Signposting-Harvester/master/lib/warnings.json") #@warn = File.read("./lib/warnings.json") @warn = JSON.parse(w) end |
Instance Attribute Details
#all_uris ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def all_uris @all_uris end |
#comments ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def comments @comments end |
#date ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def date @date end |
#full_response ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def full_response @full_response end |
#graph ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def graph @graph end |
#guidtype ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def guidtype @guidtype end |
#hash ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def hash @hash end |
#id ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def id @id end |
#links ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def links @links end |
#score ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def score @score end |
#tested_guid ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def tested_guid @tested_guid end |
#url_header_hash ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def url_header_hash @url_header_hash end |
#version ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def version @version end |
#warnings ⇒ Object
a hash of metadata # a RDF.rb graph of metadata # an array of comments # the type of GUID that was detected # will be an array of Net::HTTP::Response
3 4 5 |
# File 'lib/metadata_object.rb', line 3 def warnings @warnings end |
Instance Method Details
#add_warning(warning) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/metadata_object.rb', line 39 def add_warning(warning) id = warning[0] return unless @warn[id] # if there's a mismatch between code and the warnings in github url = warning[1] headers = warning[2] = @warn[id]['message'] linkout = @warn[id]['linkout'] severity = @warn[id]['severity'] self.warnings << {"id" => id, "message" => , "severity" => severity, "linkout" => linkout, "processed_url" => url, "accept_headers": headers} end |
#merge_hash(hash) ⇒ Object
25 26 27 28 |
# File 'lib/metadata_object.rb', line 25 def merge_hash(hash) # warn "\n\n\nIncoming Hash #{hash.inspect}" self.hash = self.hash.merge(hash) end |
#merge_rdf(triples) ⇒ Object
incoming list of triples
30 31 32 33 |
# File 'lib/metadata_object.rb', line 30 def merge_rdf(triples) # incoming list of triples graph << triples graph end |
#rdf ⇒ Object
35 36 37 |
# File 'lib/metadata_object.rb', line 35 def rdf graph end |