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::CiteprocWriter, Writers::CodemetaWriter, Writers::CrossciteWriter, Writers::CrossrefWriter, Writers::DataciteJsonWriter, Writers::DataciteWriter, 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_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_RIS_TRANSLATIONS
Instance Attribute Summary collapse
-
#additional_type ⇒ Object
readonly
Returns the value of attribute additional_type.
-
#alternate_name ⇒ Object
readonly
Returns the value of attribute alternate_name.
-
#bibtex_type ⇒ Object
readonly
Returns the value of attribute bibtex_type.
-
#citation ⇒ Object
readonly
Returns the value of attribute citation.
-
#citeproc_type ⇒ Object
readonly
Returns the value of attribute citeproc_type.
-
#cites ⇒ Object
readonly
Returns the value of attribute cites.
-
#compiles ⇒ Object
readonly
Returns the value of attribute compiles.
-
#content_size ⇒ Object
readonly
Returns the value of attribute content_size.
-
#continues ⇒ Object
readonly
Returns the value of attribute continues.
-
#contributor ⇒ Object
readonly
Returns the value of attribute contributor.
-
#datacite_errors ⇒ Object
readonly
Returns the value of attribute datacite_errors.
-
#date_accepted ⇒ Object
readonly
Returns the value of attribute date_accepted.
-
#date_available ⇒ Object
readonly
Returns the value of attribute date_available.
-
#date_collected ⇒ Object
readonly
Returns the value of attribute date_collected.
-
#date_copyrighted ⇒ Object
readonly
Returns the value of attribute date_copyrighted.
-
#date_created ⇒ Object
readonly
Returns the value of attribute date_created.
-
#date_modified ⇒ Object
readonly
Returns the value of attribute date_modified.
-
#date_submitted ⇒ Object
readonly
Returns the value of attribute date_submitted.
-
#date_valid ⇒ Object
readonly
Returns the value of attribute date_valid.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#documents ⇒ Object
readonly
Returns the value of attribute documents.
-
#editor ⇒ Object
readonly
Returns the value of attribute editor.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#funding ⇒ Object
readonly
Returns the value of attribute funding.
-
#has_metadata ⇒ Object
readonly
Returns the value of attribute has_metadata.
-
#has_part ⇒ Object
readonly
Returns the value of attribute has_part.
-
#id ⇒ Object
readonly
def errors doc && doc.errors.map { |error| error.to_s }.unwrap end.
-
#is_cited_by ⇒ Object
readonly
Returns the value of attribute is_cited_by.
-
#is_compiled_by ⇒ Object
readonly
Returns the value of attribute is_compiled_by.
-
#is_continued_by ⇒ Object
readonly
Returns the value of attribute is_continued_by.
-
#is_derived_from ⇒ Object
readonly
Returns the value of attribute is_derived_from.
-
#is_documented_by ⇒ Object
readonly
Returns the value of attribute is_documented_by.
-
#is_metadata_for ⇒ Object
readonly
Returns the value of attribute is_metadata_for.
-
#is_new_version_of ⇒ Object
readonly
Returns the value of attribute is_new_version_of.
-
#is_original_form_of ⇒ Object
readonly
Returns the value of attribute is_original_form_of.
-
#is_previous_version_of ⇒ Object
readonly
Returns the value of attribute is_previous_version_of.
-
#is_referenced_by ⇒ Object
readonly
Returns the value of attribute is_referenced_by.
-
#is_reviewed_by ⇒ Object
readonly
Returns the value of attribute is_reviewed_by.
-
#is_source_of ⇒ Object
readonly
Returns the value of attribute is_source_of.
-
#is_supplement_to ⇒ Object
readonly
Returns the value of attribute is_supplement_to.
-
#is_supplemented_by ⇒ Object
readonly
Returns the value of attribute is_supplemented_by.
-
#is_variant_form_of ⇒ Object
readonly
Returns the value of attribute is_variant_form_of.
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
-
#journal ⇒ Object
readonly
Returns the value of attribute journal.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#license ⇒ Object
readonly
Returns the value of attribute license.
-
#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.
-
#publisher ⇒ Object
readonly
Returns the value of attribute publisher.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#references ⇒ Object
readonly
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
readonly
Returns the value of attribute reviews.
-
#ris_type ⇒ Object
readonly
Returns the value of attribute ris_type.
-
#same_as ⇒ Object
readonly
Returns the value of attribute same_as.
-
#schema_version ⇒ Object
readonly
Returns the value of attribute schema_version.
-
#should_passthru ⇒ Object
readonly
Returns the value of attribute should_passthru.
-
#spatial_coverage ⇒ Object
readonly
Returns the value of attribute spatial_coverage.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#volume ⇒ Object
readonly
Returns the value of attribute volume.
Instance Method Summary collapse
- #author ⇒ Object
- #container_title ⇒ Object
- #date_published ⇒ Object
- #description ⇒ Object
- #descriptions ⇒ Object
- #doi ⇒ Object
- #exists? ⇒ Boolean
- #graph ⇒ Object
-
#initialize(input: nil, from: nil, regenerate: false) ⇒ Metadata
constructor
A new instance of Metadata.
- #is_identical_to ⇒ Object
- #is_part_of ⇒ Object
- #pagination ⇒ Object
- #publication_year ⇒ Object
- #related_identifier_hsh(relation_type) ⇒ Object
- #resource_type_general ⇒ Object
- #title ⇒ Object
- #type ⇒ 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::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::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_url
Methods included from DataciteUtils
#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, #schema
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_identifier, #get_one_author, #is_personal_name?
Methods included from DoiUtils
#doi_as_url, #doi_from_url, #get_doi_ra, #normalize_doi, #validate_doi, #validate_prefix
Constructor Details
#initialize(input: nil, from: nil, regenerate: false) ⇒ Metadata
Returns a new instance of Metadata.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/bolognese/metadata.rb', line 75 def initialize(input: nil, from: nil, regenerate: false) id = normalize_id(input) if id.present? @from = from || find_from_format(id: id) # generate name for method to call dynamically string = @from.present? ? send("get_" + @from, id: id) : 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 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) : {} @raw = string @should_passthru = (@from == "datacite") && !regenerate end |
Instance Attribute Details
#additional_type ⇒ Object (readonly)
Returns the value of attribute additional_type.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def additional_type @additional_type end |
#alternate_name ⇒ Object (readonly)
Returns the value of attribute alternate_name.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def alternate_name @alternate_name end |
#bibtex_type ⇒ Object (readonly)
Returns the value of attribute bibtex_type.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def bibtex_type @bibtex_type end |
#citation ⇒ Object (readonly)
Returns the value of attribute citation.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def citation @citation end |
#citeproc_type ⇒ Object (readonly)
Returns the value of attribute citeproc_type.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def citeproc_type @citeproc_type end |
#cites ⇒ Object (readonly)
Returns the value of attribute cites.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def cites @cites end |
#compiles ⇒ Object (readonly)
Returns the value of attribute compiles.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def compiles @compiles end |
#content_size ⇒ Object (readonly)
Returns the value of attribute content_size.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def content_size @content_size end |
#continues ⇒ Object (readonly)
Returns the value of attribute continues.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def continues @continues end |
#contributor ⇒ Object (readonly)
Returns the value of attribute contributor.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def contributor @contributor end |
#datacite_errors ⇒ Object (readonly)
Returns the value of attribute datacite_errors.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def datacite_errors @datacite_errors end |
#date_accepted ⇒ Object (readonly)
Returns the value of attribute date_accepted.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_accepted @date_accepted end |
#date_available ⇒ Object (readonly)
Returns the value of attribute date_available.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_available @date_available end |
#date_collected ⇒ Object (readonly)
Returns the value of attribute date_collected.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_collected @date_collected end |
#date_copyrighted ⇒ Object (readonly)
Returns the value of attribute date_copyrighted.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_copyrighted @date_copyrighted end |
#date_created ⇒ Object (readonly)
Returns the value of attribute date_created.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_created @date_created end |
#date_modified ⇒ Object (readonly)
Returns the value of attribute date_modified.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_modified @date_modified end |
#date_submitted ⇒ Object (readonly)
Returns the value of attribute date_submitted.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_submitted @date_submitted end |
#date_valid ⇒ Object (readonly)
Returns the value of attribute date_valid.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def date_valid @date_valid end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def doc @doc end |
#documents ⇒ Object (readonly)
Returns the value of attribute documents.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def documents @documents end |
#editor ⇒ Object (readonly)
Returns the value of attribute editor.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def editor @editor end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def errors @errors end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def format @format end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def from @from end |
#funding ⇒ Object (readonly)
Returns the value of attribute funding.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def funding @funding end |
#has_metadata ⇒ Object (readonly)
Returns the value of attribute has_metadata.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def @has_metadata end |
#has_part ⇒ Object (readonly)
Returns the value of attribute has_part.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def has_part @has_part end |
#id ⇒ Object (readonly)
def errors
doc && doc.errors.map { |error| error.to_s }.unwrap
end
119 120 121 |
# File 'lib/bolognese/metadata.rb', line 119 def id @id end |
#is_cited_by ⇒ Object (readonly)
Returns the value of attribute is_cited_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_cited_by @is_cited_by end |
#is_compiled_by ⇒ Object (readonly)
Returns the value of attribute is_compiled_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_compiled_by @is_compiled_by end |
#is_continued_by ⇒ Object (readonly)
Returns the value of attribute is_continued_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_continued_by @is_continued_by end |
#is_derived_from ⇒ Object (readonly)
Returns the value of attribute is_derived_from.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_derived_from @is_derived_from end |
#is_documented_by ⇒ Object (readonly)
Returns the value of attribute is_documented_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_documented_by @is_documented_by end |
#is_metadata_for ⇒ Object (readonly)
Returns the value of attribute is_metadata_for.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def @is_metadata_for end |
#is_new_version_of ⇒ Object (readonly)
Returns the value of attribute is_new_version_of.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_new_version_of @is_new_version_of end |
#is_original_form_of ⇒ Object (readonly)
Returns the value of attribute is_original_form_of.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_original_form_of @is_original_form_of end |
#is_previous_version_of ⇒ Object (readonly)
Returns the value of attribute is_previous_version_of.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_previous_version_of @is_previous_version_of end |
#is_referenced_by ⇒ Object (readonly)
Returns the value of attribute is_referenced_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_referenced_by @is_referenced_by end |
#is_reviewed_by ⇒ Object (readonly)
Returns the value of attribute is_reviewed_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_reviewed_by @is_reviewed_by end |
#is_source_of ⇒ Object (readonly)
Returns the value of attribute is_source_of.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_source_of @is_source_of end |
#is_supplement_to ⇒ Object (readonly)
Returns the value of attribute is_supplement_to.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_supplement_to @is_supplement_to end |
#is_supplemented_by ⇒ Object (readonly)
Returns the value of attribute is_supplemented_by.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_supplemented_by @is_supplemented_by end |
#is_variant_form_of ⇒ Object (readonly)
Returns the value of attribute is_variant_form_of.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def is_variant_form_of @is_variant_form_of end |
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def issue @issue end |
#journal ⇒ Object (readonly)
Returns the value of attribute journal.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def journal @journal end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def keywords @keywords end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def language @language end |
#license ⇒ Object (readonly)
Returns the value of attribute license.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def license @license end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def @metadata end |
#name_detector ⇒ Object (readonly)
recognize given name. Can be loaded once as ::NameDetector, e.g. in a Rails initializer
317 318 319 |
# File 'lib/bolognese/metadata.rb', line 317 def name_detector @name_detector end |
#page_end ⇒ Object (readonly)
Returns the value of attribute page_end.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def page_end @page_end end |
#page_start ⇒ Object (readonly)
Returns the value of attribute page_start.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def page_start @page_start end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def provider @provider end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def publisher @publisher end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def raw @raw end |
#references ⇒ Object (readonly)
Returns the value of attribute references.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def references @references end |
#related_identifier ⇒ Object (readonly)
Returns the value of attribute related_identifier.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def @related_identifier end |
#reverse ⇒ Object (readonly)
Returns the value of attribute reverse.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def reverse @reverse end |
#reviews ⇒ Object (readonly)
Returns the value of attribute reviews.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def reviews @reviews end |
#ris_type ⇒ Object (readonly)
Returns the value of attribute ris_type.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def ris_type @ris_type end |
#same_as ⇒ Object (readonly)
Returns the value of attribute same_as.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def same_as @same_as end |
#schema_version ⇒ Object (readonly)
Returns the value of attribute schema_version.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def schema_version @schema_version end |
#should_passthru ⇒ Object (readonly)
Returns the value of attribute should_passthru.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def should_passthru @should_passthru end |
#spatial_coverage ⇒ Object (readonly)
Returns the value of attribute spatial_coverage.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def spatial_coverage @spatial_coverage end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def version @version end |
#volume ⇒ Object (readonly)
Returns the value of attribute volume.
60 61 62 |
# File 'lib/bolognese/metadata.rb', line 60 def volume @volume end |
Instance Method Details
#author ⇒ Object
163 164 165 |
# File 'lib/bolognese/metadata.rb', line 163 def .fetch("author", nil) end |
#container_title ⇒ Object
325 326 327 |
# File 'lib/bolognese/metadata.rb', line 325 def container_title Array.wrap(is_part_of).length == 1 ? is_part_of.to_h.fetch("title", nil) : nil end |
#date_published ⇒ Object
207 208 209 |
# File 'lib/bolognese/metadata.rb', line 207 def date_published .fetch("date_published", nil) end |
#description ⇒ Object
223 224 225 |
# File 'lib/bolognese/metadata.rb', line 223 def description .fetch("description", nil) end |
#descriptions ⇒ Object
329 330 331 |
# File 'lib/bolognese/metadata.rb', line 329 def descriptions Array.wrap(description) end |
#doi ⇒ Object
147 148 149 |
# File 'lib/bolognese/metadata.rb', line 147 def doi .fetch("doi", nil) end |
#exists? ⇒ Boolean
103 104 105 |
# File 'lib/bolognese/metadata.rb', line 103 def exists? .fetch("id", nil).present? end |
#graph ⇒ Object
338 339 340 |
# File 'lib/bolognese/metadata.rb', line 338 def graph RDF::Graph.new << JSON::LD::API.toRdf(schema_hsh) end |
#is_identical_to ⇒ Object
255 256 257 |
# File 'lib/bolognese/metadata.rb', line 255 def is_identical_to .fetch("is_identical_to", nil) end |
#is_part_of ⇒ Object
259 260 261 |
# File 'lib/bolognese/metadata.rb', line 259 def is_part_of .fetch("is_part_of", nil) end |
#pagination ⇒ Object
219 220 221 |
# File 'lib/bolognese/metadata.rb', line 219 def pagination .fetch("pagination", nil) end |
#publication_year ⇒ Object
321 322 323 |
# File 'lib/bolognese/metadata.rb', line 321 def publication_year date_published.present? ? date_published[0..3].to_i.presence : nil end |
#related_identifier_hsh(relation_type) ⇒ Object
307 308 309 |
# File 'lib/bolognese/metadata.rb', line 307 def (relation_type) Array.wrap(send(relation_type)).map { |r| r.merge("relationType" => relation_type.camelize) } end |
#resource_type_general ⇒ Object
143 144 145 |
# File 'lib/bolognese/metadata.rb', line 143 def resource_type_general .fetch("resource_type_general", nil) end |
#title ⇒ Object
155 156 157 |
# File 'lib/bolognese/metadata.rb', line 155 def title .fetch("title", nil) end |
#type ⇒ Object
123 124 125 |
# File 'lib/bolognese/metadata.rb', line 123 def type .fetch("type", nil) end |
#valid? ⇒ Boolean
107 108 109 |
# File 'lib/bolognese/metadata.rb', line 107 def valid? exists? && errors.nil? end |