From 513cdfd43203fd2c2f131bcbc1384d96110d67ce Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Tue, 26 Sep 2023 16:08:40 -0400 Subject: [PATCH 01/14] Adds Schema 4.5 resources --- .../include/datacite-contributorType-v4.xsd | 35 + .../include/datacite-dateType-v4.xsd | 25 + .../include/datacite-descriptionType-v4.xsd | 19 + .../datacite-funderIdentifierType-v4.xsd | 16 + .../include/datacite-nameType-v4.xsd | 10 + .../include/datacite-numberType-v4.xsd | 12 + .../datacite-relatedIdentifierType-v4.xsd | 34 + .../include/datacite-relationType-v4.xsd | 53 ++ .../include/datacite-resourceType-v4.xsd | 45 ++ .../include/datacite-titleType-v4.xsd | 14 + resources/kernel-4.5/include/xml.xsd | 286 +++++++ resources/kernel-4.5/metadata.xsd | 711 ++++++++++++++++++ .../include/datacite-relationType-v4.xsd | 2 + .../include/datacite-resourceType-v4.xsd | 2 + resources/kernel-4/metadata.xsd | 18 +- 15 files changed, 1275 insertions(+), 7 deletions(-) create mode 100644 resources/kernel-4.5/include/datacite-contributorType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-dateType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-descriptionType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-nameType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-numberType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-relationType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-resourceType-v4.xsd create mode 100644 resources/kernel-4.5/include/datacite-titleType-v4.xsd create mode 100644 resources/kernel-4.5/include/xml.xsd create mode 100644 resources/kernel-4.5/metadata.xsd diff --git a/resources/kernel-4.5/include/datacite-contributorType-v4.xsd b/resources/kernel-4.5/include/datacite-contributorType-v4.xsd new file mode 100644 index 00000000..f264e07e --- /dev/null +++ b/resources/kernel-4.5/include/datacite-contributorType-v4.xsd @@ -0,0 +1,35 @@ + + + + + + The type of contributor of the resource. + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-dateType-v4.xsd b/resources/kernel-4.5/include/datacite-dateType-v4.xsd new file mode 100644 index 00000000..1f201287 --- /dev/null +++ b/resources/kernel-4.5/include/datacite-dateType-v4.xsd @@ -0,0 +1,25 @@ + + + + + + The type of date. Use RKMSā€ISO8601 standard for depicting date ranges.To indicate the end of an embargo period, use Available. To indicate the start of an embargo period, use Submitted or Accepted, as appropriate. + + + + + + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd b/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd new file mode 100644 index 00000000..4f5e5f47 --- /dev/null +++ b/resources/kernel-4.5/include/datacite-descriptionType-v4.xsd @@ -0,0 +1,19 @@ + + + + + + The type of the description. + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd b/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd new file mode 100644 index 00000000..754c9724 --- /dev/null +++ b/resources/kernel-4.5/include/datacite-funderIdentifierType-v4.xsd @@ -0,0 +1,16 @@ + + + + + + The type of the funderIdentifier. + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-nameType-v4.xsd b/resources/kernel-4.5/include/datacite-nameType-v4.xsd new file mode 100644 index 00000000..bf54922f --- /dev/null +++ b/resources/kernel-4.5/include/datacite-nameType-v4.xsd @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-numberType-v4.xsd b/resources/kernel-4.5/include/datacite-numberType-v4.xsd new file mode 100644 index 00000000..0de90c70 --- /dev/null +++ b/resources/kernel-4.5/include/datacite-numberType-v4.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd b/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd new file mode 100644 index 00000000..80ab3dab --- /dev/null +++ b/resources/kernel-4.5/include/datacite-relatedIdentifierType-v4.xsd @@ -0,0 +1,34 @@ + + + + + + The type of the RelatedIdentifier. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-relationType-v4.xsd b/resources/kernel-4.5/include/datacite-relationType-v4.xsd new file mode 100644 index 00000000..5ed3333a --- /dev/null +++ b/resources/kernel-4.5/include/datacite-relationType-v4.xsd @@ -0,0 +1,53 @@ + + + + + + Description of the relationship of the resource being registered (A) and the related resource (B). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/datacite-resourceType-v4.xsd b/resources/kernel-4.5/include/datacite-resourceType-v4.xsd new file mode 100644 index 00000000..623fe479 --- /dev/null +++ b/resources/kernel-4.5/include/datacite-resourceType-v4.xsd @@ -0,0 +1,45 @@ + + + + + + The general type of a resource. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/kernel-4.5/include/datacite-titleType-v4.xsd b/resources/kernel-4.5/include/datacite-titleType-v4.xsd new file mode 100644 index 00000000..df8ae3a4 --- /dev/null +++ b/resources/kernel-4.5/include/datacite-titleType-v4.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/resources/kernel-4.5/include/xml.xsd b/resources/kernel-4.5/include/xml.xsd new file mode 100644 index 00000000..bd291f3d --- /dev/null +++ b/resources/kernel-4.5/include/xml.xsd @@ -0,0 +1,286 @@ + + + + + + +
+

About the XML namespace

+ +
+

+ This schema document describes the XML namespace, in a form + suitable for import by other schema documents. +

+

+ See + http://www.w3.org/XML/1998/namespace.html and + + http://www.w3.org/TR/REC-xml for information + about this namespace. +

+

+ Note that local names in this namespace are intended to be + defined only by the World Wide Web Consortium or its subgroups. + The names currently defined in this namespace are listed below. + They should not be used with conflicting semantics by any Working + Group, specification, or document instance. +

+

+ See further below in this document for more information about how to refer to this schema document from your own + XSD schema documents and about the + namespace-versioning policy governing this schema document. +

+
+
+
+
+ + + + +
+ +

lang (as an attribute name)

+

+ denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification.

+ +
+
+

Notes

+

+ Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. +

+

+ See BCP 47 at + http://www.rfc-editor.org/rfc/bcp/bcp47.txt + and the IANA language subtag registry at + + http://www.iana.org/assignments/language-subtag-registry + for further information. +

+

+ The union allows for the 'un-declaration' of xml:lang with + the empty string. +

+
+
+
+ + + + + + + + + +
+ + + + +
+ +

space (as an attribute name)

+

+ denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification.

+ +
+
+
+ + + + + + +
+ + + +
+ +

base (as an attribute name)

+

+ denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification.

+ +

+ See http://www.w3.org/TR/xmlbase/ + for information about this attribute. +

+
+
+
+
+ + + + +
+ +

id (as an attribute name)

+

+ denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification.

+ +

+ See http://www.w3.org/TR/xml-id/ + for information about this attribute. +

+
+
+
+
+ + + + + + + + + + +
+ +

Father (in any context at all)

+ +
+

+ denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: +

+
+

+ In appreciation for his vision, leadership and + dedication the W3C XML Plenary on this 10th day of + February, 2000, reserves for Jon Bosak in perpetuity + the XML name "xml:Father". +

+
+
+
+
+
+ + + +
+

About this schema document

+ +
+

+ This schema defines attributes and an attribute group suitable + for use by schemas wishing to allow xml:base, + xml:lang, xml:space or + xml:id attributes on elements they define. +

+

+ To enable this, such a schema must import this schema for + the XML namespace, e.g. as follows: +

+
+          <schema . . .>
+           . . .
+           <import namespace="http://www.w3.org/XML/1998/namespace"
+                      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+     
+

+ or +

+
+           <import namespace="http://www.w3.org/XML/1998/namespace"
+                      schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+     
+

+ Subsequently, qualified reference to any of the attributes or the + group defined below will have the desired effect, e.g. +

+
+          <type . . .>
+           . . .
+           <attributeGroup ref="xml:specialAttrs"/>
+     
+

+ will define a type which will schema-validate an instance element + with any of those attributes. +

+
+
+
+
+ + + +
+

Versioning policy for this schema document

+
+

+ In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + + http://www.w3.org/2009/01/xml.xsd. +

+

+ At the date of issue it can also be found at + + http://www.w3.org/2001/xml.xsd. +

+

+ The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML + Schema itself, or with the XML namespace itself. In other words, + if the XML Schema or XML namespaces change, the version of this + document at + http://www.w3.org/2001/xml.xsd + + will change accordingly; the version at + + http://www.w3.org/2009/01/xml.xsd + + will not change. +

+

+ Previous dated (and unchanging) versions of this schema + document are at: +

