Class: LD4L::WorksRDF::GetMetadataFromBiboModel

Inherits:
Object
  • Object
show all
Defined in:
lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_bibo_model.rb

Class Method Summary collapse

Class Method Details

.call(uri, model) ⇒ Object

Get standard display metadata from an bibo model

Parameters:

  • uri (String, RDF::URI)

    for the work

  • an (Model)

    bibo model

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_bibo_model.rb', line 12

def self.call( uri, model )
  raise ArgumentError, 'uri argument must be a uri string or an instance of RDF::URI'  unless
      uri.kind_of?(String) && uri.size > 0 || uri.kind_of?(RDF::URI)

  uri = uri.to_s if uri.kind_of?(RDF::URI)

  # TODO: Determine type of work from the model.  Right now, only processing books.
   = self.populate_with_bibo_book( model )  if
      model.type.include?(RDFVocabularies::BIBO.Book.to_s) || model.type.include?(RDFVocabularies::BIBO.Document.to_s)
  .uri      = uri
  .local_id = URI.parse(uri).path.split('/').last
  
end

.populate_with_bibo_book(model) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_bibo_model.rb', line 26

def self.populate_with_bibo_book( model )
  # TODO: Could reach out to OCLC and get more info OR could make multiple calls to VIVO to get more info
   = LD4L::WorksRDF::WorkMetadata.new(model)
  .set_type_to_book
  if model.title && model.title.size > 0
    .title            = model.title.first
  elsif model.label && model.label.size > 0
    .title            = model.label.first
  end
  .oclc_id          = model.oclcnum.first  if model.oclcnum && model.oclcnum.size > 0
  # metadata.source           = "BIBO"
  .set_source_to_unknown
  
end