Class: Bolognese::Metadata
- Inherits:
-
Object
- Object
- Bolognese::Metadata
- Includes:
- AuthorUtils, DataciteUtils, DateUtils, DoiUtils, Readers::BibtexReader, Readers::CiteprocReader, Readers::CodemetaReader, Readers::CrossciteReader, Readers::CrossrefReader, Readers::DataciteJsonReader, Readers::DataciteReader, Readers::RisReader, Readers::SchemaOrgReader, Utils, Writers::BibtexWriter, Writers::CitationWriter, Writers::CiteprocWriter, Writers::CodemetaWriter, Writers::CrossciteWriter, Writers::CrossrefWriter, Writers::DataciteJsonWriter, Writers::DataciteWriter, Writers::JatsWriter, Writers::RdfXmlWriter, Writers::RisWriter, Writers::SchemaOrgWriter, Writers::TurtleWriter
- Defined in:
- lib/bolognese/metadata.rb
Direct Known Subclasses
Constant Summary
Constants included from Readers::SchemaOrgReader
Readers::SchemaOrgReader::SO_TO_DC_RELATION_TYPES
Constants included from Readers::RisReader
Readers::RisReader::RIS_TO_BIB_TRANSLATIONS, Readers::RisReader::RIS_TO_CP_TRANSLATIONS, Readers::RisReader::RIS_TO_SO_TRANSLATIONS
Constants included from Readers::CrossrefReader
Readers::CrossrefReader::CONTACT_EMAIL, Readers::CrossrefReader::CR_TO_BIB_TRANSLATIONS, Readers::CrossrefReader::CR_TO_SO_TRANSLATIONS
Constants included from Readers::CiteprocReader
Readers::CiteprocReader::CP_TO_RIS_TRANSLATIONS, Readers::CiteprocReader::CP_TO_SO_TRANSLATIONS
Constants included from Readers::BibtexReader
Readers::BibtexReader::BIB_TO_CP_TRANSLATIONS, Readers::BibtexReader::BIB_TO_RIS_TRANSLATIONS, Readers::BibtexReader::BIB_TO_SO_TRANSLATIONS
Constants included from Utils
Utils::CR_TO_CP_TRANSLATIONS, Utils::CR_TO_JATS_TRANSLATIONS, Utils::CR_TO_RIS_TRANSLATIONS, Utils::DC_TO_CP_TRANSLATIONS, Utils::DC_TO_RIS_TRANSLATIONS, Utils::DC_TO_SO_TRANSLATIONS, Utils::LICENSE_NAMES, Utils::SO_TO_BIB_TRANSLATIONS, Utils::SO_TO_CP_TRANSLATIONS, Utils::SO_TO_DC_TRANSLATIONS, Utils::SO_TO_JATS_TRANSLATIONS, Utils::SO_TO_RIS_TRANSLATIONS
Constants included from AuthorUtils
AuthorUtils::IDENTIFIER_SCHEME_URIS
Instance Attribute Summary collapse
-
#additional_type ⇒ Object
Returns the value of attribute additional_type.
-
#alternate_name ⇒ Object
Returns the value of attribute alternate_name.
-
#author ⇒ Object
Returns the value of attribute author.
-
#bibtex_type ⇒ Object
Returns the value of attribute bibtex_type.
-
#citeproc_type ⇒ Object
Returns the value of attribute citeproc_type.
-
#cites ⇒ Object
Returns the value of attribute cites.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#compiles ⇒ Object
Returns the value of attribute compiles.
-
#content_size ⇒ Object
Returns the value of attribute content_size.
-
#continues ⇒ Object
Returns the value of attribute continues.
-
#contributor ⇒ Object
Returns the value of attribute contributor.
-
#date_accepted ⇒ Object
Returns the value of attribute date_accepted.
-
#date_available ⇒ Object
Returns the value of attribute date_available.
-
#date_collected ⇒ Object
Returns the value of attribute date_collected.
-
#date_copyrighted ⇒ Object
Returns the value of attribute date_copyrighted.
-
#date_created ⇒ Object
Returns the value of attribute date_created.
-
#date_modified ⇒ Object
Returns the value of attribute date_modified.
-
#date_registered ⇒ Object
Returns the value of attribute date_registered.
-
#date_submitted ⇒ Object
Returns the value of attribute date_submitted.
-
#date_updated ⇒ Object
Returns the value of attribute date_updated.
-
#date_valid ⇒ Object
Returns the value of attribute date_valid.
-
#description ⇒ Object
Returns the value of attribute description.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#documents ⇒ Object
Returns the value of attribute documents.
-
#doi ⇒ Object
Returns the value of attribute doi.
-
#editor ⇒ Object
Returns the value of attribute editor.
-
#errors ⇒ Object
readonly
validate against DataCite schema, unless there are already errors in the reader.
-
#first_page ⇒ Object
Returns the value of attribute first_page.
-
#format ⇒ Object
Returns the value of attribute format.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#funding ⇒ Object
Returns the value of attribute funding.
-
#has_metadata ⇒ Object
Returns the value of attribute has_metadata.
-
#has_part ⇒ Object
Returns the value of attribute has_part.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_cited_by ⇒ Object
Returns the value of attribute is_cited_by.
-
#is_compiled_by ⇒ Object
Returns the value of attribute is_compiled_by.
-
#is_continued_by ⇒ Object
Returns the value of attribute is_continued_by.
-
#is_derived_from ⇒ Object
Returns the value of attribute is_derived_from.
-
#is_documented_by ⇒ Object
Returns the value of attribute is_documented_by.
-
#is_metadata_for ⇒ Object
Returns the value of attribute is_metadata_for.
-
#is_new_version_of ⇒ Object
Returns the value of attribute is_new_version_of.
-
#is_original_form_of ⇒ Object
Returns the value of attribute is_original_form_of.
-
#is_previous_version_of ⇒ Object
Returns the value of attribute is_previous_version_of.
-
#is_referenced_by ⇒ Object
Returns the value of attribute is_referenced_by.
-
#is_reviewed_by ⇒ Object
Returns the value of attribute is_reviewed_by.
-
#is_source_of ⇒ Object
Returns the value of attribute is_source_of.
-
#is_supplement_to ⇒ Object
Returns the value of attribute is_supplement_to.
-
#is_supplemented_by ⇒ Object
Returns the value of attribute is_supplemented_by.
-
#is_variant_form_of ⇒ Object
Returns the value of attribute is_variant_form_of.
-
#issue ⇒ Object
Returns the value of attribute issue.
-
#journal ⇒ Object
Returns the value of attribute journal.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#language ⇒ Object
Returns the value of attribute language.
-
#last_page ⇒ Object
Returns the value of attribute last_page.
-
#license ⇒ Object
Returns the value of attribute license.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#name_detector ⇒ Object
readonly
recognize given name.
-
#page_end ⇒ Object
readonly
Returns the value of attribute page_end.
-
#page_start ⇒ Object
readonly
Returns the value of attribute page_start.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#provider_id ⇒ Object
Returns the value of attribute provider_id.
-
#publisher ⇒ Object
Returns the value of attribute publisher.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#references ⇒ Object
Returns the value of attribute references.
-
#related_identifier ⇒ Object
readonly
Returns the value of attribute related_identifier.
-
#reverse ⇒ Object
readonly
Returns the value of attribute reverse.
-
#reviews ⇒ Object
Returns the value of attribute reviews.
-
#ris_type ⇒ Object
Returns the value of attribute ris_type.
-
#same_as ⇒ Object
Returns the value of attribute same_as.
-
#schema_version ⇒ Object
Returns the value of attribute schema_version.
-
#should_passthru ⇒ Object
readonly
Returns the value of attribute should_passthru.
-
#spatial_coverage ⇒ Object
Returns the value of attribute spatial_coverage.
-
#state ⇒ Object
Returns the value of attribute state.
-
#style ⇒ Object
Returns the value of attribute style.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
-
#version ⇒ Object
Returns the value of attribute version.
-
#volume ⇒ Object
Returns the value of attribute volume.
Instance Method Summary collapse
- #container_title ⇒ Object
- #date_published ⇒ Object
- #descriptions ⇒ Object
- #exists? ⇒ Boolean
- #graph ⇒ Object
-
#initialize(input: nil, from: nil, style: nil, locale: nil, regenerate: false, **options) ⇒ Metadata
constructor
A new instance of Metadata.
- #is_identical_to ⇒ Object
- #is_part_of ⇒ Object
- #publication_year ⇒ Object
- #related_identifier_hsh(relation_type) ⇒ Object
- #resource_type_general ⇒ Object
- #valid? ⇒ Boolean
Methods included from Writers::TurtleWriter
Methods included from Writers::SchemaOrgWriter
Methods included from Writers::RisWriter
Methods included from Writers::RdfXmlWriter
Methods included from Writers::JatsWriter
#date, #insert_authors, #insert_citation, #insert_citation_title, #insert_contributor, #insert_editors, #insert_fpage, #insert_issue, #insert_lpage, #insert_pub_id, #insert_publication_date, #insert_publisher_name, #insert_source, #insert_version, #insert_volume, #is_article?, #is_chapter?, #is_data?, #jats, #publication_type
Methods included from Writers::DataciteJsonWriter
Methods included from Writers::DataciteWriter
Methods included from Writers::CrossrefWriter
Methods included from Writers::CrossciteWriter
Methods included from Writers::CodemetaWriter
Methods included from Writers::CiteprocWriter
Methods included from Writers::CitationWriter
Methods included from Writers::BibtexWriter
Methods included from Readers::SchemaOrgReader
#get_schema_org, #read_schema_org, #schema_org_has_part, #schema_org_is_identical_to, #schema_org_is_new_version_of, #schema_org_is_part_of, #schema_org_is_previous_version_of, #schema_org_is_referenced_by, #schema_org_is_supplement_to, #schema_org_is_supplemented_by, #schema_org_references, #schema_org_related_identifier, #schema_org_reverse_related_identifier
Methods included from Readers::RisReader
Methods included from Readers::DataciteJsonReader
Methods included from Readers::DataciteReader
#datacite_date, #datacite_funder_contributor, #datacite_funding_reference, #datacite_has_part, #datacite_is_identical_to, #datacite_is_new_version_of, #datacite_is_original_form_of, #datacite_is_part_of, #datacite_is_previous_version_of, #datacite_is_referenced_by, #datacite_is_reviewed_by, #datacite_is_supplement_to, #datacite_is_supplemented_by, #datacite_is_variant_form_of, #datacite_references, #datacite_related_identifier, #datacite_reviews, #get_datacite, #read_datacite
Methods included from Readers::CrossrefReader
#crossref_alternate_name, #crossref_date_published, #crossref_description, #crossref_funding_reference, #crossref_is_part_of, #crossref_license, #crossref_people, #crossref_references, #get_crossref, #read_crossref
Methods included from Readers::CrossciteReader
Methods included from Readers::CodemetaReader
Methods included from Readers::CiteprocReader
Methods included from Readers::BibtexReader
Methods included from Utils
#find_from_format, #find_from_format_by_ext, #find_from_format_by_id, #find_from_format_by_string, #from_citeproc, #from_schema_org, #get_date_from_date_parts, #get_date_from_parts, #get_date_parts, #github_as_codemeta_url, #github_as_owner_url, #github_as_release_url, #github_as_repo_url, #github_from_url, #github_owner_from_url, #github_release_from_url, #github_repo_from_url, #jsonlint, #map_hash_keys, #normalize_id, #normalize_ids, #normalize_licenses, #normalize_orcid, #normalize_url, #orcid_as_url, #orcid_from_url, #parse_attributes, #sanitize, #to_citeproc, #to_ris, #to_schema_org, #validate_orcid, #validate_orcid_scheme, #validate_url
Methods included from DataciteUtils
#datacite_errors, #datacite_xml, #insert_alternate_identifiers, #insert_contributors, #insert_creators, #insert_date, #insert_dates, #insert_descriptions, #insert_funding_reference, #insert_funding_references, #insert_identifier, #insert_person, #insert_publication_year, #insert_publisher, #insert_related_identifiers, #insert_resource_type, #insert_rights_list, #insert_subjects, #insert_title, #insert_titles, #insert_version, #insert_work, #rel_identifier, #resource_type, #root_attributes
Methods included from DateUtils
#get_date_from_parts, #get_date_parts, #get_date_parts_from_parts, #get_datetime_from_iso8601, #get_year_month, #get_year_month_day
Methods included from AuthorUtils
#authors_as_string, #cleanup_author, #get_authors, #get_name_identifiers, #get_one_author, #is_personal_name?, #name_exists?
Methods included from DoiUtils
#doi_as_url, #doi_from_url, #doi_resolver, #doi_search, #get_doi_ra, #normalize_doi, #validate_doi, #validate_prefix
Constructor Details
#initialize(input: nil, from: nil, style: nil, locale: nil, regenerate: false, **options) ⇒ Metadata
Returns a new instance of Metadata.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/bolognese/metadata.rb', line 83 def initialize(input: nil, from: nil, style: nil, locale: nil, regenerate: false, **) id = normalize_id(input, ) if id.present? @from = from || find_from_format(id: id) # generate name for method to call dynamically hsh = @from.present? ? send("get_" + @from, id: id, sandbox: [:sandbox]) : nil string = hsh.to_h.fetch("string", nil) elsif File.exist?(input) ext = File.extname(input) if %w(.bib .ris .xml .json).include?(ext) string = IO.read(input) @from = from || find_from_format(string: string, ext: ext) else $stderr.puts "File type #{ext} not supported" exit 1 end else hsh = { "url" => [:url], "state" => [:state], "date_registered" => [:date_registered], "date_updated" => [:date_updated], "provider_id" => [:provider_id], "client_id" => [:client_id] } string = input @from = from || find_from_format(string: string) end # generate name for method to call dynamically @metadata = @from.present? ? send("read_" + @from, string: string, sandbox: [:sandbox], doi: [:doi], url: [:url]) : {} @raw = string.present? ? string.strip : nil # replace DOI in XML if provided in options if @from == "datacite" && [:doi].present? doc = Nokogiri::XML(string, nil, 'UTF-8', &:noblanks) node = doc.at_css("identifier") node.content = [:doi].upcase @raw = doc.to_xml.strip end @should_passthru = (@from == "datacite") && !regenerate @url = hsh.to_h["url"].presence @state = hsh.to_h["state"].presence @date_registered = hsh.to_h["date_registered"].presence @date_updated = hsh.to_h["date_updated"].presence @provider_id = hsh.to_h["provider_id"].presence @client_id = hsh.to_h["client_id"].presence @style = style || "apa" @locale = locale || "en-US" end |
Instance Attribute Details
#additional_type ⇒ Object
Returns the value of attribute additional_type.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def additional_type @additional_type end |
#alternate_name ⇒ Object
Returns the value of attribute alternate_name.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def alternate_name @alternate_name end |
#author ⇒ Object
Returns the value of attribute author.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def @author end |
#bibtex_type ⇒ Object
Returns the value of attribute bibtex_type.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def bibtex_type @bibtex_type end |
#citeproc_type ⇒ Object
Returns the value of attribute citeproc_type.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def citeproc_type @citeproc_type end |
#cites ⇒ Object
Returns the value of attribute cites.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def cites @cites end |
#client_id ⇒ Object
Returns the value of attribute client_id.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def client_id @client_id end |
#compiles ⇒ Object
Returns the value of attribute compiles.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def compiles @compiles end |
#content_size ⇒ Object
Returns the value of attribute content_size.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def content_size @content_size end |
#continues ⇒ Object
Returns the value of attribute continues.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def continues @continues end |
#contributor ⇒ Object
Returns the value of attribute contributor.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def contributor @contributor end |
#date_accepted ⇒ Object
Returns the value of attribute date_accepted.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_accepted @date_accepted end |
#date_available ⇒ Object
Returns the value of attribute date_available.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_available @date_available end |
#date_collected ⇒ Object
Returns the value of attribute date_collected.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_collected @date_collected end |
#date_copyrighted ⇒ Object
Returns the value of attribute date_copyrighted.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_copyrighted @date_copyrighted end |
#date_created ⇒ Object
Returns the value of attribute date_created.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_created @date_created end |
#date_modified ⇒ Object
Returns the value of attribute date_modified.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_modified @date_modified end |
#date_registered ⇒ Object
Returns the value of attribute date_registered.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_registered @date_registered end |
#date_submitted ⇒ Object
Returns the value of attribute date_submitted.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_submitted @date_submitted end |
#date_updated ⇒ Object
Returns the value of attribute date_updated.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_updated @date_updated end |
#date_valid ⇒ Object
Returns the value of attribute date_valid.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def date_valid @date_valid end |
#description ⇒ Object
Returns the value of attribute description.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def description @description end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def doc @doc end |
#documents ⇒ Object
Returns the value of attribute documents.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def documents @documents end |
#doi ⇒ Object
Returns the value of attribute doi.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def doi @doi end |
#editor ⇒ Object
Returns the value of attribute editor.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def editor @editor end |
#errors ⇒ Object (readonly)
validate against DataCite schema, unless there are already errors in the reader
146 147 148 |
# File 'lib/bolognese/metadata.rb', line 146 def errors @errors end |
#first_page ⇒ Object
Returns the value of attribute first_page.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def first_page @first_page end |
#format ⇒ Object
Returns the value of attribute format.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def format @format end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def from @from end |
#funding ⇒ Object
Returns the value of attribute funding.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def funding @funding end |
#has_metadata ⇒ Object
Returns the value of attribute has_metadata.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def @has_metadata end |
#has_part ⇒ Object
Returns the value of attribute has_part.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def has_part @has_part end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def id @id end |
#is_cited_by ⇒ Object
Returns the value of attribute is_cited_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_cited_by @is_cited_by end |
#is_compiled_by ⇒ Object
Returns the value of attribute is_compiled_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_compiled_by @is_compiled_by end |
#is_continued_by ⇒ Object
Returns the value of attribute is_continued_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_continued_by @is_continued_by end |
#is_derived_from ⇒ Object
Returns the value of attribute is_derived_from.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_derived_from @is_derived_from end |
#is_documented_by ⇒ Object
Returns the value of attribute is_documented_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_documented_by @is_documented_by end |
#is_metadata_for ⇒ Object
Returns the value of attribute is_metadata_for.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def @is_metadata_for end |
#is_new_version_of ⇒ Object
Returns the value of attribute is_new_version_of.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_new_version_of @is_new_version_of end |
#is_original_form_of ⇒ Object
Returns the value of attribute is_original_form_of.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_original_form_of @is_original_form_of end |
#is_previous_version_of ⇒ Object
Returns the value of attribute is_previous_version_of.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_previous_version_of @is_previous_version_of end |
#is_referenced_by ⇒ Object
Returns the value of attribute is_referenced_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_referenced_by @is_referenced_by end |
#is_reviewed_by ⇒ Object
Returns the value of attribute is_reviewed_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_reviewed_by @is_reviewed_by end |
#is_source_of ⇒ Object
Returns the value of attribute is_source_of.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_source_of @is_source_of end |
#is_supplement_to ⇒ Object
Returns the value of attribute is_supplement_to.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_supplement_to @is_supplement_to end |
#is_supplemented_by ⇒ Object
Returns the value of attribute is_supplemented_by.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_supplemented_by @is_supplemented_by end |
#is_variant_form_of ⇒ Object
Returns the value of attribute is_variant_form_of.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def is_variant_form_of @is_variant_form_of end |
#issue ⇒ Object
Returns the value of attribute issue.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def issue @issue end |
#journal ⇒ Object
Returns the value of attribute journal.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def journal @journal end |
#keywords ⇒ Object
Returns the value of attribute keywords.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def keywords @keywords end |
#language ⇒ Object
Returns the value of attribute language.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def language @language end |
#last_page ⇒ Object
Returns the value of attribute last_page.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def last_page @last_page end |
#license ⇒ Object
Returns the value of attribute license.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def license @license end |
#locale ⇒ Object
Returns the value of attribute locale.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def locale @locale end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def @metadata end |
#name_detector ⇒ Object (readonly)
recognize given name. Can be loaded once as ::NameDetector, e.g. in a Rails initializer
375 376 377 |
# File 'lib/bolognese/metadata.rb', line 375 def name_detector @name_detector end |
#page_end ⇒ Object (readonly)
Returns the value of attribute page_end.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def page_end @page_end end |
#page_start ⇒ Object (readonly)
Returns the value of attribute page_start.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def page_start @page_start end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def provider @provider end |
#provider_id ⇒ Object
Returns the value of attribute provider_id.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def provider_id @provider_id end |
#publisher ⇒ Object
Returns the value of attribute publisher.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def publisher @publisher end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def raw @raw end |
#references ⇒ Object
Returns the value of attribute references.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def references @references end |
#related_identifier ⇒ Object (readonly)
Returns the value of attribute related_identifier.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def @related_identifier end |
#reverse ⇒ Object (readonly)
Returns the value of attribute reverse.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def reverse @reverse end |
#reviews ⇒ Object
Returns the value of attribute reviews.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def reviews @reviews end |
#ris_type ⇒ Object
Returns the value of attribute ris_type.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def ris_type @ris_type end |
#same_as ⇒ Object
Returns the value of attribute same_as.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def same_as @same_as end |
#schema_version ⇒ Object
Returns the value of attribute schema_version.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def schema_version @schema_version end |
#should_passthru ⇒ Object (readonly)
Returns the value of attribute should_passthru.
79 80 81 |
# File 'lib/bolognese/metadata.rb', line 79 def should_passthru @should_passthru end |
#spatial_coverage ⇒ Object
Returns the value of attribute spatial_coverage.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def spatial_coverage @spatial_coverage end |
#state ⇒ Object
Returns the value of attribute state.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def state @state end |
#style ⇒ Object
Returns the value of attribute style.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def style @style end |
#title ⇒ Object
Returns the value of attribute title.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def url @url end |
#version ⇒ Object
Returns the value of attribute version.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def version @version end |
#volume ⇒ Object
Returns the value of attribute volume.
64 65 66 |
# File 'lib/bolognese/metadata.rb', line 64 def volume @volume end |
Instance Method Details
#container_title ⇒ Object
383 384 385 |
# File 'lib/bolognese/metadata.rb', line 383 def container_title Array.wrap(is_part_of).length == 1 ? is_part_of.to_h.fetch("title", nil) : nil end |
#date_published ⇒ Object
244 245 246 |
# File 'lib/bolognese/metadata.rb', line 244 def date_published @date_published ||= .fetch("date_published", nil) end |
#descriptions ⇒ Object
387 388 389 |
# File 'lib/bolognese/metadata.rb', line 387 def descriptions Array.wrap(description) end |
#exists? ⇒ Boolean
137 138 139 |
# File 'lib/bolognese/metadata.rb', line 137 def exists? .fetch("id", nil).present? end |
#graph ⇒ Object
396 397 398 |
# File 'lib/bolognese/metadata.rb', line 396 def graph RDF::Graph.new << JSON::LD::API.toRdf(schema_hsh) end |
#is_identical_to ⇒ Object
312 313 314 |
# File 'lib/bolognese/metadata.rb', line 312 def is_identical_to .fetch("is_identical_to", nil) end |
#is_part_of ⇒ Object
316 317 318 |
# File 'lib/bolognese/metadata.rb', line 316 def is_part_of .fetch("is_part_of", nil) end |
#publication_year ⇒ Object
379 380 381 |
# File 'lib/bolognese/metadata.rb', line 379 def publication_year date_published.present? ? date_published[0..3].to_i.presence : nil end |
#related_identifier_hsh(relation_type) ⇒ Object
364 365 366 367 |
# File 'lib/bolognese/metadata.rb', line 364 def (relation_type) Array.wrap(send(relation_type)).select { |r| r["id"] || r["issn"] } .map { |r| r.merge("relationType" => relation_type.camelize) } end |
#resource_type_general ⇒ Object
176 177 178 |
# File 'lib/bolognese/metadata.rb', line 176 def resource_type_general @resource_type_general ||= .fetch("resource_type_general", nil) end |
#valid? ⇒ Boolean
141 142 143 |
# File 'lib/bolognese/metadata.rb', line 141 def valid? exists? && errors.nil? end |