Skip to content

Commit

Permalink
schemas: added new schema types (CERNDocumentServer#227)
Browse files Browse the repository at this point in the history
* series
* keyword
* eitem
* added files attributes
  • Loading branch information
kpsherva committed Jul 17, 2019
1 parent ba638cf commit 537270c
Show file tree
Hide file tree
Showing 19 changed files with 522 additions and 228 deletions.
7 changes: 4 additions & 3 deletions cds_dojson/marc21/models/books/multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CDSMultipart(CDSOverdoBookBase):
'697C_:LEGSERLIB OR 697C_:"ENGLISH BOOK CLUB" -980__:DELETED)'\
'AND 246__:/[a-zA-Z0-9]+/ '

__schema__ = 'records/books/book/series-v.0.0.1.json'
__schema__ = 'https://127.0.0.1:5000/schemas/series/series-v1.0.0.json'

__model_ignore_keys__ = {
'505__a',
Expand All @@ -54,11 +54,12 @@ def do(self, blob, ignore_missing=True, exception_handlers=None):
blob=blob,
ignore_missing=ignore_missing,
exception_handlers=exception_handlers)
json['$schema'] = {'$ref': self.__class__.__schema__}
json['$schema'] = self.__class__.__schema__

json['_record_type'] = 'multipart'
return json


model = CDSMultipart(
bases=(books_base, cds_base, ),
bases=(cds_base, ),
entry_point_group='cds_dojson.marc21.series')
4 changes: 2 additions & 2 deletions cds_dojson/marc21/models/books/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CDSSerial(CDSOverdoBookBase):
'697C_:LEGSERLIB OR 697C_:"ENGLISH BOOK CLUB" -980__:DELETED)' \
' AND 490__:/[a-zA-Z0-9]+/'

__schema__ = 'records/books/book/series-v.0.0.1.json'
__schema__ = 'https://127.0.0.1:5000/schemas/series/series-v1.0.0.json'

__model_ignore_keys__ = {
'020__a',
Expand Down Expand Up @@ -206,7 +206,7 @@ def do(self, blob, ignore_missing=True, exception_handlers=None):
blob=blob,
ignore_missing=ignore_missing,
exception_handlers=exception_handlers)
json['$schema'] = {'$ref': self.__class__.__schema__}
json['$schema'] = self.__class__.__schema__
json['_record_type'] = 'serial'
return json

Expand Down
33 changes: 2 additions & 31 deletions cds_dojson/schemas/records/books/book/base-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"type": "array",
"uniqueItems": true
},
"_private_notes": {
"internal_notes": {
"description": ":MARC: ``595``\nVisible for librarians",
"items": {
"$ref": "elements/sourced_value.json"
Expand Down Expand Up @@ -319,37 +319,8 @@
"uniqueItems": true
},
"keywords": {
"description": ":MARC: ```6531`` and ``695`` (corresponding to different\n :ref:`keywords/items/properties/schema`)\nKeywords give information about the specific contents of the\nrecord, much more precisely than :ref:`inspire_categories`.",
"items": {
"additionalProperties": false,
"properties": {
"schema": {
"description": "Describes to which vocabulary the keyword in :ref:`value`\nbelongs.\n``INIS``\n :MARC: ``695__2:INIS``\n The keyword is part of the `International\n Nuclear Information System (INIS)\n <https://www.iaea.org/inis/>`_ vocabulary.\n``INSPIRE``\n :MARC: ``695__2:INSPIRE``\n The keyword has been assigned by Inspire, and\n belongs to its vocabulary.\n``JACOW``\n :MARC: ``6531_2:JACOW``\n The keyword is part of the `Joint Accelerator\n Conference Website (JACoW) vocabulary\n <http://jacow.org/Tools/Keywords>`_.\n``PACS``\n :MARC: ``084__2:PACS``\n The keyword is a number from the `Physics and\n Astronomy Classification Scheme (PACS)\n <https://publishing.aip.org/publishing/pacs/pacs-2010-regular-edition>`_.\n``PDG``\n :MARC: ``084__2:PDG``\n The keyword is a `PDG Indentifier\n <http://pdg.lbl.gov/2016/pdgid/PDGIdentifiers.html>`_.\n.. note::\n If not present, the keyword is a free-form keyword,\n not necessarily part of any vocabulary.",
"enum": [
"INIS",
"INSPIRE",
"JACOW",
"PACS",
"PDG"
],
"minLength": 1,
"title": "Keyword vocabulary",
"type": "string"
},
"provenance": {
"$ref": "elements/source.json"
},
"value": {
"description": ":MARC: ``084/6531/695__a`` (depending on :ref:`schema`)\nIt belongs to the vocabulary specified by :ref:`schema`.\n:example: ``black hole: mass`` (for :ref:`schema` =\n ``INSPIRE``)\n:example: ``29.27.Fh`` (for :ref:`schema` = ``PACS``)\n:example: ``G033M`` (for :ref:`schema` = ``PDG``)",
"minLength": 1,
"title": "A keyword",
"type": "string"
}
},
"required": [
"value"
],
"type": "object"
"$ref": "keyword-v0.0.1.json"
},
"minItems": 1,
"title": "List of keywords",
Expand Down
73 changes: 37 additions & 36 deletions cds_dojson/schemas/records/books/book/document-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"type": "array",
"uniqueItems": true
},
"_private_notes": {
"internal_notes": {
"description": ":MARC: ``595``\nVisible for librarians",
"items": {
"additionalProperties": false,
Expand Down Expand Up @@ -884,30 +884,17 @@
"uniqueItems": true
},
"keywords": {
"description": ":MARC: ```6531`` and ``695`` (corresponding to different\n :ref:`keywords/items/properties/schema`)\nKeywords give information about the specific contents of the\nrecord, much more precisely than :ref:`inspire_categories`.",
"items": {
"$schema": "http://json-schema.org/schema#",
"additionalProperties": false,
"description": ":MARC: ```6531`` and ``695``",
"properties": {
"schema": {
"description": "Describes to which vocabulary the keyword in :ref:`value`\nbelongs.\n``INIS``\n :MARC: ``695__2:INIS``\n The keyword is part of the `International\n Nuclear Information System (INIS)\n <https://www.iaea.org/inis/>`_ vocabulary.\n``INSPIRE``\n :MARC: ``695__2:INSPIRE``\n The keyword has been assigned by Inspire, and\n belongs to its vocabulary.\n``JACOW``\n :MARC: ``6531_2:JACOW``\n The keyword is part of the `Joint Accelerator\n Conference Website (JACoW) vocabulary\n <http://jacow.org/Tools/Keywords>`_.\n``PACS``\n :MARC: ``084__2:PACS``\n The keyword is a number from the `Physics and\n Astronomy Classification Scheme (PACS)\n <https://publishing.aip.org/publishing/pacs/pacs-2010-regular-edition>`_.\n``PDG``\n :MARC: ``084__2:PDG``\n The keyword is a `PDG Indentifier\n <http://pdg.lbl.gov/2016/pdgid/PDGIdentifiers.html>`_.\n.. note::\n If not present, the keyword is a free-form keyword,\n not necessarily part of any vocabulary.",
"enum": [
"INIS",
"INSPIRE",
"JACOW",
"PACS",
"PDG"
],
"minLength": 1,
"title": "Keyword vocabulary",
"type": "string"
},
"provenance": {
"description": "Decision making factor, keeps provenance of fields.\n:MARC: Often not present.",
"minLength": 1,
"type": "string"
},
"value": {
"description": ":MARC: ``084/6531/695__a`` (depending on :ref:`schema`)\nIt belongs to the vocabulary specified by :ref:`schema`.\n:example: ``black hole: mass`` (for :ref:`schema` =\n ``INSPIRE``)\n:example: ``29.27.Fh`` (for :ref:`schema` = ``PACS``)\n:example: ``G033M`` (for :ref:`schema` = ``PDG``)",
"minLength": 1,
"title": "A keyword",
"type": "string"
Expand All @@ -916,6 +903,7 @@
"required": [
"value"
],
"title": "Keyword",
"type": "object"
},
"minItems": 1,
Expand Down Expand Up @@ -1893,33 +1881,52 @@
"uniqueItems": true
},
"book_series": {
"description": ":MARC: ``490``\nList of book series in which this record has been published.\n.. note::\n This field should only be present if ``book``, ``thesis`` or\n ``proceedings`` are among\n :ref:`hep.json#/properties/document_type`.",
"description": ":MARC: ``490`` List of book series in which this record has been published.",
"items": {
"$schema": "http://json-schema.org/schema#",
"additionalProperties": false,
"description": ".. note::\n If the book series has a Journal record,\n `hep.json#/properties/publication_info` should be used\n instead.",
"description": "Entity to group documents in series",
"properties": {
"issn": {
"description": ":MARC: ``490__x``\n.. note: Does not exist in Inspire",
"minLength": 1,
"title": "ISSN of the series",
"type": "string"
},
"title": {
"description": ":MARC: ``490__a``",
"minLength": 1,
"title": "Title of the book series",
"mode_of_issuance": {
"enum": [
"serial",
"multipart_monograph"
],
"type": "string"
},
"volume": {
"description": ":MARC: ``490__v``",
"minLength": 1,
"title": "Volume of the book in the series",
"type": "string"
"number_of_volumes": {
"type": "integer"
},
"title": {
"title": "Document title",
"additionalProperties": false,
"properties": {
"source": {
"minLength": 1,
"type": "string"
},
"subtitle": {
"minLength": 1,
"type": "string"
},
"title": {
"minLength": 1,
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
}
},
"required": [
"title"
],
"title": "Physical copy of a document",
"type": "object"
},
"minItems": 1,
Expand Down Expand Up @@ -2294,12 +2301,6 @@
"title": "List of keywords",
"type": "array",
"uniqueItems": true
},
"volume": {
"description": ":MARC: ``246__n``",
"minItems": 1,
"title": "Volume number",
"type": "string"
}
},
"required": [
Expand Down
41 changes: 8 additions & 33 deletions cds_dojson/schemas/records/books/book/document_src-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,34 +91,15 @@
"uniqueItems": true
},
"book_series": {
"description": ":MARC: ``490``\nList of book series in which this record has been published.\n.. note::\n This field should only be present if ``book``, ``thesis`` or\n ``proceedings`` are among\n :ref:`hep.json#/properties/document_type`.",
"description": ":MARC: ``490`` List of book series in which this record has been published.",
"items": {
"additionalProperties": false,
"description": ".. note::\n If the book series has a Journal record,\n `hep.json#/properties/publication_info` should be used\n instead.",
"properties": {
"issn": {
"description": ":MARC: ``490__x``\n.. note: Does not exist in Inspire",
"minLength": 1,
"title": "ISSN of the series",
"type": "string"
},
"title": {
"description": ":MARC: ``490__a``",
"minLength": 1,
"title": "Title of the book series",
"type": "string"
},
"volume": {
"description": ":MARC: ``490__v``",
"minLength": 1,
"title": "Volume of the book in the series",
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
"$ref": "series-v.0.0.1.json",
"volume": {
"description": ":MARC: ``490__v``",
"minLength": 1,
"title": "Volume of the book in the series",
"type": "string"
}
},
"minItems": 1,
"type": "array",
Expand Down Expand Up @@ -462,12 +443,6 @@
"title": "List of keywords",
"type": "array",
"uniqueItems": true
},
"volume": {
"description": ":MARC: ``246__n``",
"minItems": 1,
"title": "Volume number",
"type": "string"
}
}
}
Expand Down
86 changes: 86 additions & 0 deletions cds_dojson/schemas/records/books/book/eitem-v0.0.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"$schema": "http://json-schema.org/schema#",
"additionalProperties": false,
"description": "Data model for the electronic items of the books, proceedings, standards CDS.",
"properties": {
"$schema": {
"format": "uri",
"minLength": 1,
"type": "string"
},
"internal_notes": {
"minLength": 1,
"title": "Internal Note",
"type": "string"
},
"description": {
"description": ":MARC: 0247__q or 8564_y",
"minLength": 1,
"title": "EItem description",
"type": "string"
},
"dois": {
"items": {
"additionalProperties": false,
"properties": {
"material": {
"$ref": "elements/material.json",
"description": ":MARC: 0247_q"
},
"source": {
"$ref": "elements/source.json",
"description": ":MARC: 0247_9"
},
"value": {
"description": "':MARC: 0247_a\n:example: 10.1023/A:1026654312961'",
"minLength": 1,
"pattern": "^10\\.\\d+(\\.\\d+)?/\\S+$",
"title": "DOI",
"type": "string"
}
},
"required": [
"value"
],
"type": "object"
},
"minItems": 1,
"title": "List of DOIs",
"type": "array",
"uniqueItems": true
},
"files": {
"items": {
"$ref": "elements/file.json"
},
"minItems": 1,
"title": "List of files",
"type": "array"
},
"number_of_pages": {
"description": ":MARC: ``300``",
"minimum": 1,
"title": "Number of pages of the EItem",
"type": "integer"
},
"public_note": {
"minLength": 1,
"title": "Public Note",
"type": "string"
},
"urls": {
"description": ":MARC: ``8564``\nURLs to external resources related to this record.\n.. note::\n Links to internal CDS resources are found in another element.",
"items": {
"$ref": "elements/url.json"
},
"minItems": 1,
"type": "array",
"uniqueItems": true
},
"open_access": {
"description": "Define if the electronic item is publically accessible.",
"title": "Public access",
"type": "boolean"
}
}
}
31 changes: 31 additions & 0 deletions cds_dojson/schemas/records/books/book/elements/file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"file": {
"description": "A file object described using some basic subfields. (Usually to be extended)",
"type": "object,",
"properties": {
"bucket": {
"type": "string"
},
"checksum": {
"type": "string"
},
"key": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"description": "File type extension.",
"type": "string"
},
"category": {
"description": "Former BibDocFile.doctype",
"type": "string"
},
"version_id": {
"type": "string"
}
}
}
}
Loading

0 comments on commit 537270c

Please sign in to comment.