Class: Qa::Services::RDFAuthorityParser
- Inherits:
-
Object
- Object
- Qa::Services::RDFAuthorityParser
- Defined in:
- lib/qa/services/rdf_authority_parser.rb
Overview
Class to parse downloaded content from rdf sources such as Library of Congress and Lexvo to create LocalAuthorityEntries for a named LocalAuthority.
Example calls: RDFAuthorityParser.import_rdf(‘subjects’,) RDFAuthorityParser.import_rdf(‘languages’,,
format: 'rdfxml',
predicate: RDF::URI("http://www.w3.org/2008/05/skos#prefLabel"))
Class Method Summary collapse
-
.import_rdf(name, sources, opts = {}) ⇒ Object
import the rdf from the sources and store them as entries for the named LocalAuthority.
Class Method Details
.import_rdf(name, sources, opts = {}) ⇒ Object
import the rdf from the sources and store them as entries for the named LocalAuthority
defaults to :ntripples
defaults to http://www.w3.org/2004/02/skos/core#prefLabel
29 30 31 32 33 34 35 36 |
# File 'lib/qa/services/rdf_authority_parser.rb', line 29 def import_rdf(name, sources, opts = {}) = Qa::LocalAuthority.find_or_create_by(name: name) format = opts.fetch(:format, :ntriples) predicate = opts.fetch(:predicate, ::RDF::Vocab::SKOS.prefLabel) sources.each do |uri| import_source(, format, predicate, uri) end end |