Class: LD4L::WorksRDF::GetMetadataFromMarcxmlURI
- Inherits:
-
Object
- Object
- LD4L::WorksRDF::GetMetadataFromMarcxmlURI
- Defined in:
- lib/ld4l/works_rdf/services/get_metadata_from_marcxml_uri.rb
Class Method Summary collapse
-
.call(uri, localname_prefix = "") ⇒ Object
Get display metadata via content negotiation from an URI known to return MARCXML.
Class Method Details
.call(uri, localname_prefix = "") ⇒ Object
Get display metadata via content negotiation from an URI known to return MARCXML
11 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 39 40 |
# File 'lib/ld4l/works_rdf/services/get_metadata_from_marcxml_uri.rb', line 11 def self.call( uri, localname_prefix="" ) 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) baseuri = LD4L::WorksRDF.configuration.base_uri baseuri = "#{baseuri}/" unless baseuri.end_with?("/") document_id = URI.parse(uri).path.split('/').last bibframe_work_uri = "#{baseuri}#{localname_prefix}#{document_id}" marcxml = LD4L::WorksRDF::GetMarcxmlFromURI.call(uri) = LD4L::WorksRDF::SetErrorInMetadata.call(uri,'ERROR: Unable to retrieve MARCXML from URI') unless marcxml && marcxml.size > 0 rdfxml = LD4L::WorksRDF::GetRdfxmlFromMarcxml.call(marcxml,baseuri) if marcxml && marcxml.size > 0 = LD4L::WorksRDF::SetErrorInMetadata.call(uri,'ERROR: Unable to convert MARCXML into RDFXMl') unless rdfxml && rdfxml.size > 0 graph = LD4L::WorksRDF::PopulateGraphFromRdfxml.call(rdfxml) if rdfxml && rdfxml.size > 0 = LD4L::WorksRDF::SetErrorInMetadata.call(uri,'ERROR: Unable to populate graph from RDFXML') unless graph repository = LD4L::WorksRDF::PopulateRepositoryFromGraph.call(graph) if graph = LD4L::WorksRDF::SetErrorInMetadata.call(uri,'ERROR: Unable to populate repository from graph') unless repository models = LD4L::WorksRDF::PopulateBibframeModelsFromRepository.call(bibframe_work_uri,repository) if repository = LD4L::WorksRDF::SetErrorInMetadata.call(uri,'ERROR: Unable to populate models from repository') unless models = LD4L::WorksRDF::GetMetadataFromBibframeModels.call(uri, models) if models end |