+ +
+
+
+
+ +
diff --git a/resources/kernel-4.5/metadata.xsd b/resources/kernel-4.5/metadata.xsd new file mode 100644 index 00000000..c5876178 --- /dev/null +++ b/resources/kernel-4.5/metadata.xsd @@ -0,0 +1,711 @@ + + + + + + + + + + + + + + + + + + Root element of a single record. This wrapper element is for XML implementation only and is not defined in the DataCite DOI standard. + Note: This is the case for all wrapper elements within this schema. + No content in this wrapper element. + + + + + + + A persistent identifier that identifies a resource. + + + + + + + + + + + + + + + The main researchers involved working on the data, or the authors of the publication in priority order. May be a corporate/institutional or personal name. + Format: Family, Given. + Personal names can be further specified using givenName and familyName. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A name or title by which a resource is known. + + + + + + + + + + + + + + + + The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource. This property will be used to formulate the citation, so consider the prominence of the role. + In the case of datasets, "publish" is understood to mean making the data available to the community of researchers. + + + + + + + + + + + + + + + Year when the data is made publicly available. If an embargo period has been in effect, use the date when the embargo period ends. + In the case of datasets, "publish" is understood to mean making the data available on a specific date to the community of researchers. If there is no standard publication year value, use the date that would be preferred from a citation perspective. + YYYY + + + + + + + + The type of a resource. You may enter an additional free text description. + The format is open, but the preferred format is a single term of some detail so that a pair can be formed with the sub-property. + + + + + + + + + + + + + + + + Subject, keywords, classification codes, or key phrases describing the resource. + + + + + + + + + + + + + + + + + + + + + + The institution or person responsible for collecting, creating, or otherwise contributing to the development of the dataset. + The personal name format should be: Family, Given. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Different dates relevant to the work. + YYYY,YYYY-MM-DD, YYYY-MM-DDThh:mm:ssTZD or any other format or level of granularity described in W3CDTF. Use RKMS-ISO8601 standard for depicting date ranges. + + + + + + + + + + + + + + + + Primary language of the resource. Allowed values are taken from IETF BCP 47, ISO 639-1 language codes. + + + + + + + + An identifier or identifiers other than the primary Identifier applied to the resource being registered. This may be any alphanumeric string which is unique within its domain of issue. May be used for local identifiers. AlternateIdentifier should be used for another identifier of the same instance (same location, same file). + + + + + + + + + + + + + + + + + + Identifiers of related resources. Use this property to indicate subsets of properties, as appropriate. + + + + + + + + + + + + + + + + + + + + + + + Unstructures size information about the resource. + + + + + + + + + + + Technical format of the resource. + Use file extension or MIME type where possible. + + + + + + + + Version number of the resource. If the primary resource has changed the version number increases. + Register a new identifier for a major version change. Individual stewards need to determine which are major vs. minor versions. May be used in conjunction with properties 11 and 12 (AlternateIdentifier and RelatedIdentifier) to indicate various information updates. May be used in conjunction with property 17 (Description) to indicate the nature and file/record range of version. + + + + + + + + Any rights information for this resource. Provide a rights management statement for the resource or reference a service providing such information. Include embargo information if applicable. +Use the complete title of a license and include version information if applicable. + + + + + + + + + + + + + + + + + + + + + + All additional information that does not fit in any of the other categories. May be used for technical information. It is a best practice to supply a description. + + + + + + + + + + + + + + + + + + + + + + + Spatial region or named place where the data was gathered or about which the data is focused. + + + + + A point contains a single latitude-longitude pair. + + + + + A box contains two white space separated latitude-longitude pairs, with each pair separated by whitespace. The first pair is the lower corner, the second is the upper corner. + + + + + A drawn polygon area, defined by a set of points and lines connecting the points in a closed chain. + + + + + + + + + + + + + + + + + + + + Information about financial support (funding) for the resource being registered. + + + + + + Name of the funding provider. + + + + + + + + Uniquely identifies a funding entity, according to various types. + + + + + + + + + + + + + The code assigned by the funder to a sponsored award (grant). + + + + + + + + + + + + The human readable title of the award (grant). + + + + + + + + + + + + + + Information about a resource related to the one being registered e.g. a journal or book of which the article or chapter is part. + + + + + + The identifier for the related item. + + + + + + + The type of the Identifier for the related item e.g. DOI. + + + + + The name of the scheme. + + + + + The URI of the relatedMetadataScheme. + + + + + The type of the relatedMetadataScheme, linked with the schemeURI. + + + + + + + + + + + + The institution or person responsible for creating the + related resource. To supply multiple creators, repeat this property. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Title of the related item. + + + + + + + + + + + + + + + + The year when the item was or will be made publicly available. + + + + + + + + Volume of the related item. + + + + + Issue number or name of the related item. + + + + + Number of the related item e.g. report number of article number. + + + + + + + + + + + + First page of the related item e.g. of the chapter, article, or conference paper. + + + + + Last page of the related item e.g. of the chapter, article, or conference paper. + + + + + The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource. This property will be used to formulate the citation, so consider the prominence of the role. + + + + + Edition or version of the related item. + + + + + + + + The institution or person responsible for collecting, + managing, distributing, or otherwise contributing to the development of + the resource. + + + + + + + + + + + + + + + + + + + The type of contributor of the resource. + + + + + + + + + + + The type of the related item, e.g. journal article, book or chapter. + + + + + Description of the relationship of the resource being registered (A) and the related resource (B). + + + + + + + + + + + + + + + + + + + + + + Uniquely identifies a creator or contributor, according to various identifier schemes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Uniquely identifies an affiliation, according to various identifier schemes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/kernel-4/include/datacite-relationType-v4.xsd b/resources/kernel-4/include/datacite-relationType-v4.xsd index ed97e721..5ed3333a 100644 --- a/resources/kernel-4/include/datacite-relationType-v4.xsd +++ b/resources/kernel-4/include/datacite-relationType-v4.xsd @@ -46,6 +46,8 @@ + + diff --git a/resources/kernel-4/include/datacite-resourceType-v4.xsd b/resources/kernel-4/include/datacite-resourceType-v4.xsd index 4c5586aa..623fe479 100644 --- a/resources/kernel-4/include/datacite-resourceType-v4.xsd +++ b/resources/kernel-4/include/datacite-resourceType-v4.xsd @@ -22,6 +22,7 @@ + @@ -35,6 +36,7 @@ + diff --git a/resources/kernel-4/metadata.xsd b/resources/kernel-4/metadata.xsd index 3cdaecaf..c5876178 100644 --- a/resources/kernel-4/metadata.xsd +++ b/resources/kernel-4/metadata.xsd @@ -2,7 +2,7 @@ + 2021-03-08 v4.4: Addition of new property relatedItem, relationType value "isPublishedIn", subject subproperty "classificationCode", controlled list "numberType", additional 13 properties for controlled list "resourceType" + 2023-??-?? v4.5: Addition of new subproperties for publisher: "publisherIdentifier", "publisherIdentifierScheme", and "schemeURI"; addition of new resourceTypeGeneral values "Instrument" and "StudyRegistration"; addition of new relationType values "Collects" and "IsCollectedBy".--> @@ -105,6 +106,9 @@ + + + @@ -161,7 +165,7 @@ - The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset. + The institution or person responsible for collecting, creating, or otherwise contributing to the development of the dataset. The personal name format should be: Family, Given. @@ -524,7 +528,7 @@ Use the complete title of a license and include version information if applicabl - Issue number or name of the related item. + Number of the related item e.g. report number of article number. @@ -641,19 +645,19 @@ Use the complete title of a license and include version information if applicabl From cb58532c7038950e69882f39dfc420148ea90f65 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Thu, 28 Sep 2023 13:53:57 -0400 Subject: [PATCH 02/14] Preliminary support for publisher as a hash with additional subproperties for Schema 4.5 --- lib/bolognese/datacite_utils.rb | 19 +- lib/bolognese/metadata.rb | 7 +- lib/bolognese/metadata_utils.rb | 2 +- lib/bolognese/readers/bibtex_reader.rb | 2 +- lib/bolognese/readers/crossref_reader.rb | 3 +- lib/bolognese/readers/datacite_reader.rb | 17 +- lib/bolognese/readers/ris_reader.rb | 2 +- lib/bolognese/readers/schema_org_reader.rb | 7 +- lib/bolognese/writers/bibtex_writer.rb | 2 +- lib/bolognese/writers/codemeta_writer.rb | 2 +- lib/bolognese/writers/csv_writer.rb | 2 +- lib/bolognese/writers/jats_writer.rb | 6 +- lib/bolognese/writers/ris_writer.rb | 2 +- lib/bolognese/writers/schema_org_writer.rb | 2 +- spec/fixtures/datacite-example-full-v4.5.xml | 255 +++++++++++++++++++ spec/readers/bibtex_reader_spec.rb | 2 + spec/readers/citeproc_reader_spec.rb | 3 + spec/readers/codemeta_reader_spec.rb | 8 +- spec/readers/crosscite_reader_spec.rb | 2 + spec/readers/crossref_reader_spec.rb | 82 +++--- spec/readers/datacite_json_reader_spec.rb | 2 + spec/readers/datacite_reader_spec.rb | 95 ++++--- spec/readers/npm_reader_spec.rb | 2 + spec/readers/ris_reader_spec.rb | 3 + spec/readers/schema_org_reader_spec.rb | 22 +- spec/writers/crosscite_writer_spec.rb | 7 + spec/writers/datacite_json_writer_spec.rb | 21 ++ spec/writers/datacite_writer_spec.rb | 88 ++++++- spec/writers/jats_writer_spec.rb | 8 + spec/writers/rdf_xml_writer_spec.rb | 7 + spec/writers/turtle_writer_spec.rb | 9 + 31 files changed, 566 insertions(+), 125 deletions(-) create mode 100644 spec/fixtures/datacite-example-full-v4.5.xml diff --git a/lib/bolognese/datacite_utils.rb b/lib/bolognese/datacite_utils.rb index 9826e0dd..9d832cf7 100644 --- a/lib/bolognese/datacite_utils.rb +++ b/lib/bolognese/datacite_utils.rb @@ -108,7 +108,12 @@ def insert_titles(xml) end def insert_publisher(xml) - xml.publisher(publisher || container && container["title"]) + if publisher.is_a?(Hash) + attributes = { 'publisherIdentifier' => publisher["publisherIdentifier"], 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"], 'schemeURI' => publisher["schemeUri"] }.compact + xml.publisher(publisher["name"] || container && container["title"], attributes) + else + xml.publisher(publisher || container && container["title"]) + end end def insert_publication_year(xml) @@ -375,13 +380,11 @@ def insert_geo_locations(xml) end end if geo_location["geoLocationPolygon"] - geo_location["geoLocationPolygon"].each do |geo_location_polygon| - xml.geoLocationPolygon do - geo_location_polygon.each do |polygon_point| - xml.polygonPoint do - xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude")) - xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude")) - end + xml.geoLocationPolygon do + Array.wrap(geo_location["geoLocationPolygon"]).each do |polygon_point| + xml.polygonPoint do + xml.pointLatitude(polygon_point.dig("polygonPoint", "pointLatitude")) + xml.pointLongitude(polygon_point.dig("polygonPoint", "pointLongitude")) end end end diff --git a/lib/bolognese/metadata.rb b/lib/bolognese/metadata.rb index 50dacdfc..5ccc7b46 100644 --- a/lib/bolognese/metadata.rb +++ b/lib/bolognese/metadata.rb @@ -222,7 +222,12 @@ def dates end def publisher - @publisher ||= meta.fetch("publisher", nil) + @publisher ||= + if meta.fetch("publisher", nil).is_a?(Hash) + meta.fetch("publisher", nil) + elsif meta.fetch("publisher", nil).is_a?(String) + { "name" => meta.fetch("publisher", nil) }.compact + end end def identifiers diff --git a/lib/bolognese/metadata_utils.rb b/lib/bolognese/metadata_utils.rb index 8b76e910..bedd1589 100644 --- a/lib/bolognese/metadata_utils.rb +++ b/lib/bolognese/metadata_utils.rb @@ -161,7 +161,7 @@ def citeproc_hsh "volume" => container.to_h["volume"], "issue" => container.to_h["issue"], "page" => page, - "publisher" => publisher, + "publisher" => publisher["name"], "title" => parse_attributes(titles, content: "title", first: true), "URL" => url, "copyright" => Array.wrap(rights_list).map { |l| l["rights"] }.first, diff --git a/lib/bolognese/readers/bibtex_reader.rb b/lib/bolognese/readers/bibtex_reader.rb index 5b98888c..ce04ca50 100644 --- a/lib/bolognese/readers/bibtex_reader.rb +++ b/lib/bolognese/readers/bibtex_reader.rb @@ -86,7 +86,7 @@ def read_bibtex(string: nil, **options) "titles" => meta.try(:title).present? ? [{ "title" => meta.try(:title).to_s }] : [], "creators" => creators, "container" => container, - "publisher" => meta.try(:publisher).to_s.presence, + "publisher" => meta.try(:publisher).present? ? { "name" => meta.try(:publisher).to_s }.compact : nil, "related_identifiers" => related_identifiers, "dates" => dates, "publication_year" => publication_year, diff --git a/lib/bolognese/readers/crossref_reader.rb b/lib/bolognese/readers/crossref_reader.rb index 36ef8c9b..bd8af078 100644 --- a/lib/bolognese/readers/crossref_reader.rb +++ b/lib/bolognese/readers/crossref_reader.rb @@ -40,8 +40,7 @@ def read_crossref(string: nil, **options) journal_metadata = nil journal_issue = {} journal_metadata = nil - publisher = query.dig("crm_item", 0) - publisher = nil unless publisher.is_a?(String) + publisher = query.dig("crm_item", 0).is_a?(String) ? { "name" => query.dig("crm_item", 0) } : nil case model when "book" diff --git a/lib/bolognese/readers/datacite_reader.rb b/lib/bolognese/readers/datacite_reader.rb index 4499266c..52edbb36 100644 --- a/lib/bolognese/readers/datacite_reader.rb +++ b/lib/bolognese/readers/datacite_reader.rb @@ -94,6 +94,21 @@ def read_datacite(string: nil, **options) titles = get_titles(meta) + publisher = Array.wrap(meta.dig("publisher")).map do |r| + if r.blank? + nil + elsif r.is_a?(String) + { "name" => r.strip } + elsif r.is_a?(Hash) + { + "name" => r["__content__"].strip, + "publisherIdentifier" => r["publisherIdentifier"], + "publisherIdentifierScheme" => r["publisherIdentifierScheme"], + "schemeUri" => r["schemeURI"], + }.compact + end + end.compact.first + descriptions = Array.wrap(meta.dig("descriptions", "description")).map do |r| if r.blank? nil @@ -287,7 +302,7 @@ def read_datacite(string: nil, **options) "creators" => get_authors(Array.wrap(meta.dig("creators", "creator"))), "contributors" => get_authors(Array.wrap(meta.dig("contributors", "contributor"))), "container" => set_container(meta), - "publisher" => parse_attributes(meta.fetch("publisher", nil), first: true).to_s.strip.presence, + "publisher" => publisher, "agency" => "datacite", "funding_references" => funding_references, "dates" => dates, diff --git a/lib/bolognese/readers/ris_reader.rb b/lib/bolognese/readers/ris_reader.rb index 30bd0d49..18ef6f80 100644 --- a/lib/bolognese/readers/ris_reader.rb +++ b/lib/bolognese/readers/ris_reader.rb @@ -89,7 +89,7 @@ def read_ris(string: nil, **options) "url" => meta.fetch("UR", nil), "titles" => meta.fetch("T1", nil).present? ? [{ "title" => meta.fetch("T1", nil) }] : nil, "creators" => get_authors(author), - "publisher" => meta.fetch("PB", "(:unav)"), + "publisher" => { "name" => meta.fetch("PB", "(:unav)") }, "container" => container, "related_identifiers" => related_identifiers, "dates" => dates, diff --git a/lib/bolognese/readers/schema_org_reader.rb b/lib/bolognese/readers/schema_org_reader.rb index 706fdfa8..2d0d050e 100644 --- a/lib/bolognese/readers/schema_org_reader.rb +++ b/lib/bolognese/readers/schema_org_reader.rb @@ -74,7 +74,12 @@ def read_schema_org(string: nil, **options) creators = get_authors(from_schema_org_creators(Array.wrap(authors))) end contributors = get_authors(from_schema_org_contributors(Array.wrap(meta.fetch("editor", nil)))) - publisher = parse_attributes(meta.fetch("publisher", nil), content: "name", first: true) + publisher = + if parse_attributes(meta.fetch("publisher", nil), content: "name", first: true) + { + "name" => parse_attributes(meta.fetch("publisher", nil), content: "name", first: true), + }.compact + end ct = (schema_org == "Dataset") ? "includedInDataCatalog" : "Periodical" container = if meta.fetch(ct, nil).present? diff --git a/lib/bolognese/writers/bibtex_writer.rb b/lib/bolognese/writers/bibtex_writer.rb index 99f5eee7..47a20b84 100644 --- a/lib/bolognese/writers/bibtex_writer.rb +++ b/lib/bolognese/writers/bibtex_writer.rb @@ -21,7 +21,7 @@ def bibtex volume: container.to_h["volume"], issue: container.to_h["issue"], pages: pages, - publisher: publisher, + publisher: publisher["name"], year: publication_year, copyright: Array.wrap(rights_list).map { |l| l["rights"] }.first, }.compact diff --git a/lib/bolognese/writers/codemeta_writer.rb b/lib/bolognese/writers/codemeta_writer.rb index 807136ae..c990b4d9 100644 --- a/lib/bolognese/writers/codemeta_writer.rb +++ b/lib/bolognese/writers/codemeta_writer.rb @@ -19,7 +19,7 @@ def codemeta "tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil, "datePublished" => get_date(dates, "Issued") || publication_year, "dateModified" => get_date(dates, "Updated"), - "publisher" => publisher, + "publisher" => publisher["name"], "license" => Array.wrap(rights_list).map { |l| l["rightsUri"] }.compact.unwrap, }.compact JSON.pretty_generate hsh.presence diff --git a/lib/bolognese/writers/csv_writer.rb b/lib/bolognese/writers/csv_writer.rb index 28af2810..35c79be2 100644 --- a/lib/bolognese/writers/csv_writer.rb +++ b/lib/bolognese/writers/csv_writer.rb @@ -15,7 +15,7 @@ def csv resource_type: types["resourceType"], title: parse_attributes(titles, content: "title", first: true), author: authors_as_string(creators), - publisher: publisher, + publisher: publisher["name"], publication_year: publication_year }.values diff --git a/lib/bolognese/writers/jats_writer.rb b/lib/bolognese/writers/jats_writer.rb index 8b1c7bdb..20877412 100644 --- a/lib/bolognese/writers/jats_writer.rb +++ b/lib/bolognese/writers/jats_writer.rb @@ -77,16 +77,16 @@ def insert_citation_title(xml) def insert_source(xml) if is_chapter? - xml.source(publisher) + xml.source(publisher["name"]) elsif is_article? || is_data? - xml.source(container && container["title"] || publisher) + xml.source(container && container["title"] || publisher["name"]) else xml.source(parse_attributes(titles, content: "title", first: true)) end end def insert_publisher_name(xml) - xml.send("publisher-name", publisher) + xml.send("publisher-name", publisher["name"]) end def insert_publication_date(xml) diff --git a/lib/bolognese/writers/ris_writer.rb b/lib/bolognese/writers/ris_writer.rb index 2c78d252..8a5adb7f 100644 --- a/lib/bolognese/writers/ris_writer.rb +++ b/lib/bolognese/writers/ris_writer.rb @@ -14,7 +14,7 @@ def ris "AB" => parse_attributes(abstract_description, content: "description", first: true), "KW" => Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.presence, "PY" => publication_year, - "PB" => publisher, + "PB" => publisher["name"], "LA" => language, "VL" => container.to_h["volume"], "IS" => container.to_h["issue"], diff --git a/lib/bolognese/writers/schema_org_writer.rb b/lib/bolognese/writers/schema_org_writer.rb index cc3aba01..b2809a50 100644 --- a/lib/bolognese/writers/schema_org_writer.rb +++ b/lib/bolognese/writers/schema_org_writer.rb @@ -37,7 +37,7 @@ def schema_hsh "schemaVersion" => schema_version, "periodical" => types.present? ? ((types["schemaOrg"] != "Dataset") && container.present? ? to_schema_org(container) : nil) : nil, "includedInDataCatalog" => types.present? ? ((types["schemaOrg"] == "Dataset") && container.present? ? to_schema_org_container(container, type: "Dataset") : nil) : nil, - "publisher" => publisher.present? ? { "@type" => "Organization", "name" => publisher } : nil, + "publisher" => publisher.present? ? { "@type" => "Organization", "name" => publisher["name"] } : nil, "funder" => to_schema_org_funder(funding_references), "provider" => agency.present? ? { "@type" => "Organization", "name" => agency } : nil }.compact.presence diff --git a/spec/fixtures/datacite-example-full-v4.5.xml b/spec/fixtures/datacite-example-full-v4.5.xml new file mode 100644 index 00000000..b6642a58 --- /dev/null +++ b/spec/fixtures/datacite-example-full-v4.5.xml @@ -0,0 +1,255 @@ + + + + 10.82433/B09Z-4K37 + + + ExampleFamilyName, ExampleGivenName + ExampleGivenName + ExampleFamilyName + https://orcid.org/0000-0001-5727-2427 + ExampleAffiliation + + + ExampleOrganization + https://ror.org/04wxnsj81 + + + + Example Title + Example Subtitle + Example TranslatedTitle + Example AlternativeTitle + + Example Publisher + 2023 + Example ResourceType + + FOS: Computer and information sciences + Digital curation and preservation + Example Subject + + + + ExampleFamilyName, ExampleGivenName + ExampleGivenName + ExampleFamilyName + https://orcid.org/0000-0001-5727-2427/ + ExampleAffiliation + + + ExampleFamilyName, ExampleGivenName + + + ExampleFamilyName, ExampleGivenName + + + ExampleFamilyName, ExampleGivenName + + + ExampleOrganization + + + ExampleFamilyName, ExampleGivenName + + + ExampleOrganization + + + ExampleFamilyName, ExampleGivenName + + + ExampleFamilyName, ExampleGivenName + + + ExampleFamilyName, ExampleGivenName + + + ExampleFamilyName, ExampleGivenName + + + DataCite + + + International DOI Foundation + + + ExampleFamilyName, ExampleGivenName + + + ExampleFamilyName, ExampleGivenName + + + ExampleContributor + + + ExampleFamilyName, ExampleGivenName + + + ExampleContributor + + + ExampleFamilyName, ExampleGivenName + + + ExampleOrganization + + + ExampleFamilyName, ExampleGivenName + + + + 2023-01-01 + 2023-01-01 + 2023-01-01 + 2022-01-01/2022-12-31 + 2023-01-01 + 2023-01-01 + 2023-01-01 + 2023-01-01 + 2023-01-01 + 2023-01-01 + 2023-01-01 + + en + + 12345 + + + ark:/13030/tqb3kh97gh8w + arXiv:0706.0001 + 2018AGUFM.A24K..07S + 10.1016/j.epsl.2011.11.037 + 9783468111242 + 1562-6865 + 10013/epic.10033 + IECUR0097 + 978-3-905673-82-1 + 0077-5606 + 0A9 2002 12B4A105 7 + 1188-1534 + urn:lsid:ubio.org:namebank:11815 + 12082125 + http://purl.oclc.org/foo/bar + 123456789999 + http://www.heatflow.und.edu/index2.html + urn:nbn:de:101:1-201102033592 + https://w3id.org/games/spec/coil#Coil_Bomb_Die_Of_Age + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + 10.1016/j.epsl.2011.11.037 + + + 1 MB + 90 pages + + + application/xml + text/plain + + 1 + + Creative Commons Attribution 4.0 International + + + Example Abstract + Example Methods + Example SeriesInformation + Example TableOfContents + Example TechnicalInfo + Example Other + + + + Vancouver, British Columbia, Canada + + 49.2827 + -123.1207 + + + -123.27 + -123.02 + 49.195 + 49.315 + + + + 41.991 + -71.032 + + + 42.893 + -69.622 + + + 41.991 + -68.211 + + + 41.090 + -69.622 + + + 41.991 + -71.032 + + + + + + + Example Funder + https://doi.org/10.13039/501100000780 + 12345 + Example AwardTitle + + + + + 1234-5678 + + + ExampleFamilyName, ExampleGivenName + ExampleGivenName + ExampleFamilyName + + + + Example RelatedItem Title + Example RelatedItem TranslatedTitle + + 1990 + 1 + 2 + 1 + 1 + 100 + Example RelatedItem Publisher + Example RelatedItem Edition + + + ExampleFamilyName, ExampleGivenName + ExampleGivenName + ExampleFamilyName + + + + + + \ No newline at end of file diff --git a/spec/readers/bibtex_reader_spec.rb b/spec/readers/bibtex_reader_spec.rb index 31fc80b4..640bb306 100644 --- a/spec/readers/bibtex_reader_spec.rb +++ b/spec/readers/bibtex_reader_spec.rb @@ -34,6 +34,7 @@ expect(subject.creators.length).to eq(5) expect(subject.creators.first).to eq("familyName"=>"Sankar", "givenName"=>"Martial", "name"=>"Sankar, Martial", "nameType"=>"Personal") expect(subject.titles).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}]) + expect(subject.publisher).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."}) expect(subject.descriptions.first["description"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.") expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Attribution 3.0 Unported", "rightsIdentifier"=>"cc-by-3.0", @@ -54,6 +55,7 @@ expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") expect(subject.types).to eq("bibtex"=>"phdthesis", "citeproc"=>"thesis", "resourceTypeGeneral"=>"Dissertation", "resourceType"=>"Dissertation", "ris"=>"THES", "schemaOrg"=>"Thesis") expect(subject.creators).to eq([{"familyName"=>"Toparlar", "givenName"=>"Y.", "name"=>"Toparlar, Y.", "nameType"=>"Personal"}]) + expect(subject.publisher).to eq({"name"=>"Technische Universiteit Eindhoven"}) expect(subject.titles).to eq([{"title"=>"A multiscale analysis of the urban heat island effect: from city averaged temperatures to the energy demand of individual buildings"}]) expect(subject.descriptions.first["description"]).to start_with("Designing the climates of cities") expect(subject.dates).to eq([{"date"=>"2018", "dateType"=>"Issued"}]) diff --git a/spec/readers/citeproc_reader_spec.rb b/spec/readers/citeproc_reader_spec.rb index 97762401..a8a4f42c 100644 --- a/spec/readers/citeproc_reader_spec.rb +++ b/spec/readers/citeproc_reader_spec.rb @@ -20,6 +20,7 @@ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting") expect(subject.creators).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}]) + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}]) expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food") expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}]) @@ -36,6 +37,7 @@ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting") expect(subject.creators).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}]) + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}]) expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food") expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}]) @@ -52,6 +54,7 @@ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting") expect(subject.creators).to eq([{"name"=>":(unav)", "nameType"=>"Organizational"}]) + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}]) expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food") expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}]) diff --git a/spec/readers/codemeta_reader_spec.rb b/spec/readers/codemeta_reader_spec.rb index 5c4302a1..ac9590ea 100644 --- a/spec/readers/codemeta_reader_spec.rb +++ b/spec/readers/codemeta_reader_spec.rb @@ -35,7 +35,7 @@ expect(subject.subjects).to eq([{"subject"=>"faraday"}, {"subject"=>"excon"}, {"subject"=>"net/http"}]) expect(subject.dates).to eq([{"date"=>"2017-02-24", "dateType"=>"Issued"}, {"date"=>"2015-11-28", "dateType"=>"Created"}, {"date"=>"2017-02-24", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.rights_list).to eq([{"rights"=>"MIT License", "rightsIdentifier"=>"mit", "rightsIdentifierScheme"=>"SPDX", @@ -76,7 +76,7 @@ expect(subject.version_info).to eq("2.0.0") expect(subject.dates).to eq([{"date"=>"2016-05-27", "dateType"=>"Issued"}, {"date"=>"2016-05-27", "dateType"=>"Created"}, {"date"=>"2016-05-27", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2016") - expect(subject.publisher).to eq("https://cran.r-project.org") + expect(subject.publisher).to eq({"name"=>"https://cran.r-project.org"}) expect(subject.rights_list).to eq([{"rights"=>"Apache License 2.0", "rightsIdentifier"=>"apache-2.0", "rightsIdentifierScheme"=>"SPDX", @@ -105,7 +105,7 @@ expect(subject.subjects).to eq([{"subject"=>"faraday"}, {"subject"=>"excon"}, {"subject"=>"net/http"}]) expect(subject.dates).to eq([{"date"=>"2017-02-24", "dateType"=>"Issued"}, {"date"=>"2015-11-28", "dateType"=>"Created"}, {"date"=>"2017-02-24", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.rights_list).to eq([{"rights"=>"MIT License", "rightsIdentifier"=>"mit", "rightsIdentifierScheme"=>"SPDX", @@ -127,7 +127,7 @@ expect(subject.subjects).to eq([{"subject"=>"doi"}, {"subject"=>"software"}, {"subject"=>"codemeta"}]) expect(subject.dates).to eq([{"date"=>"2018-05-17", "dateType"=>"Issued"}, {"date"=>"2018-03-09", "dateType"=>"Created"}, {"date"=>"2018-05-17", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.rights_list).to eq([{"rights"=>"MIT License", "rightsIdentifier"=>"mit", "rightsIdentifierScheme"=>"SPDX", diff --git a/spec/readers/crosscite_reader_spec.rb b/spec/readers/crosscite_reader_spec.rb index a7273b80..a08c3188 100644 --- a/spec/readers/crosscite_reader_spec.rb +++ b/spec/readers/crosscite_reader_spec.rb @@ -19,6 +19,7 @@ expect(subject.identifiers).to eq([{"Identifier"=>"https://doi.org/10.5281/zenodo.48440", "identifierType"=>"DOI"}, {"Identifier"=>"http://zenodo.org/record/48440", "identifierType"=>"URL"}]) expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"other", "resourceType"=>"Software", "resourceTypeGeneral"=>"Software", "ris"=>"COMP", "schemaOrg"=>"SoftwareSourceCode") expect(subject.creators).to eq([{"type"=>"Person", "familyName" => "Garza", "givenName" => "Kristian", "name" => "Kristian Garza"}]) + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.titles).to eq([{"title"=>"Analysis Tools for Crossover Experiment of UI using Choice Architecture"}]) expect(subject.descriptions.first["description"]).to start_with("This tools are used to analyse the data produced by the Crosssover Experiment") expect(subject.dates).to eq("date"=>"2016-03-27", "dateType"=>"Issued") @@ -32,6 +33,7 @@ expect(subject.identifiers).to eq([{"Identifier"=>"https://doi.org/10.5281/zenodo.48440", "identifierType"=>"DOI"}, {"Identifier"=>"http://zenodo.org/record/48440", "identifierType"=>"URL"}]) expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"other", "resourceType"=>"Software", "resourceTypeGeneral"=>"Software", "ris"=>"COMP", "schemaOrg"=>"SoftwareSourceCode") expect(subject.creators).to eq([{"type"=>"Person", "familyName" => "Garza", "givenName" => "Kristian", "name" => "Kristian Garza"}]) + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.titles).to eq([{"title"=>"Analysis Tools for Crossover Experiment of UI using Choice Architecture"}]) expect(subject.descriptions.first["description"]).to start_with("This tools are used to analyse the data produced by the Crosssover Experiment") expect(subject.dates).to eq("date"=>"2016-03-27", "dateType"=>"Issued") diff --git a/spec/readers/crossref_reader_spec.rb b/spec/readers/crossref_reader_spec.rb index 80312311..f808c63d 100644 --- a/spec/readers/crossref_reader_spec.rb +++ b/spec/readers/crossref_reader_spec.rb @@ -32,7 +32,7 @@ expect(subject.titles).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}]) expect(subject.dates).to eq([{"date"=>"2014-02-11", "dateType"=>"Issued"}, {"date"=>"2018-08-23T09:41:49Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2014") - expect(subject.publisher).to eq("eLife Sciences Publications, Ltd") + expect(subject.publisher).to eq({"name"=>"eLife Sciences Publications, Ltd"}) expect(subject.container).to eq("firstPage" => "e01567", "identifier"=>"2050-084X", "identifierType"=>"ISSN", "title"=>"eLife", "type"=>"Journal", "volume"=>"3") expect(subject.related_identifiers.length).to eq(27) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"2050-084X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") @@ -69,7 +69,7 @@ "schemeUri"=>"https://spdx.org/licenses/"}]) expect(subject.dates).to eq([{"date"=>"2006-12-20", "dateType"=>"Issued"}, {"date"=>"2020-05-09T09:35:17Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2006") - expect(subject.publisher).to eq("Public Library of Science (PLoS)") + expect(subject.publisher).to eq({"name"=>"Public Library of Science (PLoS)"}) expect(subject.related_identifiers.length).to eq(64) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"1932-6203", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.1056/nejm199109123251104", "relatedIdentifierType"=>"DOI", "relationType"=>"References") @@ -95,7 +95,7 @@ "schemeUri"=>"https://spdx.org/licenses/"}]) expect(subject.dates).to eq([{"date"=>"2019-07-02", "dateType"=>"Issued"}, {"date"=>"2019-09-22T06:40:23Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2019") - expect(subject.publisher).to eq("Frontiers Media SA") + expect(subject.publisher).to eq({"name"=>"Frontiers Media SA"}) expect(subject.funding_references).to eq([{"awardNumber"=>"CA17111", "funderIdentifier"=>"https://doi.org/10.13039/501100000921", "funderIdentifierType"=>"Crossref Funder ID", "funderName"=>"COST (European Cooperation in Science and Technology)"}]) expect(subject.related_identifiers.length).to eq(70) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"1664-462X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") @@ -115,7 +115,7 @@ expect(subject.titles).to eq([{"lang"=>"ja", "title"=>"??????????????????????????????"}]) expect(subject.dates).to include({"date"=>"2007", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2007") - expect(subject.publisher).to eq("The Japanese Society of Physical Fitness and Sports Medicine") + expect(subject.publisher).to eq({"name"=>"The Japanese Society of Physical Fitness and Sports Medicine"}) expect(subject.related_identifiers.length).to eq(1) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"1881-4751", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.container).to eq("firstPage"=>"60", "identifier"=>"1881-4751", "identifierType"=>"ISSN", "issue"=>"1", "lastPage"=>"60", "title"=>"Japanese Journal of Physical Fitness and Sports Medicine", "type"=>"Journal", "volume"=>"56") @@ -134,7 +134,7 @@ expect(subject.titles).to eq([{"title"=>"Global distribution of Fabaeformiscandona subacuta: an??exotic??invasive Ostracoda on the Iberian Peninsula?"}]) expect(subject.dates).to include({"date"=>"2012-01-01", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2012") - expect(subject.publisher).to eq("Oxford University Press (OUP)") + expect(subject.publisher).to eq({"name"=>"Oxford University Press (OUP)"}) expect(subject.related_identifiers.length).to eq(44) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"1937-240X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.1002/aqc.1122", "relatedIdentifierType"=>"DOI", "relationType"=>"References") @@ -154,7 +154,7 @@ expect(subject.titles).to eq([{"title"=>"Human Body Orientation Estimation in Multiview Scenarios"}]) expect(subject.dates).to eq([{"date"=>"2012", "dateType"=>"Issued"}, {"date"=>"2020-11-24T03:11:32Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2012") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.related_identifiers.length).to eq(7) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"10.1007/978-3-540-24670-1_3", "relatedIdentifierType"=>"DOI", "relationType"=>"References") expect(subject.container).to eq("identifier"=>"1611-3349", "identifierType"=>"ISSN", "title"=>"Lecture Notes in Computer Science", "type"=>"Book Series") @@ -175,7 +175,7 @@ expect(subject.descriptions.first["description"]).to start_with("This article presents a practical roadmap") expect(subject.dates).to include({"date"=>"2017-10-09", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("Cold Spring Harbor Laboratory") + expect(subject.publisher).to eq({"name"=>"Cold Spring Harbor Laboratory"}) expect(subject.agency).to eq("crossref") end @@ -197,7 +197,7 @@ expect(subject.descriptions).to be_empty expect(subject.dates).to include({"date"=>"2020-05-19", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2020") - expect(subject.publisher).to eq("eLife Sciences Publications, Ltd") + expect(subject.publisher).to eq({"name"=>"eLife Sciences Publications, Ltd"}) expect(subject.agency).to eq("crossref") end @@ -221,7 +221,7 @@ expect(subject.descriptions).to be_empty expect(subject.dates).to include({"date"=>"2020-06-08", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2020") - expect(subject.publisher).to eq("University of Queensland Library") + expect(subject.publisher).to eq({"name"=>"University of Queensland Library"}) expect(subject.agency).to eq("crossref") end @@ -237,7 +237,7 @@ expect(subject.titles).to eq([{"title"=>"THE IMPACT OF PARASITE MANIPULATION AND PREDATOR FORAGING BEHAVIOR ON PREDATOR???PREY COMMUNITIES"}]) expect(subject.dates).to eq([{"date"=>"2006-11", "dateType"=>"Issued"}, {"date"=>"2019-04-28T17:51:50Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2006") - expect(subject.publisher).to eq("Wiley") + expect(subject.publisher).to eq({"name"=>"Wiley"}) expect(subject.related_identifiers.length).to eq(35) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"0012-9658", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.1098/rspb.2002.2213", "relatedIdentifierType"=>"DOI", "relationType"=>"References") @@ -262,7 +262,7 @@ expect(subject.titles).to eq([{"title"=>"Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers"}]) expect(subject.dates).to include({"date"=>"2012", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2012") - expect(subject.publisher).to eq("Hindawi Limited") + expect(subject.publisher).to eq({"name"=>"Hindawi Limited"}) expect(subject.related_identifiers.length).to eq(18) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"2090-1844", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.1378/chest.12-0045", "relatedIdentifierType"=>"DOI", "relationType"=>"References") @@ -283,7 +283,7 @@ expect(subject.titles).to eq([{"title"=>"Paving the path to HIV neurotherapy: Predicting SIV CNS disease"}]) expect(subject.dates).to include({"date"=>"2015-07", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("Elsevier BV") + expect(subject.publisher).to eq({"name"=>"Elsevier BV"}) expect(subject.related_identifiers).to eq([{"relatedIdentifier"=>"0014-2999", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection"}, {"relatedIdentifier"=>"10.1212/01.wnl.0000287431.88658.8b", "relatedIdentifierType"=>"DOI", @@ -562,7 +562,7 @@ expect(subject.titles).to eq([{"title"=>"Albinism in phylogenetically and geographically distinct populations of Astyanax cavefish arises through the same loss-of-function Oca2 allele"}]) expect(subject.dates).to include({"date"=>"2013-04-10", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.related_identifiers.size).to eq(35) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"1365-2540", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.container).to eq("firstPage"=>"122", "identifier"=>"1365-2540", "identifierType"=>"ISSN", "issue"=>"2", "lastPage"=>"130", "title"=>"Heredity", "type"=>"Journal", "volume"=>"111") @@ -582,7 +582,7 @@ expect(subject.descriptions).to eq([{"description"=>"x-ray diffraction structure", "descriptionType"=>"Other"}]) expect(subject.dates).to include({"date"=>"1984-07-17", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("1984") - expect(subject.publisher).to eq("Worldwide Protein Data Bank") + expect(subject.publisher).to eq({"name"=>"Worldwide Protein Data Bank"}) expect(subject.agency).to eq("crossref") end @@ -598,7 +598,7 @@ expect(subject.descriptions).to be_empty expect(subject.dates).to eq([{"date"=>"2015-10-20", "dateType"=>"Issued"}, {"date"=>"2018-10-19T21:13:42Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("Public Library of Science (PLoS)") + expect(subject.publisher).to eq({"name"=>"Public Library of Science (PLoS)"}) expect(subject.agency).to eq("crossref") end @@ -615,7 +615,7 @@ expect(subject.descriptions).to be_empty expect(subject.dates).to eq([{"date"=>"2017-08-09", "dateType"=>"Issued"}, {"date"=>"2020-06-04T21:31:55Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("USDA Forest Service") + expect(subject.publisher).to eq({"name"=>"USDA Forest Service"}) expect(subject.agency).to eq("crossref") end @@ -631,7 +631,7 @@ expect(subject.titles).to eq([{"title"=>"Clinical Symptoms and Physical Examinations"}]) expect(subject.dates).to eq([{"date"=>"2015", "dateType"=>"Issued"}, {"date"=>"2015-04-14T02:31:13Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.agency).to eq("crossref") expect(subject.container["type"]).to eq("Book") expect(subject.container["title"]).to eq("Shoulder Stiffness") @@ -651,7 +651,7 @@ expect(subject.titles).to eq([{"title"=>"Climate Change and Increasing Risk of Extreme Heat"}]) expect(subject.dates).to include({"date"=>"2018", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.agency).to eq("crossref") expect(subject.container["type"]).to eq("Book Series") expect(subject.container["title"]).to eq("SpringerBriefs in Medical Earth Sciences") @@ -670,7 +670,7 @@ expect(subject.titles).to eq([{"title"=>"Unsupervised and Supervised Image Segmentation Using Graph Partitioning"}]) expect(subject.dates).to eq([{"date"=>"2012-08-08", "dateType"=>"Issued"}, {"date"=>"2019-07-02T17:17:21Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2012") - expect(subject.publisher).to eq("IGI Global") + expect(subject.publisher).to eq({"name"=>"IGI Global"}) expect(subject.agency).to eq("crossref") expect(subject.container["type"]).to eq("Book") expect(subject.container["title"]).to eq("Graph-Based Methods in Computer Vision") @@ -690,7 +690,7 @@ expect(subject.titles).to eq([{"title"=>"Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics"}]) expect(subject.dates).to eq([{"date"=>"2018-04-09", "dateType"=>"Issued"}, {"date"=>"2018-04-10T17:58:05Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("MDPI AG") + expect(subject.publisher).to eq({"name"=>"MDPI AG"}) expect(subject.agency).to eq("crossref") end @@ -706,7 +706,7 @@ expect(subject.titles).to eq([{"title"=>"The Politics of the Past in Early China"}]) expect(subject.dates).to eq([{"date"=>"2019-07-01", "dateType"=>"Issued"}, {"date"=>"2021-01-08T19:18:57Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2019") - expect(subject.publisher).to eq("Cambridge University Press (CUP)") + expect(subject.publisher).to eq({"name"=>"Cambridge University Press (CUP)"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2019-07-06T10:19:22Z") end @@ -724,7 +724,7 @@ expect(subject.titles).to eq([{"title"=>"Proceedings of the Ocean Drilling Program, 180 Initial Reports"}]) expect(subject.dates).to eq([{"date"=>"2000-02-04", "dateType"=>"Issued"}, {"date"=>"2009-02-02T21:19:43Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2000") - expect(subject.publisher).to eq("International Ocean Discovery Program (IODP)") + expect(subject.publisher).to eq({"name"=>"International Ocean Discovery Program (IODP)"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2006-10-17T20:17:44Z") end @@ -741,7 +741,7 @@ expect(subject.titles).to eq([{"title"=>"Biogeography of Lanternfishes (Myctophidae) South of 30??S"}]) expect(subject.dates).to eq([{"date"=>"1982", "dateType"=>"Issued"}, {"date"=>"2021-02-23T21:58:36Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("1982") - expect(subject.publisher).to eq("Wiley") + expect(subject.publisher).to eq({"name"=>"Wiley"}) expect(subject.related_identifiers.length).to eq(44) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"10.1016/0031-0182(70)90103-3", "relatedIdentifierType"=>"DOI", "relationType"=>"References") expect(subject.container).to eq("identifier"=>"0066-4634", "identifierType"=>"ISSN", "title"=>"Antarctic Research Series", "type"=>"Book Series", "volume"=>"35") @@ -762,7 +762,7 @@ expect(subject.titles).to eq([{"title"=>"Substitutability between organic and conventional poultry products and organic price premiums"}]) expect(subject.dates).to include({"date"=>"2018-05", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Franco Angeli") + expect(subject.publisher).to eq({"name"=>"Franco Angeli"}) expect(subject.agency).to eq("mEDRA") end @@ -779,7 +779,7 @@ expect(subject.titles).to eq([{"title"=>"Synthesis, Crystal Structure and Theoretical Calculation of a Novel Nickel(II) Complex with Dibromotyrosine and 1,10-Phenanthroline"}]) expect(subject.dates).to eq([{"date"=>"2013-10-20", "dateType"=>"Issued"}, {"date"=>"2016-12-15T02:40:52Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Korean Chemical Society") + expect(subject.publisher).to eq({"name"=>"Korean Chemical Society"}) expect(subject.agency).to eq("KISTI") end @@ -794,7 +794,7 @@ expect(subject.titles).to eq([{"title"=>"Utilizing the Internet. 12 Series. Future of the Internet."}]) expect(subject.dates).to eq([{"date"=>"1997", "dateType"=>"Issued"}, {"date"=>"2020-03-06T06:44:36Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("1997") - expect(subject.publisher).to eq("Japan Science and Technology Agency (JST)") + expect(subject.publisher).to eq({"name"=>"Japan Science and Technology Agency (JST)"}) expect(subject.agency).to eq("JaLC") end @@ -810,7 +810,7 @@ expect(subject.titles).to eq([{"title"=>"Scientific opinion on the safety of green tea catechins"}]) expect(subject.dates).to include({"date"=>"2018-04", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Wiley") + expect(subject.publisher).to eq({"name"=>"Wiley"}) expect(subject.agency).to eq("OP") end @@ -825,7 +825,7 @@ expect(subject.titles).to eq([{"title"=>"Distances, absence, proximit??s et pr??sences??: des concepts en d??placement"}, {"title"=>"Distance(s), proximity and presence(s): evolving concepts"}]) expect(subject.dates).to include({"date"=>"2014-12-14", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2014") - expect(subject.publisher).to eq("OpenEdition") + expect(subject.publisher).to eq({"name"=>"OpenEdition"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to be_nil end @@ -860,7 +860,7 @@ expect(subject.titles).to eq([{"title"=>"Finding function: evaluation methods for functional genomic data"}]) expect(subject.dates).to include({"date"=>"2006-07-25", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2006") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2020-04-20T16:04:45Z") end @@ -877,7 +877,7 @@ expect(subject.titles).to eq([{"title"=>"Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle Callosobruchus maculatus"}]) expect(subject.dates).to include({"date"=>"2017-05-24", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("The Royal Society") + expect(subject.publisher).to eq({"name"=>"The Royal Society"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2021-02-14T10:36:45Z") end @@ -895,7 +895,7 @@ expect(subject.rights_list).to eq([{"rightsUri"=>"http://doi.wiley.com/10.1002/tdm_license_1.1"}]) expect(subject.dates).to eq([{"date"=>"2010-12", "dateType"=>"Issued"}, {"date"=>"2021-02-04T22:37:42Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2010") - expect(subject.publisher).to eq("Wiley") + expect(subject.publisher).to eq({"name"=>"Wiley"}) end it "invalid date" do @@ -916,7 +916,7 @@ expect(subject.titles).to eq([{"title"=>"Silver-Catalyzed [3+3] Annulation of Glycine Imino Esters with Seyferth???Gilbert Reagent To Access Tetrahydro-1,2,4-triazinecarboxylate Esters"}]) expect(subject.dates).to eq([{"date"=>"2020-04-08", "dateType"=>"Issued"}, {"date"=>"2020-06-16T23:13:36Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2020") - expect(subject.publisher).to eq("Georg Thieme Verlag KG") + expect(subject.publisher).to eq({"name"=>"Georg Thieme Verlag KG"}) end it "journal article with" do @@ -932,7 +932,7 @@ expect(subject.rights_list).to eq([{"rightsUri"=>"http://doi.wiley.com/10.1002/tdm_license_1.1"}, {"rightsUri"=>"http://onlinelibrary.wiley.com/termsAndConditions#vor"}]) expect(subject.dates).to include({"date"=>"2018-05", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Wiley") + expect(subject.publisher).to eq({"name"=>"Wiley"}) expect(subject.related_identifiers.length).to eq(49) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"0028-646X", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.1002/pmic.201400530", "relatedIdentifierType"=>"DOI", "relationType"=>"References") @@ -953,7 +953,7 @@ expect(subject.titles).to eq([{"title"=>"The impact of structural variation on human gene expression"}]) expect(subject.dates).to include({"date"=>"2017-04-03", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2019-11-02T09:30:06Z") end @@ -970,7 +970,7 @@ expect(subject.titles).to eq([{"title"=>"Workers and the City: Rethinking the Geographies of Power in Post-socialist Urbanisation"}]) expect(subject.dates).to include({"date"=>"2011-12-22", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2011") - expect(subject.publisher).to eq("SAGE Publications") + expect(subject.publisher).to eq({"name"=>"SAGE Publications"}) expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2021-05-16T02:02:38Z") end @@ -987,7 +987,7 @@ expect(subject.titles).to eq([{"title"=>"Log-Domain Arithmetic for High-Speed Fuzzy Control on a Field-Programmable Gate Array"}]) expect(subject.dates).to include({"date"=>"2013", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Springer Science and Business Media LLC") + expect(subject.publisher).to eq({"name"=>"Springer Science and Business Media LLC"}) expect(subject.container).to eq("identifier"=>"1860-0808", "identifierType"=>"ISSN", "title"=>"Studies in Fuzziness and Soft Computing", "type"=>"Book Series") expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2012-10-31T16:15:44Z") @@ -1005,7 +1005,7 @@ expect(subject.titles).to eq([{"title"=>"Prediction of a Large-Gap and Switchable Kane-Mele Quantum Spin Hall Insulator"}]) expect(subject.dates).to include({"date"=>"2018-03-13", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("American Physical Society (APS)") + expect(subject.publisher).to eq({"name"=>"American Physical Society (APS)"}) expect(subject.container).to eq("firstPage" => "117701", "identifier"=>"1079-7114", "identifierType"=>"ISSN", "issue"=>"11", "title"=>"Physical Review Letters", "type"=>"Journal", "volume"=>"120") expect(subject.agency).to eq("crossref") expect(subject.date_registered).to eq("2018-03-13T15:18:48Z") @@ -1028,7 +1028,7 @@ expect(subject.descriptions.first["description"]).to start_with("Abstract. During the early last glacial termination") expect(subject.dates).to include({"date"=>"2020-07-28", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2020") - expect(subject.publisher).to eq("Copernicus GmbH") + expect(subject.publisher).to eq({"name"=>"Copernicus GmbH"}) expect(subject.agency).to eq("crossref") end @@ -1048,7 +1048,7 @@ expect(subject.descriptions.first["description"]).to start_with("This chapter explores the nature of the connections") expect(subject.dates).to include({"date"=>"2018-04-05", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Oxford University Press (OUP)") + expect(subject.publisher).to eq({"name"=>"Oxford University Press (OUP)"}) expect(subject.agency).to eq("crossref") end @@ -1067,7 +1067,7 @@ expect(subject.descriptions).to be_empty expect(subject.dates).to include({"date"=>"2010-01-01", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2010") - expect(subject.publisher).to eq("Office of Scientific and Technical Information (OSTI)") + expect(subject.publisher).to eq({"name"=>"Office of Scientific and Technical Information (OSTI)"}) expect(subject.agency).to eq("crossref") end @@ -1082,7 +1082,7 @@ expect(subject.titles).to eq([{"title"=>":(unav)"}]) expect(subject.dates).to eq([{"date"=>"2018-10", "dateType"=>"Issued"}, {"date"=>"2018-10-03T12:09:12Z", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Baskent University") + expect(subject.publisher).to eq({"name"=>"Baskent University"}) expect(subject.related_identifiers.length).to eq(1) expect(subject.related_identifiers.first).to eq("relatedIdentifier"=>"2146-8427", "relatedIdentifierType"=>"ISSN", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Collection") expect(subject.container).to eq("identifier"=>"2146-8427", "identifierType"=>"ISSN", "issue"=>"5", "title"=>"Experimental and Clinical Transplantation", "type"=>"Journal", "volume"=>"16") diff --git a/spec/readers/datacite_json_reader_spec.rb b/spec/readers/datacite_json_reader_spec.rb index 2438d53a..4c0b0c50 100644 --- a/spec/readers/datacite_json_reader_spec.rb +++ b/spec/readers/datacite_json_reader_spec.rb @@ -18,6 +18,7 @@ expect(subject.valid?).to be true expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"BlogPosting", "resourceTypeGeneral"=>"Text", "ris"=>"RPRT", "schemaOrg"=>"ScholarlyArticle") expect(subject.creators).to eq([{"type"=>"Person", "id"=>"http://orcid.org/0000-0003-1419-2405", "name"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner"}]) + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}]) expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}, {"identifier"=>"MS-49-3632-5083", "identifierType"=>"Local accession number"}]) expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Created"}, {"date"=>"2016-12-20", "dateType"=>"Issued"}, {"date"=>"2016-12-20", "dateType"=>"Updated"}]) @@ -65,6 +66,7 @@ expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "resourceTypeGeneral"=>"Software", "ris"=>"COMP", "schemaOrg"=>"SoftwareSourceCode") expect(subject.creators.length).to eq(2) expect(subject.creators.first).to eq("affiliation"=>[{"name"=>"University of Washington"}], "familyName"=>"Vanderplas", "givenName"=>"Jake", "name"=>"Vanderplas, Jake", "nameIdentifiers"=>[], "nameType"=>"Personal") + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.titles).to eq([{"title"=>"Supersmoother: Minor Bug Fix Release"}]) expect(subject.id).to eq("https://doi.org/10.5281/zenodo.28518") expect(subject.identifiers).to eq([{"identifier"=>"https://zenodo.org/record/28518", "identifierType"=>"URL"}]) diff --git a/spec/readers/datacite_reader_spec.rb b/spec/readers/datacite_reader_spec.rb index ee4f4bc7..65b38cc9 100644 --- a/spec/readers/datacite_reader_spec.rb +++ b/spec/readers/datacite_reader_spec.rb @@ -42,7 +42,7 @@ {"subject"=>"taxonomy"}, {"subject"=>"mitochondrial genome"}, {"subject"=>"Parasites"}]) - expect(subject.publisher).to eq("Dryad") + expect(subject.publisher).to eq({"name"=>"Dryad"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -65,7 +65,7 @@ expect(subject.publication_year).to eq("2016") expect(subject.related_identifiers.length).to eq(3) expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/0000-00ss", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.subjects).to eq([{"subject"=>"datacite"}, {"subject"=>"doi"}, {"subject"=>"metadata"}, @@ -96,7 +96,7 @@ {"subject"=>"000 Computer science, knowledge, general works", "subjectScheme"=>"DDC"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik GmbH, Wadern/Saarbruecken, Germany") + expect(subject.publisher).to eq({"name"=>"Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik GmbH, Wadern/Saarbruecken, Germany"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.1") end @@ -149,7 +149,7 @@ expect(subject.language).to eq("en-US") expect(subject.sizes).to eq(["4 kB"]) expect(subject.formats).to eq(["application/xml"]) - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -166,7 +166,7 @@ expect(subject.titles).to eq([{"lang"=>"en", "title"=>"Data underpinning - The Sun as a planet-host star: Proxies from SDO images for HARPS radial-velocity variations"}]) expect(subject.dates).to eq([{"date"=>"2016-01-20", "dateType"=>"Available"}, {"date"=>"2016", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2016") - expect(subject.publisher).to eq("University of St Andrews") + expect(subject.publisher).to eq({"name"=>"University of St Andrews"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -185,7 +185,7 @@ expect(subject.publication_year).to eq("2011") expect(subject.sizes).to eq([]) expect(subject.subjects).to eq([{"subject"=>"Environmental research"}]) - expect(subject.publisher).to eq("EvK2 CNR Committee") + expect(subject.publisher).to eq({"name"=>"EvK2 CNR Committee"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.2") end @@ -217,7 +217,7 @@ expect(subject.subjects).to eq([{"subject"=>"choice architecture"}, {"subject"=>"crossover experiment"}, {"subject"=>"hci"}]) - expect(subject.publisher).to eq("Zenodo") + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -243,7 +243,7 @@ expect(subject.publication_year).to eq("2016") expect(subject.related_identifiers.length).to eq(1) expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.6084/m9.figshare.4234751", "relatedIdentifierType"=>"DOI", "relationType"=>"IsIdenticalTo") - expect(subject.publisher).to eq("figshare") + expect(subject.publisher).to eq({"name"=>"figshare"}) expect(subject.subjects).to eq([ {"schemeUri"=> "http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E", @@ -286,7 +286,7 @@ "schemeUri"=>"https://spdx.org/licenses/"}]) expect(subject.dates).to eq([{"date"=>"2015-06-14", "dateType"=>"Created"}, {"date"=>"2020-06-02", "dateType"=>"Updated"}, {"date"=>"2020", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2020") - expect(subject.publisher).to eq("figshare") + expect(subject.publisher).to eq({"name"=>"figshare"}) expect(subject.subjects).to eq([{"subject"=>"Evolutionary Biology"}, {"subject"=>"FOS: Biological sciences", "subjectScheme"=>"Fields of Science and Technology (FOS)", "schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf"}, {"subject"=>"60412 Quantitative Genetics (incl. Disease and Trait Mapping Genetics)", "subjectScheme"=>"FOR", "schemeUri"=>"http://www.abs.gov.au/ausstats/abs@.nsf/0/6BB427AB9696C225CA2574180004463E"}]) @@ -338,7 +338,7 @@ expect(subject.descriptions.first["description"]).to start_with("The dataset contains a sample of metadata describing papers") expect(subject.dates).to eq([{"date"=>"2013-04-03", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Zenodo") + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.funding_references).to eq([{"awardNumber"=>"246686", "awardTitle"=>"Open Access Infrastructure for Research in Europe", "awardUri"=>"info:eu-repo/grantAgreement/EC/FP7/246686/", @@ -382,7 +382,7 @@ expect(subject.descriptions.first["description"]).to start_with("The dataset contains a sample of metadata describing papers") expect(subject.dates).to eq([{"date"=>"2013-04-03", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Zenodo") + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.funding_references).to eq([{"awardNumber"=>"246686", "awardTitle"=>"Open Access Infrastructure for Research in Europe", "awardUri"=>"info:eu-repo/grantAgreement/EC/FP7/246686/", @@ -409,7 +409,7 @@ subject = Bolognese::Metadata.new(input: input) expect(subject.types["schemaOrg"]).to eq("Collection") expect(subject.language).to eq("de") - expect(subject.publisher).to eq("UniversitƤtsbibliothek TĆ¼bingen") + expect(subject.publisher).to eq({"name"=>"UniversitƤtsbibliothek TĆ¼bingen"}) expect(subject.publication_year).to eq("2015") expect(subject.valid?).to be false expect(subject.errors).to eq("13:0: ERROR: Element '{http://datacite.org/schema/kernel-2.2}publisher': This element is not expected. Expected is ( {http://datacite.org/schema/kernel-2.2}publicationYear ).") @@ -532,7 +532,7 @@ expect(subject.creators.length).to eq(1) expect(subject.creators.first).to eq("familyName"=>"Fenner", "givenName"=>"Martin", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name"=>"Fenner, Martin") expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}]) - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.publication_year).to eq("2016") expect(subject.related_identifiers).to eq([{"relatedIdentifier"=>"10.5438/0012", "relatedIdentifierType"=>"DOI", @@ -562,7 +562,7 @@ expect(subject.creators.length).to eq(3) expect(subject.creators.first).to eq("familyName"=>"Schumann", "givenName"=>"Kai", "name"=>"Schumann, Kai", "nameType"=>"Personal", "nameIdentifiers" => [], "affiliation" => []) expect(subject.titles).to eq([{"title"=>"Gridded results of swath bathymetric mapping of Disko Bay, Western Greenland, 2007-2008"}]) - expect(subject.publisher).to eq("PANGAEA - Data Publisher for Earth & Environmental Science") + expect(subject.publisher).to eq({"name"=>"PANGAEA - Data Publisher for Earth & Environmental Science"}) expect(subject.publication_year).to eq("2011") expect(subject.related_identifiers).to eq([{"relatedIdentifier"=>"10.5072/timeseries", "relatedIdentifierType"=>"DOI", "relationType"=>"Continues"}]) expect(subject.geo_locations).to eq([{"geoLocationPlace"=>"Disko Bay", "geoLocationPoint"=>{"pointLatitude"=>"69.000000", "pointLongitude"=>"-52.000000"}}]) @@ -579,7 +579,7 @@ expect(subject.creators.length).to eq(6) expect(subject.creators.first).to eq("familyName"=>"Bales", "givenName"=>"Roger", "name"=>"Bales, Roger", "nameType"=>"Personal", "affiliation" => [{"name"=>"UC Merced"}, {"name"=>"NSF"}], "nameIdentifiers" => []) expect(subject.titles).to eq([{"title"=>"Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature"}]) - expect(subject.publisher).to eq("UC Merced") + expect(subject.publisher).to eq({"name"=>"UC Merced"}) expect(subject.dates).to eq([{"date"=>"2014-10-17", "dateType"=>"Updated"}, {"date"=>"2016-03-14T17:02:02Z", "dateType"=>"Available"}, {"date"=>"2013", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2013") expect(subject.subjects).to eq([{"subject"=>"Earth sciences"}, @@ -659,7 +659,7 @@ expect(subject.titles).to eq([{"title"=>"Dataset for \"Direct Evidence for Solid-Like Hydrogen in a Nanoporous Carbon Hydrogen Storage Material at Supercritical Temperatures\""}]) expect(subject.descriptions.first["description"]).to start_with("Dataset for Direct Evidence for Solid-Like Hydrogen") expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("University of Bath") + expect(subject.publisher).to eq({"name"=>"University of Bath"}) expect(subject.funding_references.length).to eq(5) expect(subject.funding_references.first).to eq("awardNumber" => "EP/J016454/1", "awardTitle" => "SUPERGEN Hub Funding", @@ -693,7 +693,7 @@ expect(subject.titles).to eq([{"title"=>"Technical and Human Infrastructure for Open Research (THOR)"}]) expect(subject.descriptions.first["description"]).to start_with("Five years ago, a global infrastructure") expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.funding_references).to eq([{"awardNumber"=>"654039", "awardTitle"=>"THOR ā€“ Technical and Human Infrastructure for Open Research", "awardUri"=>"http://cordis.europa.eu/project/rcn/194927_en.html", @@ -717,7 +717,7 @@ expect(subject.titles).to eq([{"title"=>"ŠœŠžŠ”Š•Š›Š¬ Š”Š˜Š”Š¢Š•ŠœŠŠžŠ™ Š”Š˜ŠŠŠœŠ˜ŠšŠ˜ ŠŸŠ ŠžŠ¦Š•Š”Š”Š ŠžŠ‘Š£Š§Š•ŠŠ˜ŠÆ"}, {"title"=>"MODEL OF SYSTEM DYNAMICS OF PROCESS OF TRAINING", "titleType"=>"TranslatedTitle"}]) expect(subject.descriptions.first["description"]).to start_with("ŠŠŗтуŠ°Š»ŃŒŠ½Š¾ŃŃ‚ŃŒ Š“Š°Š½Š½Š¾Š¹ рŠ°Š±Š¾Ń‚Ń‹ Š¾Š±ŃƒŃŠ»Š¾Š²Š»ŠµŠ½Š° Š²Š°Š¶Š½Š¾ŃŃ‚ŃŒŃŽ учŠµŃ‚Š° Š² учŠµŠ±Š½Š¾Š¼ ŠæрŠ¾Ń†ŠµŃŃŠµ Š»ŠøчŠ½Š¾ŃŃ‚Š½Ń‹Ń… ŠŗŠ°Ń‡ŠµŃŃ‚Š² Š¾Š±ŃƒŃ‡Š°ŠµŠ¼") expect(subject.publication_year).to eq("2019") - expect(subject.publisher).to eq("ŠœŠžŠ”Š•Š›Š˜Š ŠžŠ’ŠŠŠ˜Š•, ŠžŠŸŠ¢Š˜ŠœŠ˜Š—ŠŠ¦Š˜ŠÆ Š˜ Š˜ŠŠ¤ŠžŠ ŠœŠŠ¦Š˜ŠžŠŠŠ«Š• Š¢Š•Š„ŠŠžŠ›ŠžŠ“Š˜Š˜") + expect(subject.publisher).to eq({"name"=>"ŠœŠžŠ”Š•Š›Š˜Š ŠžŠ’ŠŠŠ˜Š•, ŠžŠŸŠ¢Š˜ŠœŠ˜Š—ŠŠ¦Š˜ŠÆ Š˜ Š˜ŠŠ¤ŠžŠ ŠœŠŠ¦Š˜ŠžŠŠŠ«Š• Š¢Š•Š„ŠŠžŠ›ŠžŠ“Š˜Š˜"}) expect(subject.funding_references.length).to eq(1) expect(subject.funding_references.first).to eq("awardNumber"=>"ŠæрŠ¾ŠµŠŗт ā„– 170100728", "funderName"=>"Š Š¤Š¤Š˜") expect(subject.agency).to eq("datacite") @@ -770,7 +770,7 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/licenses/by-nd/2.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) - expect(subject.publisher).to eq("Springer") + expect(subject.publisher).to eq({"name"=>"Springer"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -800,7 +800,7 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/licenses/by-nd/2.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) - expect(subject.publisher).to eq("Springer") + expect(subject.publisher).to eq({"name"=>"Springer"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4.0") end @@ -829,7 +829,7 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/publicdomain/zero/1.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) - expect(subject.publisher).to eq("Dryad Digital Repository") + expect(subject.publisher).to eq({"name"=>"Dryad Digital Repository"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3") end @@ -859,7 +859,7 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/licenses/by-nd/2.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) - expect(subject.publisher).to eq("Springer") + expect(subject.publisher).to eq({"name"=>"Springer"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3.0") end @@ -883,7 +883,7 @@ expect(subject.publication_year).to eq("2010") expect(subject.related_identifiers.length).to eq(1) expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5272/oldertestpub", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf") - expect(subject.publisher).to eq("Springer") + expect(subject.publisher).to eq({"name"=>"Springer"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.2") end @@ -917,7 +917,7 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/licenses/by-nd/2.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) - expect(subject.publisher).to eq("Springer") + expect(subject.publisher).to eq({"name"=>"Springer"}) expect(subject.agency).to eq("datacite") end @@ -934,7 +934,7 @@ expect(subject.titles).to eq([{"title"=>"LAMMPS Data-File Generator"}]) expect(subject.dates).to eq([{"date"=>"2018-07-18", "dateType"=>"Valid"}, {"date"=>"2018-07-18", "dateType"=>"Accepted"}, {"date"=>"2018", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("nanoHUB") + expect(subject.publisher).to eq({"name"=>"nanoHUB"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.2") end @@ -966,7 +966,7 @@ expect(subject.creators).to eq([{"familyName"=>"Wong", "givenName"=>"Takmeng", "name"=>"Wong, Takmeng"}]) expect(subject.titles).to eq([{"title"=>"CERES Level 3 Cloud Type Historgram Terra+Aqua HDF file - Edition4"}]) expect(subject.publication_year).to eq("2016") - expect(subject.publisher).to eq("NASA Langley Atmospheric Science Data Center DAAC") + expect(subject.publisher).to eq({"name"=>"NASA Langley Atmospheric Science Data Center DAAC"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -1007,7 +1007,7 @@ "subjectScheme"=>"CESSDA Topic Classification"}]) expect(subject.dates).to eq([{"date"=>"1995-12", "dateType"=>"Collected"}, {"date"=>"1996", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("1996") - expect(subject.publisher).to eq("GESIS Data Archive") + expect(subject.publisher).to eq({"name"=>"GESIS Data Archive"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -1029,7 +1029,7 @@ expect(subject.container).to eq("firstPage"=>"Spain; 3353", "lastPage"=>"3356", "title"=>"23rd European Photovoltaic Solar Energy Conference and Exhibition", "type"=>"Series", "volume"=>"1-5 September 2008") expect(subject.descriptions[1]["description"]).to start_with("Aim of this paper is the presentation") expect(subject.subjects).to eq([{"subject"=>"PV Systems"}, {"subject"=>"Off-grid Applications"}]) - expect(subject.publisher).to eq("WIP-Munich") + expect(subject.publisher).to eq({"name"=>"WIP-Munich"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-2.2") end @@ -1060,7 +1060,7 @@ expect(subject.titles).to eq([{"title"=>"Messung der Bildunschaerfe in H.264-codierten Bildern und Videosequenzen"}]) expect(subject.dates).to eq([{"date"=>"2017", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("Siemens AG") + expect(subject.publisher).to eq({"name"=>"Siemens AG"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3") end @@ -1100,7 +1100,7 @@ expect(subject.version_info).to eq("2") expect(subject.dates).to eq([{"date"=>"2014-04-25", "dateType"=>"Available"}, {"date"=>"2015", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("Royal Netherlands Meteorological Institute (KNMI)") + expect(subject.publisher).to eq({"name"=>"Royal Netherlands Meteorological Institute (KNMI)"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -1126,7 +1126,7 @@ expect(subject.titles).to eq([{"title"=>"Test license"}]) expect(subject.dates).to eq([{"date"=>"2018-01-12", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("CaltechDATA") + expect(subject.publisher).to eq({"name"=>"CaltechDATA"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") expect(subject.state).to eq("findable") @@ -1143,7 +1143,7 @@ expect(subject.titles).to eq([{"title"=>"Referee report. For: FL Regression Wellcome [version 1; referees: retracted]"}]) expect(subject.dates).to eq([{"date"=>"2018", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("F1000 Research Limited") + expect(subject.publisher).to eq({"name"=>"F1000 Research Limited"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3") expect(subject.state).to eq("findable") @@ -1162,7 +1162,7 @@ expect(subject.creators.first).to eq("nameType"=>"Personal", "name"=>"Patel, Lina", "givenName"=>"Lina", "familyName"=>"Patel", "nameIdentifiers" => [], "affiliation" => []) expect(subject.titles).to eq([{"title"=>"Referee report. For: Gates - add article keywords to the metatags [version 2; referees: 1 approved]"}]) expect(subject.publication_year).to eq("2018") - expect(subject.publisher).to eq("Gates Open Research") + expect(subject.publisher).to eq({"name"=>"Gates Open Research"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3") end @@ -1255,7 +1255,7 @@ {"date"=>"2014", "dateType"=>"Copyrighted"}, {"date"=>"2009-10-01/2014-01-23", "dateType"=>"Created"}]) expect(subject.publication_year).to eq("2014") - expect(subject.publisher).to eq("Deutsches Elektronen-Synchrotron, DESY, Hamburg") + expect(subject.publisher).to eq({"name"=>"Deutsches Elektronen-Synchrotron, DESY, Hamburg"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-3") end @@ -1280,7 +1280,7 @@ expect(subject.titles.last).to eq("title"=>"MODEL OF SYSTEM DYNAMICS OF PROCESS OF TRAINING", "titleType"=>"TranslatedTitle") expect(subject.dates).to eq([{"date"=>"2019-02-09", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2019") - expect(subject.publisher).to eq("ŠœŠžŠ”Š•Š›Š˜Š ŠžŠ’ŠŠŠ˜Š•, ŠžŠŸŠ¢Š˜ŠœŠ˜Š—ŠŠ¦Š˜ŠÆ Š˜ Š˜ŠŠ¤ŠžŠ ŠœŠŠ¦Š˜ŠžŠŠŠ«Š• Š¢Š•Š„ŠŠžŠ›ŠžŠ“Š˜Š˜") + expect(subject.publisher).to eq({"name"=>"ŠœŠžŠ”Š•Š›Š˜Š ŠžŠ’ŠŠŠ˜Š•, ŠžŠŸŠ¢Š˜ŠœŠ˜Š—ŠŠ¦Š˜ŠÆ Š˜ Š˜ŠŠ¤ŠžŠ ŠœŠŠ¦Š˜ŠžŠŠŠ«Š• Š¢Š•Š„ŠŠžŠ›ŠžŠ“Š˜Š˜"}) expect(subject.funding_references.count).to eq(1) expect(subject.funding_references.first).to eq("awardNumber"=>"ŠæрŠ¾ŠµŠŗт ā„– 170100728", "funderName"=>"Š Š¤Š¤Š˜") expect(subject.agency).to eq("datacite") @@ -1335,7 +1335,7 @@ expect(subject.doi).to eq("10.5061/dryad.8515") expect(subject.creators).to eq([{"nameIdentifiers"=> [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name"=>"Fenner, Martin", "givenName"=>"Martin", "familyName"=>"Fenner"}]) expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}]) - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.publication_year).to eq("2016") end end @@ -1362,7 +1362,7 @@ expect(subject.formats).to eq(["application/tar"]) expect(subject.sizes).to eq(["15.7M"]) expect(subject.container).to eq("identifier"=>"https://www.ebi.ac.uk/miriam/main/datatypes/MIR:00000663", "identifierType"=>"URL", "title"=>"GTEx", "type"=>"DataRepository") - expect(subject.publisher).to eq("GTEx") + expect(subject.publisher).to eq({"name"=>"GTEx"}) expect(subject.funding_references.count).to eq(7) expect(subject.funding_references.first).to eq("funderIdentifier"=>"https://doi.org/10.13039/100000052", "funderIdentifierType"=>"Crossref Funder ID", "funderName"=>"Common Fund of the Office of the Director of the NIH") end @@ -1379,7 +1379,7 @@ expect(subject.creators.first).to eq("familyName"=>"Den Heijer", "givenName"=>"C", "name"=>"Den Heijer, C", "nameType"=>"Personal", "nameIdentifiers" => [], "affiliation" => []) expect(subject.titles).to eq([{"lang"=>"en", "title"=>"Meteo measurements at the Sand Motor"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("4TU.Centre for Research Data") + expect(subject.publisher).to eq({"name"=>"4TU.Centre for Research Data"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") expect(subject.geo_locations.first["geoLocationPlace"]).to eq("Zandmotor, sand suppletion area on the Dutch coast.") @@ -1445,7 +1445,7 @@ "schemeUri"=>"https://spdx.org/licenses/" } ]) - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") expect(subject.related_items.last).to eq( @@ -1683,7 +1683,7 @@ "schemeUri"=>"https://spdx.org/licenses/" } ]) - expect(subject.publisher).to eq("GigaScience Database") + expect(subject.publisher).to eq({"name"=>"GigaScience Database"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -1728,4 +1728,19 @@ ) end + describe "Schema 4.5" do + it "publisher with attributes" do + input = fixture_path + "datacite-example-full-v4.5.xml" + subject = Bolognese::Metadata.new(input: input) + expect(subject.valid?).to be true + expect(subject.publisher).to eq( + { + "name" => "Example Publisher", + "publisherIdentifier" => "https://ror.org/04z8jg394", + "publisherIdentifierScheme" => "ROR", + "schemeUri" => "https://ror.org/", + } + ) + end + end end diff --git a/spec/readers/npm_reader_spec.rb b/spec/readers/npm_reader_spec.rb index f26b8766..6cff3c8f 100644 --- a/spec/readers/npm_reader_spec.rb +++ b/spec/readers/npm_reader_spec.rb @@ -38,6 +38,7 @@ #expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "reourceType"=>"NPM Package", "resourceTypeGeneral"=>"Software", "ris"=>"GEN", "schemaOrg"=>"SoftwareSourceCode") expect(subject.creators).to eq([{"name"=>":(unav)", "nameType"=>"Organizational"}]) + expect(subject.publisher).to eq(nil) expect(subject.titles).to eq([{"title"=>"CITapp"}]) expect(subject.descriptions).to eq([{"description"=>"Concealed Information Test app", "descriptionType"=>"Abstract"}]) expect(subject.version_info).to eq("1.1.0") @@ -54,6 +55,7 @@ #expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food") expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "reourceType"=>"NPM Package", "resourceTypeGeneral"=>"Software", "ris"=>"GEN", "schemaOrg"=>"SoftwareSourceCode") expect(subject.creators).to eq([{"affiliation"=>[], "familyName"=>"Brancotte", "givenName"=>"Bryan", "name"=>"Brancotte, Bryan", "nameIdentifiers"=>[], "nameType"=>"Personal"}]) + expect(subject.publisher).to eq(nil) expect(subject.titles).to eq([{"title"=>"edam-browser"}]) expect(subject.descriptions).to eq([{"description"=> + "The EDAM Browser is a client-side web-based visualization javascript widget. Its goals are to help describing bio-related resources and service with EDAM, and to facilitate and foster community contributions to EDAM.", diff --git a/spec/readers/ris_reader_spec.rb b/spec/readers/ris_reader_spec.rb index 6dd24f8d..dd0e10be 100644 --- a/spec/readers/ris_reader_spec.rb +++ b/spec/readers/ris_reader_spec.rb @@ -38,6 +38,7 @@ "familyName"=>"Sankar", "nameIdentifiers" => [], "affiliation" => []) + expect(subject.publisher).to eq({"name"=>"(:unav)"}) expect(subject.titles).to eq([{"title"=>"Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth"}]) expect(subject.descriptions.first["description"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.") expect(subject.dates).to eq([{"date"=>"2014", "dateType"=>"Issued"}]) @@ -55,6 +56,7 @@ expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") expect(subject.types).to eq("citeproc"=>"misc", "resourceTypeGeneral"=>"Dissertation", "ris"=>"THES", "schemaOrg"=>"Thesis") expect(subject.creators).to eq([{"nameType"=>"Personal", "name"=>"Toparlar, Y.", "givenName"=>"Y.", "familyName"=>"Toparlar", "nameIdentifiers" => [], "affiliation" => []}]) + expect(subject.publisher).to eq({"name"=>"Technische Universiteit Eindhoven"}) expect(subject.titles).to eq([{"title"=>"A multiscale analysis of the urban heat island effect"}]) expect(subject.descriptions.first["description"]).to start_with("Designing the climates of cities") expect(subject.dates).to eq([{"date"=>"2018-04-25", "dateType"=>"Issued"}, {"date"=>"2018-04-25", "dateType"=>"Created"}]) @@ -68,6 +70,7 @@ subject = Bolognese::Metadata.new(input: input, doi: doi) expect(subject.valid?).to be true expect(subject.id).to eq("https://doi.org/10.7554/elife.01567") + expect(subject.publisher).to eq({"name"=>"Drexel University"}) expect(subject.titles).to eq([{"title"=>"Validation of an Image-based Subject-Specific Dynamic Model of the Ankle Joint Complex and its Applications to the Study of the Effect of Articular Surface Morphology on Ankle Joint Mechanics"}]) expect(subject.descriptions.first["description"]).to eq(abs) end diff --git a/spec/readers/schema_org_reader_spec.rb b/spec/readers/schema_org_reader_spec.rb index 4e60c839..f4fdce9c 100644 --- a/spec/readers/schema_org_reader_spec.rb +++ b/spec/readers/schema_org_reader_spec.rb @@ -31,7 +31,7 @@ expect(subject.publication_year).to eq("2016") expect(subject.related_identifiers.length).to eq(3) expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) end it "BlogPosting with new DOI" do @@ -59,7 +59,7 @@ expect(subject.publication_year).to eq("2016") expect(subject.related_identifiers.length).to eq(3) expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) end it "zenodo" do @@ -104,7 +104,7 @@ expect(subject.titles).to eq([{"title"=>"Hydrological and meteorological investigations in a lake near Kangerlussuaq, west Greenland"}]) expect(subject.creators.size).to eq(8) expect(subject.creators.first).to eq("nameType" => "Personal", "name"=>"Johansson, Emma", "givenName"=>"Emma", "familyName"=>"Johansson") - expect(subject.publisher).to eq("PANGAEA") + expect(subject.publisher).to eq({"name"=>"PANGAEA"}) expect(subject.publication_year).to eq("2014") end @@ -169,7 +169,7 @@ expect(subject.publication_year).to eq("2016") expect(subject.related_identifiers.length).to eq(3) expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References") - expect(subject.publisher).to eq("DataCite") + expect(subject.publisher).to eq({"name"=>"DataCite"}) end it "GTEx dataset" do @@ -189,7 +189,7 @@ expect(subject.dates).to eq([{"date"=>"2017", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2017") expect(subject.container).to eq("title"=>"GTEx", "type"=>"DataRepository") - expect(subject.publisher).to eq("GTEx") + expect(subject.publisher).to eq({"name"=>"GTEx"}) expect(subject.funding_references.length).to eq(7) expect(subject.funding_references.first).to eq("funderIdentifier"=>"https://doi.org/10.13039/100000052", "funderIdentifierType"=>"Crossref Funder ID", "funderName"=>"Common Fund of the Office of the Director of the NIH") end @@ -209,7 +209,7 @@ expect(subject.subjects).to eq([{"subject"=>"topmed"}, {"subject"=>"whole genome sequencing"}]) expect(subject.dates).to eq([{"date"=>"2017-11-30", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("TOPMed") + expect(subject.publisher).to eq({"name"=>"TOPMed"}) expect(subject.related_identifiers).to eq([{"relatedIdentifier"=>"10.23725/2g4s-qv04", "relatedIdentifierType"=>"DOI", "relationType"=>"References", "resourceTypeGeneral"=>"Dataset"}]) expect(subject.funding_references).to eq([{"funderIdentifier"=>"https://doi.org/10.13039/100000050", "funderIdentifierType"=>"Crossref Funder ID", "funderName"=>"National Heart, Lung, and Blood Institute (NHLBI)"}]) end @@ -240,7 +240,7 @@ {"subject"=>"Sierra (mountain range)"}]) expect(subject.dates).to eq([{"date"=>"2013", "dateType"=>"Issued"}, {"date"=>"2014-10-17", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("UC Merced") + expect(subject.publisher).to eq({"name"=>"UC Merced"}) expect(subject.funding_references).to eq([{"funderName"=>"National Science Foundation, Division of Earth Sciences, Critical Zone Observatories"}]) expect(subject.geo_locations).to eq([{"geoLocationPlace"=>"Providence Creek (Lower, Upper and P301)", "geoLocationPoint"=>{"pointLatitude"=>"37.047756", "pointLongitude"=>"-119.221094"}}]) end @@ -258,7 +258,7 @@ expect(subject.titles).to eq([{"title"=>"Registry of all stations from the Tara Oceans Expedition (2009-2013)"}]) expect(subject.dates).to eq([{"date"=>"2015-02-03", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2015") - expect(subject.publisher).to eq("PANGAEA") + expect(subject.publisher).to eq({"name"=>"PANGAEA"}) expect(subject.geo_locations).to eq([{"geoLocationBox"=>{"eastBoundLongitude"=>"174.9006", "northBoundLatitude"=>"79.6753", "southBoundLatitude"=>"-64.3088", "westBoundLongitude"=>"-168.5182"}}]) end @@ -280,7 +280,7 @@ expect(subject.subjects).to eq([{"subject"=>"topmed"}, {"subject"=>"whole genome sequencing"}]) expect(subject.dates).to eq([{"date"=>"2017-11-30", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("TOPMed") + expect(subject.publisher).to eq({"name"=>"TOPMed"}) expect(subject.funding_references).to eq([{"funderIdentifier"=>"https://doi.org/10.13039/100000050", "funderIdentifierType"=>"Crossref Funder ID", "funderName"=>"National Heart, Lung, and Blood Institute (NHLBI)"}]) end @@ -299,7 +299,7 @@ expect(subject.dates).to eq([{"date"=>"2019-01-09", "dateType"=>"Issued"}, {"date"=>"2019-01-09", "dateType"=>"Created"}, {"date"=>"2019-01-09", "dateType"=>"Updated"}]) expect(subject.publication_year).to eq("2019") expect(subject.id).to eq("https://doi.org/10.23698/aida/drov") - expect(subject.publisher).to eq("AIDA") + expect(subject.publisher).to eq({"name"=>"AIDA"}) expect(subject.rights_list).to eq([{"rights"=>"Restricted access", "rightsUri"=>"https://datasets.aida.medtech4health.se/10.23698/aida/drov#license"}]) expect(subject.id).to eq("https://doi.org/10.23698/aida/drov") end @@ -332,7 +332,7 @@ expect(subject.descriptions.first["description"]).to start_with("The dataset contains a sample of metadata describing papers") expect(subject.dates).to eq([{"date"=>"2013-04-03", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("Zenodo") + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.funding_references).to eq([{"awardNumber"=>"246686", "awardTitle"=>"Open Access Infrastructure for Research in Europe", "awardUri"=>"info:eu-repo/grantAgreement/EC/FP7/246686/", diff --git a/spec/writers/crosscite_writer_spec.rb b/spec/writers/crosscite_writer_spec.rb index 66a35ca8..b502168e 100644 --- a/spec/writers/crosscite_writer_spec.rb +++ b/spec/writers/crosscite_writer_spec.rb @@ -46,6 +46,7 @@ expect(crosscite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.") expect(crosscite.fetch("creators").count).to eq(5) expect(crosscite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar") + expect(crosscite.fetch("publisher")).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."}) end it "BlogPosting Citeproc JSON" do @@ -57,6 +58,7 @@ expect(crosscite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) expect(crosscite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food") expect(crosscite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}]) + expect(crosscite.fetch("publisher")).to eq({"name"=>"DataCite"}) end it "rdataone" do @@ -67,6 +69,7 @@ expect(crosscite["creators"].length).to eq(3) expect(crosscite["creators"].last).to eq("nameType" => "Organizational", "name"=>"University Of California, Santa Barbara", "nameIdentifiers" => [], "affiliation" => []) expect(crosscite["version"]).to eq("2.0.0") + expect(crosscite["publisher"]).to eq({"name"=>"https://cran.r-project.org"}) end it "rdataone codemeta v2" do @@ -77,6 +80,7 @@ expect(crosscite["creators"].length).to eq(3) expect(crosscite["creators"].last).to eq("nameType" => "Organizational", "name"=>"University Of California, Santa Barbara", "nameIdentifiers" => [], "affiliation" => []) expect(crosscite["version"]).to eq("2.0.0") + expect(crosscite["publisher"]).to eq({"name"=>"https://cran.r-project.org"}) end it "datacite database attributes" do @@ -91,6 +95,7 @@ expect(crosscite.fetch("publication_year")).to eq("2011") expect(crosscite.fetch("provider_id")).to eq("dryad") expect(crosscite.fetch("client_id")).to eq("dryad.dryad") + expect(crosscite.fetch("publisher")).to eq({"name"=>"Dryad"}) end it "maremma" do @@ -106,6 +111,7 @@ [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "nameType"=>"Personal"}]) + expect(crosscite.fetch("publisher")).to eq({"name"=>"DataCite"}) end it "with data citation schema.org" do @@ -117,6 +123,7 @@ expect(crosscite.fetch("related_identifiers").count).to eq(3) expect(crosscite.fetch("related_identifiers").first).to eq("relatedIdentifier"=>"10.5438/0000-00ss", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Text") expect(crosscite.fetch("related_identifiers").last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References") + expect(crosscite.fetch("publisher")).to eq({"name"=>"DataCite"}) end end end diff --git a/spec/writers/datacite_json_writer_spec.rb b/spec/writers/datacite_json_writer_spec.rb index 69ef0c9a..e64f8f5b 100644 --- a/spec/writers/datacite_json_writer_spec.rb +++ b/spec/writers/datacite_json_writer_spec.rb @@ -18,6 +18,7 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/licenses/by/3.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) + expect(datacite.fetch("publisher")).to eq({"name"=>"eLife Sciences Publications, Ltd"}) end it "with ORCID ID" do @@ -28,6 +29,7 @@ expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") expect(datacite.fetch("creators").length).to eq(7) expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi", "affiliation" => [{"name"=>"Department of Medicine, Veterans Affairs Palo Alto Health Care System, 3801 Miranda Avenue MC-, Palo Alto, CA 94304-1207, USA"}, {"name"=>"Occupational Health Strategic Health Care Group, Office of Public Health, Veterans Health Administration, Washington, DC 20006, USA"}, {"name"=>"Division of Emergency Medicine, Stanford University School of Medicine, Stanford, CA 94304, USA"}, {"name"=>"War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA"}]) + expect(datacite.fetch("publisher")).to eq({"name"=>"Hindawi Limited"}) end it "Crossref DOI" do @@ -39,6 +41,7 @@ expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.") expect(datacite.fetch("creators").length).to eq(5) expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar") + expect(datacite.fetch("publisher")).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."}) end it "BlogPosting Citeproc JSON" do @@ -49,6 +52,7 @@ expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) expect(datacite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food") expect(datacite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}]) + expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) end it "rdataone" do @@ -60,6 +64,7 @@ expect(datacite.fetch("creators").first).to eq("affiliation"=>[{"name"=>"NCEAS"}], "nameType"=>"Personal", "name" => "Jones, Matt", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "givenName"=>"Matt", "familyName"=>"Jones") expect(datacite.fetch("version")).to eq("2.0.0") + expect(datacite.fetch("publisher")).to eq({"name"=>"https://cran.r-project.org"}) end it "maremma" do @@ -75,6 +80,7 @@ [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "nameType"=>"Personal"}]) + expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) end it "with data citation schema.org" do @@ -85,6 +91,21 @@ expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) expect(datacite.fetch("relatedIdentifiers").count).to eq(3) expect(datacite.fetch("relatedIdentifiers").first).to eq("relatedIdentifier"=>"10.5438/0000-00ss", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Text") + expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + end + + it "DataCite DOI with Schema 4. publisher attributes" do + input = fixture_path + "datacite-example-full-v4.5.xml" + subject = Bolognese::Metadata.new(input: input, from: "datacite") + datacite = JSON.parse(subject.datacite_json) + expect(datacite.fetch("publisher")).to eq( + { + "name" => "Example Publisher", + "publisherIdentifier" => "https://ror.org/04z8jg394", + "publisherIdentifierScheme" => "ROR", + "schemeUri" => "https://ror.org/", + }, + ) end end end diff --git a/spec/writers/datacite_writer_spec.rb b/spec/writers/datacite_writer_spec.rb index b14494b2..8cf2f245 100644 --- a/spec/writers/datacite_writer_spec.rb +++ b/spec/writers/datacite_writer_spec.rb @@ -17,6 +17,7 @@ expect(datacite.dig("rightsList", "rights")).to eq("rightsURI"=>"https://creativecommons.org/licenses/by/3.0/legalcode", "rightsIdentifier"=>"cc-by-3.0", "rightsIdentifierScheme"=>"SPDX", "schemeURI"=>"https://spdx.org/licenses/", "__content__"=>"Creative Commons Attribution 3.0 Unported") expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4) expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier" => {"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"}) + expect(datacite.dig("publisher")).to eq("eLife Sciences Publications, Ltd") end it "with ORCID ID" do @@ -31,6 +32,7 @@ "givenName" => "Beatriz", "affiliation" => ["War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA", "Department of Psychiatry and Behavioral Sciences, Stanford University School of Medicine, Stanford, CA 94304, USA"], "nameIdentifier" => {"nameIdentifierScheme"=>"ORCID", "schemeURI"=>"https://orcid.org", "__content__"=>"https://orcid.org/0000-0003-2043-4925"}) + expect(datacite.dig("publisher")).to eq("Hindawi Limited") end it "with editor" do @@ -39,6 +41,7 @@ expect(subject.valid?).to be true datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("contributors", "contributor")).to eq("contributorName"=>{"__content__"=>"Janbon, Guilhem", "nameType"=>"Personal"}, "contributorType"=>"Editor", "familyName"=>"Janbon", "givenName"=>"Guilhem") + expect(datacite.dig("publisher")).to eq("Public Library of Science (PLoS)") end it "Crossref DOI" do @@ -52,6 +55,7 @@ expect(datacite.dig("descriptions", "description", 1, "__content__")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.") expect(datacite.dig("creators", "creator").count).to eq(5) expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>{"__content__"=>"Sankar, Martial", "nameType"=>"Personal"}, "familyName"=>"Sankar", "givenName"=>"Martial") + expect(datacite.dig("publisher")).to eq("{eLife} Sciences Organisation, Ltd.") end it "BlogPosting Citeproc JSON" do @@ -64,6 +68,7 @@ expect(datacite.dig("descriptions", "description").first).to eq("__content__"=>"DataCite Blog", "descriptionType"=>"SeriesInformation") expect(datacite.dig("descriptions", "description", 1, "__content__")).to start_with("Eating your own dog food") expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Fenner, Martin", "familyName"=>"Fenner", "givenName"=>"Martin") + expect(datacite.dig("publisher")).to eq("DataCite") end it "rdataone" do @@ -88,6 +93,7 @@ "__content__"=>"https://orcid.org/0000-0002-2192-403X"}}, {"creatorName"=>{"__content__"=>"University Of California, Santa Barbara", "nameType"=>"Organizational"}}]) expect(datacite.fetch("version")).to eq("2.0.0") + expect(datacite.dig("publisher")).to eq("https://cran.r-project.org") end it "rdataone and codemeta_v2" do @@ -112,6 +118,7 @@ "__content__"=>"https://orcid.org/0000-0002-2192-403X"}}, {"creatorName"=>{"__content__"=>"University Of California, Santa Barbara", "nameType"=>"Organizational"}}]) expect(datacite.fetch("version")).to eq("2.0.0") + expect(datacite.dig("publisher")).to eq("https://cran.r-project.org") end it "maremma" do @@ -121,6 +128,7 @@ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls") expect(datacite.dig("creators", "creator")).to eq("affiliation"=>"DataCite", "creatorName"=> {"__content__"=>"Fenner, Martin", "nameType"=>"Personal"}, "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"__content__"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeURI"=>"https://orcid.org"}) + expect(datacite.dig("publisher")).to eq("DataCite") end it "with version" do @@ -146,7 +154,7 @@ expect(subject.dates).to eq([{"date"=>"2015-08-19", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2015") expect(subject.version_info).to eq("v0.3.2") - expect(subject.publisher).to eq("Zenodo") + expect(subject.publisher).to eq({"name"=>"Zenodo"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") expect(subject.datacite).to include("v0.3.2") @@ -168,7 +176,7 @@ "schemeUri"=>"https://spdx.org/licenses/"}]) expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("Figshare") + expect(subject.publisher).to eq({"name"=>"Figshare"}) expect(subject.subjects).to eq([{"subject"=>"Information Systems"}, {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf", "subject"=>"FOS: Computer and information sciences", @@ -194,7 +202,7 @@ "schemeUri"=>"https://spdx.org/licenses/"}]) expect(subject.dates).to eq([{"date"=>"2017-06-28", "dateType"=>"Created"}, {"date"=>"2017-06-28", "dateType"=>"Updated"}, {"date"=>"2017", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("Figshare") + expect(subject.publisher).to eq({"name"=>"Figshare"}) expect(subject.subjects).to eq([{"subject"=>"Information Systems"}, {"schemeUri"=>"http://www.oecd.org/science/inno/38235147.pdf", "subject"=>"FOS: Computer and information sciences", @@ -223,12 +231,13 @@ expect(subject.related_identifiers.length).to eq(1) expect(subject.related_identifiers.last).to eq("relatedIdentifier" => "10.1371/journal.ppat.1000446", "relatedIdentifierType" => "DOI","relationType"=>"Cites") - expect(subject.publisher).to eq("Dryad") + expect(subject.publisher).to eq({"name"=>"Dryad"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4") + expect(datacite.dig("publisher")).to eq("Dryad") end it "Affiliation" do @@ -248,13 +257,82 @@ "schemeUri"=>"https://spdx.org/licenses/"}]) expect(subject.dates).to eq([{"date"=>"2014-10-17", "dateType"=>"Updated"}, {"date"=>"2016-03-14T17:02:02Z", "dateType"=>"Available"}, {"date"=>"2013", "dateType"=>"Issued"}]) expect(subject.publication_year).to eq("2013") - expect(subject.publisher).to eq("UC Merced") + expect(subject.publisher).to eq({"name"=>"UC Merced"}) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4") expect(datacite.dig("creators", "creator", 0, "affiliation")).to eq(["UC Merced", "NSF"]) + expect(datacite.dig("publisher")).to eq("UC Merced") + end + + it "Schema 4.5 publisher with attributes" do + input = fixture_path + 'datacite-example-full-v4.5.xml' + doi = "10.82433/B09Z-4K37" + subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true) + expect(subject.valid?).to be true + + datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) + expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4") + expect(datacite.dig("publisher")).to eq( + { + "__content__" => "Example Publisher", + "publisherIdentifier" => "https://ror.org/04z8jg394", + "publisherIdentifierScheme" => "ROR", + "schemeURI" => "https://ror.org/", + } + ) + end + + it "Geolocations" do + input = fixture_path + 'datacite-example-full-v4.5.xml' + doi = "10.82433/B09Z-4K37" + subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true) + expect(subject.valid?).to be true + + datacite = Maremma.from_xml(subject.datacite).fetch("resource", {}) + expect(datacite.dig("geoLocations", "geoLocation", "geoLocationPlace")).to eq("Vancouver, British Columbia, Canada") + expect(datacite.dig("geoLocations", "geoLocation", "geoLocationPoint")).to eq( + { + "pointLatitude" => "49.2827", + "pointLongitude" => "-123.1207", + } + ) + expect(datacite.dig("geoLocations", "geoLocation", "geoLocationBox")).to eq( + { + "westBoundLongitude" => "-123.27", + "eastBoundLongitude" => "-123.02", + "southBoundLatitude" => "49.195", + "northBoundLatitude" => "49.315", + } + ) + expect(datacite.dig("geoLocations", "geoLocation", "geoLocationPolygon")).to eq( + { + "polygonPoint" => [ + { + "pointLatitude" => "41.991", + "pointLongitude" => "-71.032", + }, + { + "pointLatitude" => "42.893", + "pointLongitude" => "-69.622", + }, + { + "pointLatitude" => "41.991", + "pointLongitude" => "-68.211", + }, + { + "pointLatitude" => "41.090", + "pointLongitude" => "-69.622", + }, + { + "pointLatitude" => "41.991", + "pointLongitude" => "-71.032", + }, + ] + } + ) end it "with data citation schema.org" do diff --git a/spec/writers/jats_writer_spec.rb b/spec/writers/jats_writer_spec.rb index 0a12f17c..f2ba24e5 100644 --- a/spec/writers/jats_writer_spec.rb +++ b/spec/writers/jats_writer_spec.rb @@ -11,6 +11,7 @@ expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") expect(jats.dig("source")).to eq("eLife") + expect(jats.dig("publisher_name")).to eq("eLife Sciences Publications, Ltd") expect(jats.dig("person_group", "name").length).to eq(5) expect(jats.dig("person_group", "name").first).to eq("surname"=>"Sankar", "given_names"=>"Martial") expect(jats.dig("year")).to eq("iso_8601_date"=>"2014-02-11", "__content__"=>"2014") @@ -25,6 +26,7 @@ expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers") expect(jats.dig("source")).to eq("Pulmonary Medicine") + expect(jats.dig("publisher_name")).to eq("Hindawi Limited") expect(jats.dig("person_group", "name").length).to eq(7) expect(jats.dig("person_group", "name").first).to eq("surname"=>"Thanassi", "given_names"=>"Wendy") expect(jats.dig("year")).to eq("iso_8601_date"=>"2012", "__content__"=>"2012") @@ -37,6 +39,7 @@ expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Triose Phosphate Isomerase Deficiency Is Caused by Altered Dimerization???Not Catalytic Inactivity???of the Mutant Enzymes") expect(jats.dig("source")).to eq("PLoS ONE") + expect(jats.dig("publisher_name")).to eq("Public Library of Science (PLoS)") expect(jats.dig("person_group", 0, "name").length).to eq(5) expect(jats.dig("person_group", 0, "name").first).to eq("surname"=>"Ralser", "given_names"=>"Markus") expect(jats.dig("person_group", 1, "name")).to eq("surname"=>"Janbon", "given_names"=>"Guilhem") @@ -54,6 +57,7 @@ expect(jats.dig("publication_type")).to eq("chapter") expect(jats.dig("chapter_title")).to eq("Physical Examinations") expect(jats.dig("source")).to eq("Jaypee Brothers Medical Publishing") + expect(jats.dig("publisher_name")).to eq("Jaypee Brothers Medical Publishing") expect(jats.dig("person_group", "name")).to eq("surname"=>"Saha", "given_names"=>"Ashis") expect(jats.dig("year")).to eq("iso_8601_date"=>"2015", "__content__"=>"2015") expect(jats.dig("fpage")).to eq("27") @@ -68,6 +72,7 @@ expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") expect(jats.dig("source")).to eq("eLife") + expect(jats.dig("publisher_name")).to eq("{eLife} Sciences Organisation, Ltd.") expect(jats.dig("person_group", "name").length).to eq(5) expect(jats.dig("person_group", "name").first).to eq("surname"=>"Sankar", "given_names"=>"Martial") expect(jats.dig("year")).to eq("iso_8601_date"=>"2014", "__content__"=>"2014") @@ -126,6 +131,7 @@ expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Recommendation of: ORCID Works Metadata Working Group") expect(jats.dig("source")).to eq("Figshare") + expect(jats.dig("publisher_name")).to eq("Figshare") expect(jats.dig("person_group", "name").length).to eq(20) expect(jats.dig("person_group", "name").first).to eq("surname"=>"Paglione", "given_names"=>"Laura") expect(jats.dig("year")).to eq("iso_8601_date"=>"2017", "__content__"=>"2017") @@ -139,6 +145,7 @@ expect(jats.dig("publication_type")).to eq("data") expect(jats.dig("data_title")).to eq("Data from: A new malaria agent in African hominids.") expect(jats.dig("source")).to eq("Dryad") + expect(jats.dig("publisher_name")).to eq(nil) expect(jats.dig("person_group", "name").length).to eq(8) expect(jats.dig("person_group", "name").first).to eq("surname"=>"Ollomo", "given_names"=>"Benjamin") expect(jats.dig("year")).to eq("iso_8601_date"=>"2011", "__content__"=>"2011") @@ -182,6 +189,7 @@ expect(jats.dig("publication_type")).to eq("journal") expect(jats.dig("article_title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") expect(jats.dig("source")).to eq("eLife") + expect(jats.dig("publisher_name")).to eq("eLife Sciences Publications, Ltd") expect(jats.dig("person_group", "name").length).to eq(5) expect(jats.dig("person_group", "name").first).to eq("surname"=>"Sankar", "given_names"=>"Martial") expect(jats.dig("year")).to eq("iso_8601_date"=>"2014-02-11", "__content__"=>"2014") diff --git a/spec/writers/rdf_xml_writer_spec.rb b/spec/writers/rdf_xml_writer_spec.rb index ae06c62c..7d6ab130 100644 --- a/spec/writers/rdf_xml_writer_spec.rb +++ b/spec/writers/rdf_xml_writer_spec.rb @@ -12,6 +12,7 @@ expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.7554/elife.01567") expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014-02-11") + expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("eLife Sciences Publications, Ltd") end it "with pages" do @@ -24,6 +25,7 @@ expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2012") expect(rdf_xml.dig("ScholarlyArticle", "pageStart")).to eq("1") expect(rdf_xml.dig("ScholarlyArticle", "pageEnd")).to eq("7") + expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("Hindawi Limited") end it "Crossref DOI" do @@ -36,6 +38,7 @@ expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth") expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014") expect(rdf_xml.dig("ScholarlyArticle", "periodical", "Journal", "name")).to eq("eLife") + expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("{eLife} Sciences Organisation, Ltd.") end it "BlogPosting" do @@ -47,6 +50,7 @@ expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Eating your own Dog Food") expect(rdf_xml.dig("ScholarlyArticle", "keywords")).to eq("datacite, doi, metadata, FOS: Computer and information sciences, FOS: Computer and information sciences") expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2016-12-20") + expect(rdf_xml.dig("ScholarlyArticle", "publisher", "Organization", "name")).to eq("DataCite") end it "BlogPosting Citeproc JSON" do @@ -56,6 +60,7 @@ expect(rdf_xml.dig("BlogPosting", "rdf:about")).to eq("https://doi.org/10.5438/4k3m-nyvg") expect(rdf_xml.dig("BlogPosting", "name")).to eq("Eating your own Dog Food") expect(rdf_xml.dig("BlogPosting", "datePublished", "__content__")).to eq("2016-12-20") + expect(rdf_xml.dig("BlogPosting", "publisher", "Organization", "name")).to eq("DataCite") end it "maremma" do @@ -68,6 +73,7 @@ expect(rdf_xml.dig("SoftwareSourceCode", "name")).to eq("Maremma: a Ruby library for simplified network calls") expect(rdf_xml.dig("SoftwareSourceCode", "keywords")).to eq("faraday, excon, net/http") expect(rdf_xml.dig("SoftwareSourceCode", "datePublished", "__content__")).to eq("2017-02-24") + expect(rdf_xml.dig("SoftwareSourceCode", "publisher", "Organization", "name")).to eq("DataCite") end it "BlogPosting schema.org" do @@ -81,6 +87,7 @@ expect(rdf_xml.dig("BlogPosting", "name")).to eq("Eating your own Dog Food") expect(rdf_xml.dig("BlogPosting", "keywords")).to eq("datacite, doi, metadata, featured") expect(rdf_xml.dig("BlogPosting", "datePublished", "__content__")).to eq("2016-12-20") + expect(rdf_xml.dig("BlogPosting", "publisher", "Organization", "name")).to eq("DataCite") end end end diff --git a/spec/writers/turtle_writer_spec.rb b/spec/writers/turtle_writer_spec.rb index d89b89ee..136d96ab 100644 --- a/spec/writers/turtle_writer_spec.rb +++ b/spec/writers/turtle_writer_spec.rb @@ -10,6 +10,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") + expect(ttl[46]).to eq(" schema:name \"{eLife} Sciences Organisation, Ltd.\"") end it "Dataset" do @@ -19,6 +20,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:Dataset;") + expect(ttl[65]).to eq(" schema:name \"Dryad\"") end it "BlogPosting" do @@ -28,6 +30,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") + expect(ttl[27]).to eq(" schema:name \"DataCite\"") end it "BlogPosting Citeproc JSON" do @@ -36,6 +39,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:BlogPosting;") + expect(ttl[18]).to eq(" schema:name \"DataCite\"") end it "BlogPosting DataCite JSON" do @@ -44,6 +48,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") + expect(ttl[28]).to eq(" schema:name \"DataCite\"") end it "BlogPosting schema.org" do @@ -53,6 +58,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:BlogPosting;") + expect(ttl[15]).to eq(" schema:name \"DataCite\"") end it "DataONE" do @@ -61,6 +67,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:SoftwareSourceCode;") + expect(ttl[17]).to eq(" schema:name \"https://cran.r-project.org\"") end it "journal article" do @@ -70,6 +77,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") + expect(ttl[111]).to eq(" schema:name \"eLife Sciences Publications, Ltd\"") end it "with pages" do @@ -79,6 +87,7 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") + expect(ttl[117]).to eq(" schema:name \"Hindawi Limited\"") end end end From 05a692152fe25363d8931ecbb9bdafc1d9bf5bc9 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:09:03 -0400 Subject: [PATCH 03/14] Adds support for reading/writing DC XML publisher xml:lang attribute --- lib/bolognese/datacite_utils.rb | 2 +- lib/bolognese/readers/datacite_reader.rb | 3 ++- spec/readers/datacite_reader_spec.rb | 22 +++++++++++++++++++--- spec/writers/datacite_json_writer_spec.rb | 3 ++- spec/writers/datacite_writer_spec.rb | 1 + 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/bolognese/datacite_utils.rb b/lib/bolognese/datacite_utils.rb index 9d832cf7..c000cb73 100644 --- a/lib/bolognese/datacite_utils.rb +++ b/lib/bolognese/datacite_utils.rb @@ -109,7 +109,7 @@ def insert_titles(xml) def insert_publisher(xml) if publisher.is_a?(Hash) - attributes = { 'publisherIdentifier' => publisher["publisherIdentifier"], 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"], 'schemeURI' => publisher["schemeUri"] }.compact + attributes = { 'publisherIdentifier' => publisher["publisherIdentifier"], 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"], 'schemeURI' => publisher["schemeUri"], "xml:lang" => publisher["lang"] }.compact xml.publisher(publisher["name"] || container && container["title"], attributes) else xml.publisher(publisher || container && container["title"]) diff --git a/lib/bolognese/readers/datacite_reader.rb b/lib/bolognese/readers/datacite_reader.rb index 52edbb36..c70a377e 100644 --- a/lib/bolognese/readers/datacite_reader.rb +++ b/lib/bolognese/readers/datacite_reader.rb @@ -100,11 +100,12 @@ def read_datacite(string: nil, **options) elsif r.is_a?(String) { "name" => r.strip } elsif r.is_a?(Hash) - { + { "name" => r["__content__"].strip, "publisherIdentifier" => r["publisherIdentifier"], "publisherIdentifierScheme" => r["publisherIdentifierScheme"], "schemeUri" => r["schemeURI"], + "lang" => r["lang"], }.compact end end.compact.first diff --git a/spec/readers/datacite_reader_spec.rb b/spec/readers/datacite_reader_spec.rb index 65b38cc9..f21828a9 100644 --- a/spec/readers/datacite_reader_spec.rb +++ b/spec/readers/datacite_reader_spec.rb @@ -149,7 +149,12 @@ expect(subject.language).to eq("en-US") expect(subject.sizes).to eq(["4 kB"]) expect(subject.formats).to eq(["application/xml"]) - expect(subject.publisher).to eq({"name"=>"DataCite"}) + expect(subject.publisher).to eq( + { + "name"=>"DataCite", + "lang"=>"en", + } + ) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -1445,7 +1450,12 @@ "schemeUri"=>"https://spdx.org/licenses/" } ]) - expect(subject.publisher).to eq({"name"=>"DataCite"}) + expect(subject.publisher).to eq( + { + "name"=>"DataCite", + "lang"=>"en", + } + ) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") expect(subject.related_items.last).to eq( @@ -1683,7 +1693,12 @@ "schemeUri"=>"https://spdx.org/licenses/" } ]) - expect(subject.publisher).to eq({"name"=>"GigaScience Database"}) + expect(subject.publisher).to eq( + { + "name"=>"GigaScience Database", + "lang"=>"en", + } + ) expect(subject.agency).to eq("datacite") expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4") end @@ -1739,6 +1754,7 @@ "publisherIdentifier" => "https://ror.org/04z8jg394", "publisherIdentifierScheme" => "ROR", "schemeUri" => "https://ror.org/", + "lang" => "en", } ) end diff --git a/spec/writers/datacite_json_writer_spec.rb b/spec/writers/datacite_json_writer_spec.rb index e64f8f5b..78332ffd 100644 --- a/spec/writers/datacite_json_writer_spec.rb +++ b/spec/writers/datacite_json_writer_spec.rb @@ -94,7 +94,7 @@ expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) end - it "DataCite DOI with Schema 4. publisher attributes" do + it "DataCite DOI with Schema 4.5 publisher attributes" do input = fixture_path + "datacite-example-full-v4.5.xml" subject = Bolognese::Metadata.new(input: input, from: "datacite") datacite = JSON.parse(subject.datacite_json) @@ -104,6 +104,7 @@ "publisherIdentifier" => "https://ror.org/04z8jg394", "publisherIdentifierScheme" => "ROR", "schemeUri" => "https://ror.org/", + "lang" => "en", }, ) end diff --git a/spec/writers/datacite_writer_spec.rb b/spec/writers/datacite_writer_spec.rb index 8cf2f245..d4a5a11e 100644 --- a/spec/writers/datacite_writer_spec.rb +++ b/spec/writers/datacite_writer_spec.rb @@ -281,6 +281,7 @@ "publisherIdentifier" => "https://ror.org/04z8jg394", "publisherIdentifierScheme" => "ROR", "schemeURI" => "https://ror.org/", + "xml:lang" => "en", } ) end From 51731cb38ef1a35eb58e72e99ff463f1d49201b2 Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Sat, 7 Oct 2023 23:54:29 -0400 Subject: [PATCH 04/14] Modify insert_publisher for publisher_obj. --- lib/bolognese/datacite_utils.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/bolognese/datacite_utils.rb b/lib/bolognese/datacite_utils.rb index c000cb73..38bea150 100644 --- a/lib/bolognese/datacite_utils.rb +++ b/lib/bolognese/datacite_utils.rb @@ -106,11 +106,11 @@ def insert_titles(xml) end end end - + def insert_publisher(xml) - if publisher.is_a?(Hash) - attributes = { 'publisherIdentifier' => publisher["publisherIdentifier"], 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"], 'schemeURI' => publisher["schemeUri"], "xml:lang" => publisher["lang"] }.compact - xml.publisher(publisher["name"] || container && container["title"], attributes) + if (publisher_obj && !publisher_obj.empty?) + attributes = { 'publisherIdentifier' => publisher_obj["publisherIdentifier"] || "", 'publisherIdentifierScheme' => publisher_obj["publisherIdentifierScheme"] || "", 'schemeURI' => publisher_obj["schemeUri"] || "", "xml:lang" => publisher_obj["lang"] || "" }.compact + xml.publisher(publisher_obj["name"], attributes) else xml.publisher(publisher || container && container["title"]) end From 4e5584329a66d801adc629da90a01e6fc990d36c Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Fri, 13 Oct 2023 14:53:11 -0400 Subject: [PATCH 05/14] Modify insert_publisher - remove reference to publisher_obj. --- lib/bolognese/datacite_utils.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/bolognese/datacite_utils.rb b/lib/bolognese/datacite_utils.rb index 38bea150..25ac5a3c 100644 --- a/lib/bolognese/datacite_utils.rb +++ b/lib/bolognese/datacite_utils.rb @@ -108,9 +108,14 @@ def insert_titles(xml) end def insert_publisher(xml) - if (publisher_obj && !publisher_obj.empty?) - attributes = { 'publisherIdentifier' => publisher_obj["publisherIdentifier"] || "", 'publisherIdentifierScheme' => publisher_obj["publisherIdentifierScheme"] || "", 'schemeURI' => publisher_obj["schemeUri"] || "", "xml:lang" => publisher_obj["lang"] || "" }.compact - xml.publisher(publisher_obj["name"], attributes) + if publisher.is_a?(Hash) + attributes = { + 'publisherIdentifier' => publisher["publisherIdentifier"] || nil, + 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"] || nil, + 'schemeURI' => publisher["schemeUri"] || nil, + "xml:lang" => publisher["lang"] || nil + }.compact + xml.publisher(publisher["name"] || container && container["title"], attributes) else xml.publisher(publisher || container && container["title"]) end From 1039b0c6a0cc9ea84b46a0d6161bb0bb6ff77a11 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Thu, 19 Oct 2023 09:59:11 -0400 Subject: [PATCH 06/14] Read codemeta publisher as hash --- lib/bolognese/readers/codemeta_reader.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bolognese/readers/codemeta_reader.rb b/lib/bolognese/readers/codemeta_reader.rb index 14345563..d3686cbd 100644 --- a/lib/bolognese/readers/codemeta_reader.rb +++ b/lib/bolognese/readers/codemeta_reader.rb @@ -43,7 +43,7 @@ def read_codemeta(string: nil, **options) dates << { "date" => meta.fetch("dateCreated"), "dateType" => "Created" } if meta.fetch("dateCreated", nil).present? dates << { "date" => meta.fetch("dateModified"), "dateType" => "Updated" } if meta.fetch("dateModified", nil).present? publication_year = meta.fetch("datePublished")[0..3] if meta.fetch("datePublished", nil).present? - publisher = meta.fetch("publisher", nil) + publisher = { "name" => meta.fetch("publisher", nil) } if meta.fetch("publisher", nil).present? state = meta.present? || read_options.present? ? "findable" : "not_found" schema_org = meta.fetch("@type", nil) types = { From 5ab5042b74872e5fe6f60c08750033a3e9cbf450 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:23:21 -0400 Subject: [PATCH 07/14] Adds ROR normalization when reading publisherIdentifier in line with affiliationIdentifier and nameIdentifier --- lib/bolognese/readers/datacite_reader.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bolognese/readers/datacite_reader.rb b/lib/bolognese/readers/datacite_reader.rb index c70a377e..de63aedc 100644 --- a/lib/bolognese/readers/datacite_reader.rb +++ b/lib/bolognese/readers/datacite_reader.rb @@ -102,7 +102,7 @@ def read_datacite(string: nil, **options) elsif r.is_a?(Hash) { "name" => r["__content__"].strip, - "publisherIdentifier" => r["publisherIdentifier"], + "publisherIdentifier" => r["publisherIdentifierScheme"] == "ROR" ? normalize_ror(r["publisherIdentifier"]) : r["publisherIdentifier"], "publisherIdentifierScheme" => r["publisherIdentifierScheme"], "schemeUri" => r["schemeURI"], "lang" => r["lang"], From 62a2bde8bb81bfb9bdba25e63f013441caf09ff8 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:22:42 -0500 Subject: [PATCH 08/14] Consistently read publisher as a hash from DataCite JSON and and CrossCite; adjust publisher reads for bibtex and the Metadata model --- lib/bolognese/metadata.rb | 6 +++--- lib/bolognese/readers/bibtex_reader.rb | 2 +- lib/bolognese/readers/crosscite_reader.rb | 5 ++++- lib/bolognese/readers/datacite_json_reader.rb | 5 ++++- lib/bolognese/utils.rb | 8 ++++++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/bolognese/metadata.rb b/lib/bolognese/metadata.rb index e5426d92..5e8a3d0e 100644 --- a/lib/bolognese/metadata.rb +++ b/lib/bolognese/metadata.rb @@ -217,10 +217,10 @@ def dates end def publisher - @publisher ||= - if meta.fetch("publisher", nil).is_a?(Hash) + @publisher ||= + if meta.fetch("publisher", nil).respond_to?(:to_hash) meta.fetch("publisher", nil) - elsif meta.fetch("publisher", nil).is_a?(String) + elsif meta.fetch("publisher", nil).respond_to?(:to_str) { "name" => meta.fetch("publisher", nil) }.compact end end diff --git a/lib/bolognese/readers/bibtex_reader.rb b/lib/bolognese/readers/bibtex_reader.rb index ce04ca50..0e75f8a0 100644 --- a/lib/bolognese/readers/bibtex_reader.rb +++ b/lib/bolognese/readers/bibtex_reader.rb @@ -86,7 +86,7 @@ def read_bibtex(string: nil, **options) "titles" => meta.try(:title).present? ? [{ "title" => meta.try(:title).to_s }] : [], "creators" => creators, "container" => container, - "publisher" => meta.try(:publisher).present? ? { "name" => meta.try(:publisher).to_s }.compact : nil, + "publisher" => meta.try(:publisher).present? ? { "name" => meta.publisher.to_s } : nil, "related_identifiers" => related_identifiers, "dates" => dates, "publication_year" => publication_year, diff --git a/lib/bolognese/readers/crosscite_reader.rb b/lib/bolognese/readers/crosscite_reader.rb index 5546c544..06e1f4d2 100644 --- a/lib/bolognese/readers/crosscite_reader.rb +++ b/lib/bolognese/readers/crosscite_reader.rb @@ -7,7 +7,10 @@ def read_crosscite(string: nil, **options) errors = jsonlint(string) return { "errors" => errors } if errors.present? - string.present? ? Maremma.from_json(string) : {} + crosscite = string.present? ? Maremma.from_json(string) : {} + crosscite["publisher"] = normalize_publisher(crosscite.fetch("publisher", nil)) if crosscite.fetch("publisher", nil).present? + + crosscite end end end diff --git a/lib/bolognese/readers/datacite_json_reader.rb b/lib/bolognese/readers/datacite_json_reader.rb index d2c9cf09..c1be32ec 100644 --- a/lib/bolognese/readers/datacite_json_reader.rb +++ b/lib/bolognese/readers/datacite_json_reader.rb @@ -7,7 +7,10 @@ def read_datacite_json(string: nil, **options) errors = jsonlint(string) return { "errors" => errors } if errors.present? - string.present? ? Maremma.from_json(string).transform_keys! { |key| key.underscore } : {} + datacite_json = string.present? ? Maremma.from_json(string).transform_keys! { |key| key.underscore } : {} + datacite_json["publisher"] = normalize_publisher(datacite_json.fetch("publisher", nil)) if datacite_json.fetch("publisher", nil).present? + + datacite_json end end end diff --git a/lib/bolognese/utils.rb b/lib/bolognese/utils.rb index 63584eea..c2358214 100644 --- a/lib/bolognese/utils.rb +++ b/lib/bolognese/utils.rb @@ -773,6 +773,14 @@ def normalize_licenses(licenses) nil end + def normalize_publisher(publisher) + if publisher.respond_to?(:to_hash) + publisher + elsif publisher.respond_to?(:to_str) + { "name" => publisher } + end + end + def to_datacite_json(element, options={}) a = Array.wrap(element).map do |e| e.inject({}) {|h, (k,v)| h[k.dasherize] = v; h } From 714d71a4a2169d1880ccb296df3ca1331e0e1a83 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:28:44 -0500 Subject: [PATCH 09/14] Use normalize_publisher method in Metadata class --- lib/bolognese/metadata.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/bolognese/metadata.rb b/lib/bolognese/metadata.rb index 5e8a3d0e..386ff1e3 100644 --- a/lib/bolognese/metadata.rb +++ b/lib/bolognese/metadata.rb @@ -217,12 +217,7 @@ def dates end def publisher - @publisher ||= - if meta.fetch("publisher", nil).respond_to?(:to_hash) - meta.fetch("publisher", nil) - elsif meta.fetch("publisher", nil).respond_to?(:to_str) - { "name" => meta.fetch("publisher", nil) }.compact - end + @publisher ||= normalize_publisher(meta.fetch("publisher", nil)) if meta.fetch("publisher", nil).present? end def identifiers From 98870f13479ef266a4b773e5295958886252a5a8 Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Mon, 27 Nov 2023 12:15:32 -0500 Subject: [PATCH 10/14] Corrections and refactoring --- lib/bolognese/datacite_utils.rb | 8 ++++---- lib/bolognese/metadata.rb | 2 +- lib/bolognese/readers/crosscite_reader.rb | 2 +- lib/bolognese/readers/datacite_json_reader.rb | 2 +- lib/bolognese/readers/schema_org_reader.rb | 8 ++------ 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/bolognese/datacite_utils.rb b/lib/bolognese/datacite_utils.rb index a39b142d..73653739 100644 --- a/lib/bolognese/datacite_utils.rb +++ b/lib/bolognese/datacite_utils.rb @@ -110,10 +110,10 @@ def insert_titles(xml) def insert_publisher(xml) if publisher.is_a?(Hash) attributes = { - 'publisherIdentifier' => publisher["publisherIdentifier"] || nil, - 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"] || nil, - 'schemeURI' => publisher["schemeUri"] || nil, - "xml:lang" => publisher["lang"] || nil + 'publisherIdentifier' => publisher["publisherIdentifier"], + 'publisherIdentifierScheme' => publisher["publisherIdentifierScheme"], + 'schemeURI' => publisher["schemeUri"], + "xml:lang" => publisher["lang"] }.compact xml.publisher(publisher["name"] || container && container["title"], attributes) else diff --git a/lib/bolognese/metadata.rb b/lib/bolognese/metadata.rb index 386ff1e3..685d432f 100644 --- a/lib/bolognese/metadata.rb +++ b/lib/bolognese/metadata.rb @@ -217,7 +217,7 @@ def dates end def publisher - @publisher ||= normalize_publisher(meta.fetch("publisher", nil)) if meta.fetch("publisher", nil).present? + @publisher ||= normalize_publisher(meta["publisher"]) if meta.fetch("publisher", nil).present? end def identifiers diff --git a/lib/bolognese/readers/crosscite_reader.rb b/lib/bolognese/readers/crosscite_reader.rb index 06e1f4d2..7fae2673 100644 --- a/lib/bolognese/readers/crosscite_reader.rb +++ b/lib/bolognese/readers/crosscite_reader.rb @@ -8,7 +8,7 @@ def read_crosscite(string: nil, **options) return { "errors" => errors } if errors.present? crosscite = string.present? ? Maremma.from_json(string) : {} - crosscite["publisher"] = normalize_publisher(crosscite.fetch("publisher", nil)) if crosscite.fetch("publisher", nil).present? + crosscite["publisher"] = normalize_publisher(crosscite["publisher"]) if crosscite.fetch("publisher", nil).present? crosscite end diff --git a/lib/bolognese/readers/datacite_json_reader.rb b/lib/bolognese/readers/datacite_json_reader.rb index c1be32ec..a974a2b0 100644 --- a/lib/bolognese/readers/datacite_json_reader.rb +++ b/lib/bolognese/readers/datacite_json_reader.rb @@ -8,7 +8,7 @@ def read_datacite_json(string: nil, **options) return { "errors" => errors } if errors.present? datacite_json = string.present? ? Maremma.from_json(string).transform_keys! { |key| key.underscore } : {} - datacite_json["publisher"] = normalize_publisher(datacite_json.fetch("publisher", nil)) if datacite_json.fetch("publisher", nil).present? + datacite_json["publisher"] = normalize_publisher(datacite_json["publisher"]) if datacite_json.fetch("publisher", nil).present? datacite_json end diff --git a/lib/bolognese/readers/schema_org_reader.rb b/lib/bolognese/readers/schema_org_reader.rb index 2d0d050e..7583a8b2 100644 --- a/lib/bolognese/readers/schema_org_reader.rb +++ b/lib/bolognese/readers/schema_org_reader.rb @@ -74,12 +74,8 @@ def read_schema_org(string: nil, **options) creators = get_authors(from_schema_org_creators(Array.wrap(authors))) end contributors = get_authors(from_schema_org_contributors(Array.wrap(meta.fetch("editor", nil)))) - publisher = - if parse_attributes(meta.fetch("publisher", nil), content: "name", first: true) - { - "name" => parse_attributes(meta.fetch("publisher", nil), content: "name", first: true), - }.compact - end + publisher_name = parse_attributes(meta.fetch("publisher", nil), content: "name", first: true) + publisher = { "name" => publisher_name } if publisher_name.present? ct = (schema_org == "Dataset") ? "includedInDataCatalog" : "Periodical" container = if meta.fetch(ct, nil).present? From 374991446422e48cb2ff246926dea90ff708ca3d Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:51:16 -0500 Subject: [PATCH 11/14] Makes turtle publisher tests agnostic to external metadata changes --- spec/writers/turtle_writer_spec.rb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/spec/writers/turtle_writer_spec.rb b/spec/writers/turtle_writer_spec.rb index 136d96ab..a4c2372c 100644 --- a/spec/writers/turtle_writer_spec.rb +++ b/spec/writers/turtle_writer_spec.rb @@ -10,7 +10,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") - expect(ttl[46]).to eq(" schema:name \"{eLife} Sciences Organisation, Ltd.\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"{eLife} Sciences Organisation, Ltd.\"") end it "Dataset" do @@ -20,7 +21,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:Dataset;") - expect(ttl[65]).to eq(" schema:name \"Dryad\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"Dryad\"") end it "BlogPosting" do @@ -30,7 +32,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") - expect(ttl[27]).to eq(" schema:name \"DataCite\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"") end it "BlogPosting Citeproc JSON" do @@ -39,7 +42,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:BlogPosting;") - expect(ttl[18]).to eq(" schema:name \"DataCite\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"") end it "BlogPosting DataCite JSON" do @@ -48,7 +52,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") - expect(ttl[28]).to eq(" schema:name \"DataCite\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"") end it "BlogPosting schema.org" do @@ -58,7 +63,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:BlogPosting;") - expect(ttl[15]).to eq(" schema:name \"DataCite\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"DataCite\"") end it "DataONE" do @@ -67,7 +73,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:SoftwareSourceCode;") - expect(ttl[17]).to eq(" schema:name \"https://cran.r-project.org\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"https://cran.r-project.org\"") end it "journal article" do @@ -77,7 +84,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") - expect(ttl[111]).to eq(" schema:name \"eLife Sciences Publications, Ltd\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"eLife Sciences Publications, Ltd\"") end it "with pages" do @@ -87,7 +95,8 @@ ttl = subject.turtle.split("\n") expect(ttl[0]).to eq("@prefix schema: .") expect(ttl[2]).to eq(" a schema:ScholarlyArticle;") - expect(ttl[117]).to eq(" schema:name \"Hindawi Limited\"") + publisher_line = ttl.find_index(' schema:publisher [') + 2 + expect(ttl[publisher_line]).to eq(" schema:name \"Hindawi Limited\"") end end end From a44b282e6116e7be661524a7497b32e19dac9867 Mon Sep 17 00:00:00 2001 From: Suzanne Vogt Date: Thu, 30 Nov 2023 16:47:33 -0500 Subject: [PATCH 12/14] Issue #172 - Temporary fix to DC JSON publisher - return only string, not obj. --- lib/bolognese/writers/datacite_json_writer.rb | 2 + spec/writers/datacite_json_writer_spec.rb | 48 ++++++++++++------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/lib/bolognese/writers/datacite_json_writer.rb b/lib/bolognese/writers/datacite_json_writer.rb index 97629d7c..4654f6e4 100644 --- a/lib/bolognese/writers/datacite_json_writer.rb +++ b/lib/bolognese/writers/datacite_json_writer.rb @@ -4,6 +4,8 @@ module Bolognese module Writers module DataciteJsonWriter def datacite_json + # Remove the following line for the schema 4.5 release + self.publisher = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank? JSON.pretty_generate crosscite_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) } if crosscite_hsh.present? end end diff --git a/spec/writers/datacite_json_writer_spec.rb b/spec/writers/datacite_json_writer_spec.rb index 78332ffd..44073a7f 100644 --- a/spec/writers/datacite_json_writer_spec.rb +++ b/spec/writers/datacite_json_writer_spec.rb @@ -18,7 +18,9 @@ "rightsIdentifierScheme"=>"SPDX", "rightsUri"=>"https://creativecommons.org/licenses/by/3.0/legalcode", "schemeUri"=>"https://spdx.org/licenses/"}]) - expect(datacite.fetch("publisher")).to eq({"name"=>"eLife Sciences Publications, Ltd"}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"eLife Sciences Publications, Ltd"}) + expect(datacite.fetch("publisher")).to eq("eLife Sciences Publications, Ltd") end it "with ORCID ID" do @@ -29,7 +31,9 @@ expect(datacite.fetch("types")).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"JournalArticle", "resourceTypeGeneral"=>"JournalArticle", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") expect(datacite.fetch("creators").length).to eq(7) expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi", "affiliation" => [{"name"=>"Department of Medicine, Veterans Affairs Palo Alto Health Care System, 3801 Miranda Avenue MC-, Palo Alto, CA 94304-1207, USA"}, {"name"=>"Occupational Health Strategic Health Care Group, Office of Public Health, Veterans Health Administration, Washington, DC 20006, USA"}, {"name"=>"Division of Emergency Medicine, Stanford University School of Medicine, Stanford, CA 94304, USA"}, {"name"=>"War Related Illness and Injury Study Center (WRIISC) and Mental Illness Research Education and Clinical Center (MIRECC), Department of Veterans Affairs, Palo Alto, CA 94304, USA"}]) - expect(datacite.fetch("publisher")).to eq({"name"=>"Hindawi Limited"}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"Hindawi Limited"}) + expect(datacite.fetch("publisher")).to eq("Hindawi Limited") end it "Crossref DOI" do @@ -41,7 +45,9 @@ expect(datacite.dig("descriptions", 0, "description")).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.") expect(datacite.fetch("creators").length).to eq(5) expect(datacite.fetch("creators").first).to eq("nameType"=>"Personal", "name"=>"Sankar, Martial", "givenName"=>"Martial", "familyName"=>"Sankar") - expect(datacite.fetch("publisher")).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"{eLife} Sciences Organisation, Ltd."}) + expect(datacite.fetch("publisher")).to eq("{eLife} Sciences Organisation, Ltd.") end it "BlogPosting Citeproc JSON" do @@ -52,7 +58,9 @@ expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) expect(datacite.dig("descriptions", 0, "description")).to start_with("Eating your own dog food") expect(datacite.fetch("creators")).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin"}]) - expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + expect(datacite.fetch("publisher")).to eq("DataCite") end it "rdataone" do @@ -64,7 +72,9 @@ expect(datacite.fetch("creators").first).to eq("affiliation"=>[{"name"=>"NCEAS"}], "nameType"=>"Personal", "name" => "Jones, Matt", "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "givenName"=>"Matt", "familyName"=>"Jones") expect(datacite.fetch("version")).to eq("2.0.0") - expect(datacite.fetch("publisher")).to eq({"name"=>"https://cran.r-project.org"}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"https://cran.r-project.org"}) + expect(datacite.fetch("publisher")).to eq("https://cran.r-project.org") end it "maremma" do @@ -80,7 +90,9 @@ [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "nameType"=>"Personal"}]) - expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + expect(datacite.fetch("publisher")).to eq("DataCite") end it "with data citation schema.org" do @@ -91,22 +103,26 @@ expect(datacite.fetch("titles")).to eq([{"title"=>"Eating your own Dog Food"}]) expect(datacite.fetch("relatedIdentifiers").count).to eq(3) expect(datacite.fetch("relatedIdentifiers").first).to eq("relatedIdentifier"=>"10.5438/0000-00ss", "relatedIdentifierType"=>"DOI", "relationType"=>"IsPartOf", "resourceTypeGeneral"=>"Text") - expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + # REVERT the publisher line to the commented line for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq({"name"=>"DataCite"}) + expect(datacite.fetch("publisher")).to eq("DataCite") end it "DataCite DOI with Schema 4.5 publisher attributes" do input = fixture_path + "datacite-example-full-v4.5.xml" subject = Bolognese::Metadata.new(input: input, from: "datacite") datacite = JSON.parse(subject.datacite_json) - expect(datacite.fetch("publisher")).to eq( - { - "name" => "Example Publisher", - "publisherIdentifier" => "https://ror.org/04z8jg394", - "publisherIdentifierScheme" => "ROR", - "schemeUri" => "https://ror.org/", - "lang" => "en", - }, - ) + # REVERT the publisher line to the commented lines for the schema 4.5 release + # expect(datacite.fetch("publisher")).to eq( + # { + # "name" => "Example Publisher", + # "publisherIdentifier" => "https://ror.org/04z8jg394", + # "publisherIdentifierScheme" => "ROR", + # "schemeUri" => "https://ror.org/", + # "lang" => "en", + # }, + # ) + expect(datacite.fetch("publisher")).to eq("Example Publisher") end end end From aa464c2ad8437067e54a437a226ae43a5d20fe0e Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:00:43 -0500 Subject: [PATCH 13/14] Change DC JSON writing behavior for publisher value before official Schema 4.5 release --- lib/bolognese/writers/datacite_json_writer.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/bolognese/writers/datacite_json_writer.rb b/lib/bolognese/writers/datacite_json_writer.rb index 4654f6e4..f100e9eb 100644 --- a/lib/bolognese/writers/datacite_json_writer.rb +++ b/lib/bolognese/writers/datacite_json_writer.rb @@ -5,8 +5,11 @@ module Writers module DataciteJsonWriter def datacite_json # Remove the following line for the schema 4.5 release - self.publisher = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank? - JSON.pretty_generate crosscite_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) } if crosscite_hsh.present? + if crosscite_hsh.present? + datacite_json_hsh = crosscite_hsh + datacite_json_hsh['publisher'] = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank? + JSON.pretty_generate datacite_json_hsh.transform_keys! { |key| key.camelcase(uppercase_first_letter = :lower) } + end end end end From da9cecd251722998dfcf14a6873d0fae9d25017d Mon Sep 17 00:00:00 2001 From: codycooperross <50597551+codycooperross@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:08:22 -0500 Subject: [PATCH 14/14] Comment clarity --- lib/bolognese/writers/datacite_json_writer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bolognese/writers/datacite_json_writer.rb b/lib/bolognese/writers/datacite_json_writer.rb index f100e9eb..93ff74d8 100644 --- a/lib/bolognese/writers/datacite_json_writer.rb +++ b/lib/bolognese/writers/datacite_json_writer.rb @@ -4,7 +4,7 @@ module Bolognese module Writers module DataciteJsonWriter def datacite_json - # Remove the following line for the schema 4.5 release + # Remove the following change for the schema 4.5 release if crosscite_hsh.present? datacite_json_hsh = crosscite_hsh datacite_json_hsh['publisher'] = self.publisher['name'] if self.publisher&.respond_to?(:to_hash) && self.publisher.has_key?('name') && !self.publisher['name'].blank?