diff --git a/inspire_schemas/records/authors.yml b/inspire_schemas/records/authors-0.0.1.yml similarity index 88% rename from inspire_schemas/records/authors.yml rename to inspire_schemas/records/authors-0.0.1.yml index a037f510..71580992 100644 --- a/inspire_schemas/records/authors.yml +++ b/inspire_schemas/records/authors-0.0.1.yml @@ -10,7 +10,7 @@ properties: type: array _private_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true acquisition_sources: @@ -20,7 +20,7 @@ properties: Sources of the metadata in the record, in inverse chronological order (i.e. the first element is the latest one). items: - $ref: elements/acquisition_source.json + $ref: elements/acquisition_source-0.0.1.json type: array uniqueItems: true advisors: @@ -30,22 +30,22 @@ properties: curated_relation: type: boolean degree_type: - $ref: elements/degree_type.json + $ref: elements/degree_type-0.0.1.json ids: items: - $ref: elements/id.json + $ref: elements/id-0.0.1.json type: array uniqueItems: true name: type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: object type: array uniqueItems: true arxiv_categories: items: - $ref: elements/arxiv_categories.json + $ref: elements/arxiv_categories-0.0.1.json type: array uniqueItems: true birth_date: @@ -57,7 +57,7 @@ properties: description: |- Contains information about attended conferences. (their record URIs) items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: array uniqueItems: true control_number: @@ -73,7 +73,7 @@ properties: description: |- List of deleted records referring to this record items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Deleted Records type: array email_addresses: @@ -99,7 +99,7 @@ properties: name: type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- URI for the experiment record start_year: @@ -109,12 +109,12 @@ properties: uniqueItems: true ids: items: - $ref: elements/id.json + $ref: elements/id-0.0.1.json type: array uniqueItems: true inspire_categories: items: - $ref: elements/inspire_field.json + $ref: elements/inspire_field-0.0.1.json type: array uniqueItems: true legacy_creation_date: @@ -158,7 +158,7 @@ properties: type: string type: array new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Master record that replaces this record title: New record @@ -201,7 +201,7 @@ properties: name: type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: object old_emails: items: @@ -209,7 +209,7 @@ properties: type: string type: array rank: - $ref: elements/rank.json + $ref: elements/rank-0.0.1.json start_date: format: date type: string @@ -234,11 +234,11 @@ properties: uniqueItems: true public_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Url of the record itself title: Url of the record @@ -269,7 +269,7 @@ properties: type: boolean urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true required: diff --git a/inspire_schemas/records/conferences.yml b/inspire_schemas/records/conferences-0.0.1.yml similarity index 89% rename from inspire_schemas/records/conferences.yml rename to inspire_schemas/records/conferences-0.0.1.yml index a6f9348d..ddc49674 100644 --- a/inspire_schemas/records/conferences.yml +++ b/inspire_schemas/records/conferences-0.0.1.yml @@ -24,7 +24,7 @@ properties: These notes are only visible to privileged users, not regular users. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of private notes type: array uniqueItems: true @@ -46,10 +46,10 @@ properties: .. note:: - The :ref:`address.json#/properties/postal_address` should not + The :ref:`address-0.0.1.json#/properties/postal_address` should not be provided for a conference. items: - $ref: elements/address.json + $ref: elements/address-0.0.1.json title: List of locations of the conference type: array uniqueItems: true @@ -69,7 +69,7 @@ properties: was not categorized well into title/acronym variants and was used to boost search results. items: - $ref: elements/title.json + $ref: elements/title-0.0.1.json title: List of alternative titles type: array uniqueItems: true @@ -80,13 +80,13 @@ properties: title: Conference closing date type: string cnum: - $ref: elements/cnum.json + $ref: elements/cnum-0.0.1.json title: CNUM of the conference contact_details: description: |- :MARC: ``270`` items: - $ref: elements/contact.json + $ref: elements/contact-0.0.1.json title: Contact information type: array uniqueItems: true @@ -113,7 +113,7 @@ properties: For the opposite concept, see :ref:`new_record`. items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: array external_system_identifiers: description: |- @@ -139,14 +139,14 @@ properties: uniqueItems: true inspire_categories: items: - $ref: elements/inspire_field.json + $ref: elements/inspire_field-0.0.1.json type: array uniqueItems: true legacy_creation_date: format: date type: string new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- :MARC: ``970__d`` @@ -170,12 +170,12 @@ properties: These notes are publicly visible. For notes not shown to regular users, see :ref:`_private_notes`. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of public notes type: array uniqueItems: true self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json series: description: |- :MARC: ``411`` @@ -199,18 +199,18 @@ properties: type: array uniqueItems: true short_description: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json titles: description: |- :MARC: ``111__a/b`` items: - $ref: elements/title.json + $ref: elements/title-0.0.1.json title: List of titles of the conference type: array uniqueItems: true urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true title: Conference diff --git a/inspire_schemas/records/data.yml b/inspire_schemas/records/data-0.0.1.yml similarity index 100% rename from inspire_schemas/records/data.yml rename to inspire_schemas/records/data-0.0.1.yml diff --git a/inspire_schemas/records/elements/acquisition_source.yml b/inspire_schemas/records/elements/acquisition_source-0.0.1.yml similarity index 98% rename from inspire_schemas/records/elements/acquisition_source.yml rename to inspire_schemas/records/elements/acquisition_source-0.0.1.yml index 673ba212..ad83a581 100644 --- a/inspire_schemas/records/elements/acquisition_source.yml +++ b/inspire_schemas/records/elements/acquisition_source-0.0.1.yml @@ -61,7 +61,7 @@ properties: title: ORCID of the submitter type: string source: - $ref: source.json + $ref: source-0.0.1.json submission_number: description: |- :MARC: ``541__e`` diff --git a/inspire_schemas/records/elements/address.yml b/inspire_schemas/records/elements/address-0.0.1.yml similarity index 98% rename from inspire_schemas/records/elements/address.yml rename to inspire_schemas/records/elements/address-0.0.1.yml index ec5e727f..020eb1d3 100644 --- a/inspire_schemas/records/elements/address.yml +++ b/inspire_schemas/records/elements/address-0.0.1.yml @@ -21,7 +21,7 @@ properties: type: array uniqueItems: true country_code: - $ref: country_code.json + $ref: country_code-0.0.1.json latitude: description: |- :example: 50.7736 diff --git a/inspire_schemas/records/elements/arxiv_categories.yml b/inspire_schemas/records/elements/arxiv_categories-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/arxiv_categories.yml rename to inspire_schemas/records/elements/arxiv_categories-0.0.1.yml diff --git a/inspire_schemas/records/elements/cnum.yml b/inspire_schemas/records/elements/cnum-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/cnum.yml rename to inspire_schemas/records/elements/cnum-0.0.1.yml diff --git a/inspire_schemas/records/elements/contact.yml b/inspire_schemas/records/elements/contact-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/contact.yml rename to inspire_schemas/records/elements/contact-0.0.1.yml diff --git a/inspire_schemas/records/elements/country_code.yml b/inspire_schemas/records/elements/country_code-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/country_code.yml rename to inspire_schemas/records/elements/country_code-0.0.1.yml diff --git a/inspire_schemas/records/elements/degree_type.yml b/inspire_schemas/records/elements/degree_type-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/degree_type.yml rename to inspire_schemas/records/elements/degree_type-0.0.1.yml diff --git a/inspire_schemas/records/elements/document_type.yml b/inspire_schemas/records/elements/document_type-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/document_type.yml rename to inspire_schemas/records/elements/document_type-0.0.1.yml diff --git a/inspire_schemas/records/elements/id.yml b/inspire_schemas/records/elements/id-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/id.yml rename to inspire_schemas/records/elements/id-0.0.1.yml diff --git a/inspire_schemas/records/elements/inspire_field.yml b/inspire_schemas/records/elements/inspire_field-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/inspire_field.yml rename to inspire_schemas/records/elements/inspire_field-0.0.1.yml diff --git a/inspire_schemas/records/elements/json_reference.yml b/inspire_schemas/records/elements/json_reference-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/json_reference.yml rename to inspire_schemas/records/elements/json_reference-0.0.1.yml diff --git a/inspire_schemas/records/elements/material.yml b/inspire_schemas/records/elements/material-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/material.yml rename to inspire_schemas/records/elements/material-0.0.1.yml diff --git a/inspire_schemas/records/elements/rank.yml b/inspire_schemas/records/elements/rank-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/rank.yml rename to inspire_schemas/records/elements/rank-0.0.1.yml diff --git a/inspire_schemas/records/elements/reference.yml b/inspire_schemas/records/elements/reference-0.0.1.yml similarity index 91% rename from inspire_schemas/records/elements/reference.yml rename to inspire_schemas/records/elements/reference-0.0.1.yml index 9732723b..ab4bcaec 100644 --- a/inspire_schemas/records/elements/reference.yml +++ b/inspire_schemas/records/elements/reference-0.0.1.yml @@ -3,7 +3,7 @@ additionalProperties: false description: |- This is structurally very similar to a Literature record, with unnecessary fields removed. For more information about the meaning of the different - fields, see the corresponding field in :ref:`hep.json#/`. + fields, see the corresponding field in :ref:`literature-0.0.1.json#/`. properties: arxiv_eprint: description: |- @@ -22,7 +22,7 @@ properties: full_name: description: |- Should be of the same form as - :ref:`hep.json#/properties/authors/items/properties/full_name`. + :ref:`literature-0.0.1.json#/properties/authors/items/properties/full_name`. :example: ``Smith, John G.D.`` type: string @@ -54,7 +54,7 @@ properties: type: array uniqueItems: true document_type: - $ref: document_type.json + $ref: document_type-0.0.1.json description: |- :MARC: conceptually similar to ``999C5d``, but allowed values differ. @@ -135,7 +135,7 @@ properties: :MARC: last part of ``999C5s`` (if not a page) type: string cnum: - $ref: cnum.json + $ref: cnum-0.0.1.json description: |- :MARC: ``999C5b`` journal_issue: @@ -151,7 +151,7 @@ properties: :MARC: second part of ``999C5s`` type: string material: - $ref: material.json + $ref: material-0.0.1.json page_end: description: |- :MARC: Last part of ``999C5s`` (if page-range) @@ -163,7 +163,7 @@ properties: parent_isbn: description: |- :MARC: ``999C5i``, but not distinguished from - the :ref:`reference.json#/properties/isbn` of the + the :ref:`reference-0.0.1.json#/properties/isbn` of the cited document. If the cited document is a book chapter, this is the ISBN @@ -173,7 +173,7 @@ properties: parent_report_number: description: |- :MARC: ``999C5r`` but not distinguished from the cited - document :ref:`reference.json#/properties/report_number`. + document :ref:`reference-0.0.1.json#/properties/report_number`. type: string parent_title: description: |- @@ -205,18 +205,18 @@ properties: Key that was used for this citation in the document. This may be extracted if the document is a PDF generated from a LaTeX, and possibly coincides with the one of the - :ref:`hep.json#/properties/texkeys` assigned to the cited document + :ref:`literature-0.0.1.json#/properties/texkeys` assigned to the cited document by Inspire and made visible in the TeX export formats. :example: ``Maldacena:1997re`` type: string title: - $ref: title.json + $ref: title-0.0.1.json description: |- :MARC: ``999C5t`` urls: items: - $ref: url.json + $ref: url-0.0.1.json description: |- :MARC: ``999C5u`` type: array diff --git a/inspire_schemas/records/elements/related_record.yml b/inspire_schemas/records/elements/related_record-0.0.1.yml similarity index 96% rename from inspire_schemas/records/elements/related_record.yml rename to inspire_schemas/records/elements/related_record-0.0.1.yml index acf30871..f29c82ea 100644 --- a/inspire_schemas/records/elements/related_record.yml +++ b/inspire_schemas/records/elements/related_record-0.0.1.yml @@ -9,12 +9,12 @@ dependencies: - relation_freetext description: |- :MARC: ``78002``, ``78502``, ``78708```and ``510`` (depending on type of - record and :ref:`related_record.json#/properties/relation`) + record and :ref:`related_record-0.0.1.json#/properties/relation`) properties: curated_relation: type: boolean record: - $ref: json_reference.json + $ref: json_reference-0.0.1.json description: |- :MARC: ``510__0`` (for Institutions and Experiments), ``78002/78502/78708w`` (for Literature and Journals). diff --git a/inspire_schemas/records/elements/source.yml b/inspire_schemas/records/elements/source-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/source.yml rename to inspire_schemas/records/elements/source-0.0.1.yml diff --git a/inspire_schemas/records/elements/sourced_value.yml b/inspire_schemas/records/elements/sourced_value-0.0.1.yml similarity index 87% rename from inspire_schemas/records/elements/sourced_value.yml rename to inspire_schemas/records/elements/sourced_value-0.0.1.yml index a20c8c29..4392e170 100644 --- a/inspire_schemas/records/elements/sourced_value.yml +++ b/inspire_schemas/records/elements/sourced_value-0.0.1.yml @@ -4,7 +4,7 @@ description: |- came from. properties: source: - $ref: source.json + $ref: source-0.0.1.json value: type: string required: diff --git a/inspire_schemas/records/elements/title.yml b/inspire_schemas/records/elements/title-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/title.yml rename to inspire_schemas/records/elements/title-0.0.1.yml diff --git a/inspire_schemas/records/elements/url.yml b/inspire_schemas/records/elements/url-0.0.1.yml similarity index 100% rename from inspire_schemas/records/elements/url.yml rename to inspire_schemas/records/elements/url-0.0.1.yml diff --git a/inspire_schemas/records/experiments.yml b/inspire_schemas/records/experiments-0.0.1.yml similarity index 92% rename from inspire_schemas/records/experiments.yml rename to inspire_schemas/records/experiments-0.0.1.yml index cd4ffc2f..d08b9274 100644 --- a/inspire_schemas/records/experiments.yml +++ b/inspire_schemas/records/experiments-0.0.1.yml @@ -11,7 +11,7 @@ dependencies: - accelerator description: |- This record can describe different types of projects, depending on the - value of :ref:`experiments.json#/properties/project_type`. + value of :ref:`experiments-0.0.1.json#/properties/project_type`. properties: $schema: format: url @@ -39,7 +39,7 @@ properties: These notes are only visible to privileged users, not regular users. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of private notes type: array uniqueItems: true @@ -54,10 +54,10 @@ properties: curated_relation: type: boolean record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- If ``accelerator`` is not present in - :ref:`experiments.json#/properties/project_type`, this + :ref:`experiments-0.0.1.json#/properties/project_type`, this links to the related accelerator record. value: description: |- @@ -81,10 +81,10 @@ properties: curated_relation: type: boolean record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- If ``collaboration`` is not present in - :ref:`experiments.json#/properties/project_type`, this + :ref:`experiments-0.0.1.json#/properties/project_type`, this links to the related collaboration record. subgroup_names: description: |- @@ -121,7 +121,7 @@ properties: :MARC: ``980:CORE`` corresponds to ``true``. Whether the papers written by this project are generally - :ref:`hep.json#/properties/core`. + :ref:`literature-0.0.1.json#/properties/core`. type: boolean date_approved: description: |- @@ -169,7 +169,7 @@ properties: For the opposite concept, see :ref:`new_record`. items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: array description: description: |- @@ -226,7 +226,7 @@ properties: uniqueItems: true inspire_categories: items: - $ref: elements/inspire_field.json + $ref: elements/inspire_field-0.0.1.json type: array uniqueItems: true inspire_classification: @@ -251,14 +251,14 @@ properties: curated_relation: type: boolean record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Record URI of the institution. value: description: |- :MARC: ``119__u`` Currently, the old - :ref:`institutions.json#/properties/legacy_ICN` is used + :ref:`institutions-0.0.1.json#/properties/legacy_ICN` is used here. title: ICN of institution hosting the project type: string @@ -284,7 +284,7 @@ properties: type: array uniqueItems: true new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- :MARC: ``970__d`` @@ -340,7 +340,7 @@ properties: These notes are publicly visible. For notes not shown to regular users, see :ref:`_private_notes`. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of public notes type: array uniqueItems: true @@ -348,15 +348,15 @@ properties: description: |- :MARC: ``510`` items: - $ref: elements/related_record.json + $ref: elements/related_record-0.0.1.json title: List of related records type: array uniqueItems: true self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true required: diff --git a/inspire_schemas/records/institutions.yml b/inspire_schemas/records/institutions-0.0.1.yml similarity index 90% rename from inspire_schemas/records/institutions.yml rename to inspire_schemas/records/institutions-0.0.1.yml index 37990399..940b31cf 100644 --- a/inspire_schemas/records/institutions.yml +++ b/inspire_schemas/records/institutions-0.0.1.yml @@ -17,12 +17,12 @@ properties: type: array _private_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true address: items: - $ref: elements/address.json + $ref: elements/address-0.0.1.json type: array uniqueItems: true control_number: @@ -38,7 +38,7 @@ properties: description: |- List of deleted records referring to this record items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Deleted Records type: array department: @@ -106,7 +106,7 @@ properties: type: array inspire_categories: items: - $ref: elements/inspire_field.json + $ref: elements/inspire_field-0.0.1.json type: array uniqueItems: true institution: @@ -143,29 +143,29 @@ properties: type: object name_variants: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Master record that replaces this record title: New record public_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true related_records: description: |- :MARC: ``510`` items: - $ref: elements/related_record.json + $ref: elements/related_record-0.0.1.json title: List of related records type: array uniqueItems: true self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Url of the record itself title: Url of the record @@ -181,7 +181,7 @@ properties: type: string urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true title: Institution diff --git a/inspire_schemas/records/jobs.yml b/inspire_schemas/records/jobs-0.0.1.yml similarity index 85% rename from inspire_schemas/records/jobs.yml rename to inspire_schemas/records/jobs-0.0.1.yml index 1e27be87..aea6b799 100644 --- a/inspire_schemas/records/jobs.yml +++ b/inspire_schemas/records/jobs-0.0.1.yml @@ -10,12 +10,12 @@ properties: type: array _private_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true address: items: - $ref: elements/address.json + $ref: elements/address-0.0.1.json type: array uniqueItems: true closed_date: @@ -24,7 +24,7 @@ properties: type: string contact_details: items: - $ref: elements/contact.json + $ref: elements/contact-0.0.1.json type: array uniqueItems: true control_number: @@ -39,7 +39,7 @@ properties: description: |- List of deleted records referring to this record items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Deleted Records type: array description: @@ -55,7 +55,7 @@ properties: title: Experiment name type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Experiment Record URI title: Experiments associated with Job type: object @@ -81,7 +81,7 @@ properties: uniqueItems: true inspire_categories: items: - $ref: elements/inspire_field.json + $ref: elements/inspire_field-0.0.1.json type: array uniqueItems: true institutions: @@ -94,7 +94,7 @@ properties: title: Institution name type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Institution Record URI title: Institution type: object @@ -104,7 +104,7 @@ properties: format: date type: string new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Master record that replaces this record title: New record @@ -113,12 +113,12 @@ properties: type: string public_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true ranks: items: - $ref: elements/rank.json + $ref: elements/rank-0.0.1.json type: array uniqueItems: true reference_email: @@ -143,13 +143,13 @@ properties: type: string type: array self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Url of the record itself title: Url of the record urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true title: HEP Job diff --git a/inspire_schemas/records/journals.yml b/inspire_schemas/records/journals-0.0.1.yml similarity index 84% rename from inspire_schemas/records/journals.yml rename to inspire_schemas/records/journals-0.0.1.yml index 6210be19..7f986b5a 100644 --- a/inspire_schemas/records/journals.yml +++ b/inspire_schemas/records/journals-0.0.1.yml @@ -10,7 +10,7 @@ properties: type: array _private_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true coden: @@ -29,7 +29,7 @@ properties: description: |- List of deleted records referring to this record items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: Deleted Records type: array history: @@ -63,7 +63,7 @@ properties: type: string journal_titles: items: - $ref: elements/title.json + $ref: elements/title-0.0.1.json type: array uniqueItems: true legacy_creation_date: @@ -79,11 +79,11 @@ properties: type: string license_urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Master record that replaces this record title: New record @@ -92,7 +92,7 @@ properties: type: boolean public_notes: items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true publisher: @@ -104,28 +104,28 @@ properties: description: |- :MARC: ``78002``, ``78502`` items: - $ref: elements/related_record.json + $ref: elements/related_record-0.0.1.json title: List of related records type: array uniqueItems: true self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Url of the record itself title: Url of the record short_titles: items: - $ref: elements/title.json + $ref: elements/title-0.0.1.json type: array uniqueItems: true title_variants: items: - $ref: elements/title.json + $ref: elements/title-0.0.1.json type: array uniqueItems: true urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true title: Journal diff --git a/inspire_schemas/records/hep.yml b/inspire_schemas/records/literature-0.0.1.yml similarity index 94% rename from inspire_schemas/records/hep.yml rename to inspire_schemas/records/literature-0.0.1.yml index d5be638f..7e498b97 100644 --- a/inspire_schemas/records/hep.yml +++ b/inspire_schemas/records/literature-0.0.1.yml @@ -137,7 +137,7 @@ properties: These notes are only visible to privileged users, not regular users. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of private notes type: array uniqueItems: true @@ -145,7 +145,7 @@ properties: description: |- :MARC: ``520`` items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of abstracts type: array uniqueItems: true @@ -202,7 +202,7 @@ properties: title: Identifier of the experiment on legacy type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: object title: List of related accelerators/experiments type: array @@ -214,7 +214,7 @@ properties: Sources of the metadata in the record, in inverse chronological order (i.e. the first element is the latest one). items: - $ref: elements/acquisition_source.json + $ref: elements/acquisition_source-0.0.1.json type: array uniqueItems: true arxiv_eprints: @@ -236,7 +236,7 @@ properties: The first category in the list has a special meaning: it is the primary category of the eprint on arXiv. items: - $ref: elements/arxiv_categories.json + $ref: elements/arxiv_categories-0.0.1.json minItems: 1 title: arXiv categories of the eprint type: array @@ -261,7 +261,7 @@ properties: :MARC: ``100``, ``700`` and ``701`` Besides authors, also contains editors and supervisors (see - :ref:`hep.json#/properties/authors/items/properties/inspire_roles`). + :ref:`literature-0.0.1.json#/properties/authors/items/properties/inspire_roles`). items: additionalProperties: false properties: @@ -272,16 +272,16 @@ properties: curated_relation: type: boolean record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json value: description: |- :MARC: ``100/700/701__u`` Currently, the old - :ref:`institutions.json#/properties/legacy_ICN` + :ref:`institutions-0.0.1.json#/properties/legacy_ICN` is used here. In the future, this will change and become the new - :ref:`institutions.json#/properties/ICN`. + :ref:`institutions-0.0.1.json#/properties/ICN`. title: ICN of affiliation type: string required: @@ -349,7 +349,7 @@ properties: description: |- :MARC: ``100/700/701__i/j`` items: - $ref: elements/id.json + $ref: elements/id-0.0.1.json title: Identifiers of the author type: array uniqueItems: true @@ -362,7 +362,7 @@ properties: This person is a thesis supervisor. Should be used together with the ``thesis`` - :ref:`hep.json#/properties/document_type`. + :ref:`literature-0.0.1.json#/properties/document_type`. ``editor`` :MARC: ``100/700__e:ed.`` @@ -370,7 +370,7 @@ properties: This person is an editor of the conference proceedings. Should be used together with the ``proceedings`` - :ref:`hep.json#/properties/document_type`. + :ref:`literature-0.0.1.json#/properties/document_type`. enum: - author - supervisor @@ -383,11 +383,11 @@ properties: List of full affiliations, as written on the paper. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json type: array uniqueItems: true record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json signature_block: description: |- Phonetic representation of the name, needed for author @@ -417,14 +417,14 @@ properties: This field should only be present if ``book``, ``thesis`` or ``proceedings`` are among - :ref:`hep.json#/properties/document_type`. + :ref:`literature-0.0.1.json#/properties/document_type`. items: additionalProperties: false description: |- .. note:: If the book series has a Journal record, - `hep.json#/properties/publication_info` should be used + `literature-0.0.1.json#/properties/publication_info` should be used instead. properties: title: @@ -467,7 +467,7 @@ properties: additionalProperties: false properties: record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json value: description: |- :MARC: ``710__g`` @@ -505,7 +505,7 @@ properties: title: Copyright holder type: string material: - $ref: elements/material.json + $ref: elements/material-0.0.1.json description: |- :MARC: ``542__e`` statement: @@ -584,7 +584,7 @@ properties: For the opposite concept, see :ref:`new_record`. items: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: array document_type: description: |- @@ -653,7 +653,7 @@ properties: This is not considered as a ``book``. items: - $ref: elements/document_type.json + $ref: elements/document_type-0.0.1.json minItems: 1 type: array uniqueItems: true @@ -662,11 +662,11 @@ properties: additionalProperties: false properties: material: - $ref: elements/material.json + $ref: elements/material-0.0.1.json description: |- :MARC: ``0247_q`` source: - $ref: elements/source.json + $ref: elements/source-0.0.1.json description: |- :MARC: ``0247_9`` value: @@ -797,7 +797,7 @@ properties: This field is populated if this record has been published in a book, i.e. it makes sense if ``book``, ``thesis`` or ``proceedings`` are among - :ref:`hep.json#/properties/document_type`. + :ref:`literature-0.0.1.json#/properties/document_type`. :example: ``Paris`` title: Place of publication @@ -813,7 +813,7 @@ properties: uniqueItems: true inspire_categories: items: - $ref: elements/inspire_field.json + $ref: elements/inspire_field-0.0.1.json title: List of Inspire categories type: array uniqueItems: true @@ -906,7 +906,7 @@ properties: title: Keyword vocabulary type: string source: - $ref: elements/source.json + $ref: elements/source-0.0.1.json value: description: |- :MARC: ``084/6531/695__a`` (depending on :ref:`schema`) @@ -975,7 +975,7 @@ properties: title: License statement type: string material: - $ref: elements/material.json + $ref: elements/material-0.0.1.json description: |- :MARC: ``540__3`` url: @@ -992,7 +992,7 @@ properties: type: array uniqueItems: true new_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- :MARC: ``970__d`` @@ -1012,7 +1012,7 @@ properties: additionalProperties: false properties: material: - $ref: elements/material.json + $ref: elements/material-0.0.1.json schema: description: |- :MARC: ``0247_2`` @@ -1025,18 +1025,18 @@ properties: .. note:: - DOIs should be put into :ref:`hep.json#/properties/dois`, not here. + DOIs should be put into :ref:`literature-0.0.1.json#/properties/dois`, not here. Although ISBNs can also be mapped to a URN (by prepending ``urn:isbn:`` to the ISBN), they should - be put in the :ref:`hep.json#/properties/isbns` field instead. + be put in the :ref:`literature-0.0.1.json#/properties/isbns` field instead. enum: - HDL - URN title: Type of identifier type: string source: - $ref: elements/source.json + $ref: elements/source-0.0.1.json value: description: |- :MARC: ``0247_a`` @@ -1080,7 +1080,7 @@ properties: These notes are publicly visible. For notes not shown to regular users, see :ref:`_private_notes`. items: - $ref: elements/sourced_value.json + $ref: elements/sourced_value-0.0.1.json title: List of public notes type: array uniqueItems: true @@ -1105,12 +1105,12 @@ properties: title: Article ID type: string cnum: - $ref: elements/cnum.json + $ref: elements/cnum-0.0.1.json description: |- :MARC: ``773__w`` When ``conference` paper` or ``proceedings`` is among - :ref:`hep.json#/properties/document_type`, contains the + :ref:`literature-0.0.1.json#/properties/document_type`, contains the CNUM of the corresponding conference. conf_acronym: description: |- @@ -1118,7 +1118,7 @@ properties: title: Conference acronym type: string conference_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json title: record of the conference curated_relation: type: boolean @@ -1138,7 +1138,7 @@ properties: :MARC: ``773__n`` type: string journal_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- Record of the corresponding Journal journal_title: @@ -1155,7 +1155,7 @@ properties: :MARC: ``773__v`` type: string material: - $ref: elements/material.json + $ref: elements/material-0.0.1.json description: |- :MARC: ``773__m`` page_end: @@ -1176,7 +1176,7 @@ properties: pattern: ^(97(8|9))?\d{9}(\d|X)$ type: string parent_record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json parent_report_number: description: |- :MARC: ``773__r`` @@ -1252,7 +1252,7 @@ properties: title: Content type of the raw reference type: string source: - $ref: elements/source.json + $ref: elements/source-0.0.1.json value: title: Content of the raw reference type: string @@ -1263,11 +1263,11 @@ properties: title: List of raw references type: array record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json description: |- :MARC: ``999C50`` reference: - $ref: elements/reference.json + $ref: elements/reference-0.0.1.json type: object title: List of references type: array @@ -1276,7 +1276,7 @@ properties: description: |- :MARC: ``78002``, ``78502``, ``78708`` items: - $ref: elements/related_record.json + $ref: elements/related_record-0.0.1.json title: List of related records type: array uniqueItems: true @@ -1302,7 +1302,7 @@ properties: document (typically for large collaborations). type: boolean source: - $ref: elements/source.json + $ref: elements/source-0.0.1.json value: type: string required: @@ -1312,7 +1312,7 @@ properties: type: array uniqueItems: true self: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json special_collections: description: |- :MARC: ``980__a`` @@ -1380,7 +1380,7 @@ properties: format: date type: string degree_type: - $ref: elements/degree_type.json + $ref: elements/degree_type-0.0.1.json description: |- :MARC: ``502__b`` institutions: @@ -1396,7 +1396,7 @@ properties: name: type: string record: - $ref: elements/json_reference.json + $ref: elements/json_reference-0.0.1.json type: object type: array type: object @@ -1416,7 +1416,7 @@ properties: pattern: ^\w{2}$ type: string source: - $ref: elements/source.json + $ref: elements/source-0.0.1.json subtitle: type: string title: @@ -1434,13 +1434,13 @@ properties: Translations go into :ref:`title_translations`. items: - $ref: elements/title.json + $ref: elements/title-0.0.1.json title: List of titles type: array uniqueItems: true urls: items: - $ref: elements/url.json + $ref: elements/url-0.0.1.json type: array uniqueItems: true withdrawn: diff --git a/inspire_schemas/upgraders.py b/inspire_schemas/upgraders.py new file mode 100644 index 00000000..9a15067e --- /dev/null +++ b/inspire_schemas/upgraders.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +# +# This file is part of INSPIRE-SCHEMAS. +# Copyright (C) 2017 CERN. +# +# INSPIRE-SCHEMAS is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# INSPIRE-SCHEMAS is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with INSPIRE-SCHEMAS; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307, USA. +# +# In applying this license, CERN does not +# waive the privileges and immunities granted to it by virtue of its status +# as an Intergovernmental Organization or submit itself to any jurisdiction. + +"""Upgraders utilities.""" + +import re +import semver + +from .utils import get_schema_and_revision, LATEST_SCHEMA_REVISIONS + + + +def build_ledger(): + return { + 'authors': [ + ('0.0.1', first_revision_rule) + ], + 'conferences': [ + ('0.0.1', first_revision_rule) + ], + 'data': [ + ('0.0.1', first_revision_rule) + ], + 'experiments': [ + ('0.0.1', first_revision_rule) + ], + 'literature': [ + ('0.0.1', first_revision_rule) + ], + 'institutions': [ + ('0.0.1', first_revision_rule) + ], + 'jobs': [ + ('0.0.1', first_revision_rule) + ], + 'journals': [ + ('0.0.1', first_revision_rule) + ], + } + + +LEDGERS = build_ledger() + + +def upgrade(json): + schema, current_revision = get_schema_and_revision(json) + for revision, rule in LEDGERS['schema']: + if semver.compare(revision, current_revision, loose=False) > 0: + json = rule(json) + json['schema'] = '{schema}-{revision}.json'.format( + schema=schema, + revision=LATEST_SCHEMA_REVISIONS[schema] + ) + return json + + +def first_revision_rule(json): + """Upgrade records for the first time. + + Upgrades records for the first time by introducing the new concept of + schema revision. + """ + json['$schema'] = json['$schema'].replace('.json', '-0.0.1.json') + return json diff --git a/inspire_schemas/utils.py b/inspire_schemas/utils.py index e9c7c505..96437aeb 100644 --- a/inspire_schemas/utils.py +++ b/inspire_schemas/utils.py @@ -29,9 +29,10 @@ import re import warnings +import semver from jsonschema import validate as jsonschema_validate from jsonschema import RefResolver, draft4_format_checker -from pkg_resources import resource_filename +from pkg_resources import resource_filename, resource_listdir from six.moves.urllib.parse import urlsplit @@ -39,6 +40,8 @@ _schema_root_path = os.path.abspath(resource_filename(__name__, 'records')) +_schema_and_revision_re = re.compile(r'^.*?\b(?P\w+?)(-(?P\d+\.\d+\.\d+))?(\.json)?$') + class LocalRefResolver(RefResolver): """Simple resolver to handle non-uri relative paths.""" @@ -181,3 +184,26 @@ def _verify_author_name_initials(author_name): name[1] = name[1].replace(' ', '') name = ', '.join(n_elem.strip() for n_elem in name) return name + + +def get_schema_and_revision(schema_string): + """Extracts schema and revision from a schema_string.""" + g = _schema_and_revision_re.match(schema_string).groupdict() + schema = g['schema'] + revision = g['revision'] or '0.0.0' + return schema, revision + + +def build_latest_schema_revisions(): + """Returns the latest revisions for a given schema.""" + latest_revisions = {} + for filename in resource_listdir(__name__, 'records'): + if filename.endswith('.json'): + schema, revision = get_schema_and_revision(filename) + latest_revisions.setdefault(schema, '0.0.0') + if semver.compare(revision, latest_revisions[schema], loose=False) > 0: + latest_revisions[schema] = revision + return latest_revisions + + +LATEST_SCHEMA_REVISIONS = build_latest_schema_revisions() diff --git a/scripts/generate_example_records.js b/scripts/generate_example_records.js index 44a8cb98..d61c6651 100755 --- a/scripts/generate_example_records.js +++ b/scripts/generate_example_records.js @@ -49,10 +49,11 @@ function resolve_schema(unresolved_schema, base_path) { return resolved_schema } -var schemas = ['hep', 'authors', 'conferences', 'experiments', 'institutions', 'jobs', 'journals'] +var schemas = fs.readdirSync('inspire_schemas/records/'); for (var schema_name of schemas) { + if (!schema_name.endsWith('.json')) continue; console.log('Generating example for ' + schema_name) - var data = fs.readFileSync('inspire_schemas/records/'+schema_name+'.json', 'utf8') + var data = fs.readFileSync('inspire_schemas/records/'+schema_name, 'utf8') var unresolved_schema = JSON.parse(data) var full_schema = resolve_schema(unresolved_schema, "inspire_schemas/records") var sample = jsf(full_schema) diff --git a/setup.py b/setup.py index a67a2eef..675fa396 100644 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ def do_setup(url=URL): name='inspire-schemas', package_data={'': ['*.json', 'CHANGELOG', 'AUTHORS']}, packages=find_packages(), - setup_requires=['autosemver', 'pyyaml', 'six'], + setup_requires=['autosemver', 'pyyaml', 'six', 'node-semver'], url=URL, bugtracker_url=URL + '/issues/', zip_safe=False, diff --git a/tests/integration/fixtures/authors_example.json b/tests/integration/fixtures/authors-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/authors_example.json rename to tests/integration/fixtures/authors-0.0.1.json_example.json diff --git a/tests/integration/fixtures/conferences_example.json b/tests/integration/fixtures/conferences-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/conferences_example.json rename to tests/integration/fixtures/conferences-0.0.1.json_example.json diff --git a/tests/integration/fixtures/experiments_example.json b/tests/integration/fixtures/experiments-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/experiments_example.json rename to tests/integration/fixtures/experiments-0.0.1.json_example.json diff --git a/tests/integration/fixtures/institutions_example.json b/tests/integration/fixtures/institutions-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/institutions_example.json rename to tests/integration/fixtures/institutions-0.0.1.json_example.json diff --git a/tests/integration/fixtures/jobs_example.json b/tests/integration/fixtures/jobs-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/jobs_example.json rename to tests/integration/fixtures/jobs-0.0.1.json_example.json diff --git a/tests/integration/fixtures/journals_example.json b/tests/integration/fixtures/journals-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/journals_example.json rename to tests/integration/fixtures/journals-0.0.1.json_example.json diff --git a/tests/integration/fixtures/hep_example.json b/tests/integration/fixtures/literature-0.0.1.json_example.json similarity index 100% rename from tests/integration/fixtures/hep_example.json rename to tests/integration/fixtures/literature-0.0.1.json_example.json diff --git a/tests/integration/test_validate.py b/tests/integration/test_validate.py index 072656c3..ba0743e0 100644 --- a/tests/integration/test_validate.py +++ b/tests/integration/test_validate.py @@ -65,7 +65,7 @@ def change_something(data): data[key] = 42 break else: - raise Exception('Unable to change anythng on data "%s"' % data) + raise Exception('Unable to change anything on data "%s"' % data) return data diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index fdc7426c..9dd597df 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -155,3 +155,29 @@ def test_load_schema_without_schema_key(mock_get_schema_path, mock_open): loaded_schema = utils.load_schema('And gallantly he chickened out') assert loaded_schema == {'$schema': myschema} + + +def test_build_latest_schema_revisions(): + latest_schema_revisions = utils.build_latest_schema_revisions() + + assert 'literature' in latest_schema_revisions + + # Testing journals because the max revision will not change that often + assert latest_schema_revisions['journals'] == '0.0.1' + + +def test_get_schema_and_revision(): + schema, revision = utils.get_schema_and_revision('literature-1.2.3.json') + expected_schema, expected_revision = 'literature', '1.2.3' + assert schema == expected_schema + assert revision == expected_revision + + schema, revision = utils.get_schema_and_revision('http://inspirehep.net/schema/literature-1.2.3.json') + expected_schema, expected_revision = 'literature', '1.2.3' + assert schema == expected_schema + assert revision == expected_revision + + schema, revision = utils.get_schema_and_revision('authors-3.2.1') + expected_schema, expected_revision = 'authors', '3.2.1' + assert schema == expected_schema + assert revision == expected_revision