Class: LD4L::WorksRDF::GetMetadataFromGenericModel
- Inherits:
-
Object
- Object
- LD4L::WorksRDF::GetMetadataFromGenericModel
- Defined in:
- lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_generic_model.rb
Class Method Summary collapse
-
.call(uri, model) ⇒ Object
Attempt to get standard display metadata from a various models.
Class Method Details
.call(uri, model) ⇒ Object
Attempt to get standard display metadata from a various models.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ld4l/works_rdf/services/metadata_services/get_metadata_from_generic_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) work = model[:work] if model.kind_of? Hash work = model unless model.kind_of? Hash # TODO: Move to common place because this code is repeated in each model_from_repository file # Get work as a generic work types = [] work.type.each do |t| types << t.to_s end # TODO: Need to support multiple types (e.g. book, music, video). Currently only supporting books. = LD4L::WorksRDF::GetMetadataFromBiboModel.call(uri,model) if types.include? RDFVocabularies::BIBO.Book.to_s = LD4L::WorksRDF::GetMetadataFromBiboModel.call(uri,model) if types.include? RDFVocabularies::BIBO.Document.to_s = LD4L::WorksRDF::PopulateBibframeModelsFromRepository.call(uri,model) if types.include? RDFVocabularies::BF.Work.to_s = LD4L::WorksRDF::GetMetadataFromOclcModel.new(uri,model) if types.include? RDF::SCHEMA.Book.to_s .source = URI.parse(uri).host .set_source_to_unknown end |