Class: LD4L::WorksRDF::PopulateOclcModelFromRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/ld4l/works_rdf/services/model_services/populate_oclc_model_from_repository.rb

Class Method Summary collapse

Class Method Details

.call(uri, repository) ⇒ Object

Create a OCLC model and populate it with metadata from the repository.

Parameters:

  • repository (RDF::Repository)

    holding triples



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

def self.call( uri, repository )

  # TODO: Move to common place because this code is repeated in each model_from_repository file
  # Get work as a generic work
  work = LD4L::WorksRDF::GenericWork.new(uri, :data => repository)
  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.
  work = LD4L::WorksRDF::OclcSchemaBook.new(uri, :data => repository)  if types.include? RDF::SCHEMA.Book.to_s
  work
end