Class: LD4L::WorksRDF::GetMetadataFromVivoModel
- Inherits:
-
Object
- Object
- LD4L::WorksRDF::GetMetadataFromVivoModel
- Defined in:
- lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_vivo_model.rb
Class Method Summary collapse
-
.call(uri, model) ⇒ Object
Get standard display metadata from an vivo model.
- .populate_with_vivo_book(model) ⇒ Object
Class Method Details
.call(uri, model) ⇒ Object
Get standard display metadata from an vivo model
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_vivo_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_vivo_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_vivo_book(model) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_vivo_model.rb', line 26 def self.populate_with_vivo_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 .pub_info = "#{model.place_of_publication.first} : #{model.publisher.first.label.first}" if model.place_of_publication && model.place_of_publication.size > 0 && model.publisher && model.publisher.size > 0 && model.publisher.first.label .oclc_id = model.oclcnum.first if model.oclcnum && model.oclcnum.size > 0 .source = "VIVO" .set_source_to_cornell_vivo end |