invenio-vocabularies 9.1.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- invenio_vocabularies/__init__.py +16 -0
- invenio_vocabularies/administration/__init__.py +10 -0
- invenio_vocabularies/administration/views/__init__.py +10 -0
- invenio_vocabularies/administration/views/vocabularies.py +43 -0
- invenio_vocabularies/alembic/17c703ce1eb7_create_names_table.py +54 -0
- invenio_vocabularies/alembic/3ba812d80559_add_internal_name_id.py +36 -0
- invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py +37 -0
- invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py +92 -0
- invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py +96 -0
- invenio_vocabularies/alembic/6312f33645c1_create_affiliations_table.py +54 -0
- invenio_vocabularies/alembic/676dd587542d_create_funders_vocabulary_table.py +58 -0
- invenio_vocabularies/alembic/8ff82dfb0be8_create_vocabularies_branch.py +28 -0
- invenio_vocabularies/alembic/__init__.py +9 -0
- invenio_vocabularies/alembic/af2457652217_drop_unique_constraint_from_internal_id.py +37 -0
- invenio_vocabularies/alembic/e1146238edd3_create_awards_table.py +56 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.eslintrc.yml +11 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.prettierrc +1 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/package.json +25 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/AwardResults.js +95 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +139 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FunderDropdown.js +87 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +244 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.test.js +1 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingFieldItem.js +152 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingModal.js +246 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/NoAwardResults.js +37 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/index.js +8 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next.js +36 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/_generatedTranslations.js +66 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ar/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ar/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/bg/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/bg/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ca/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ca/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/cs/messages.po +97 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/cs/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/da/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/da/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/de/messages.po +98 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/de/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/el/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/el/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/en/messages.po +88 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/en/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/es/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/es/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/et/messages.po +95 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/et/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fa/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fa/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fr/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fr/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hr/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hr/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hu/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hu/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/index.js +24 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/it/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/it/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ja/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ja/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ka/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ka/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ko/messages.po +90 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ko/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/lt/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/lt/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/no/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/no/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pl/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pl/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pt/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pt/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ro/messages.po +95 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ro/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ru/messages.po +95 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ru/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sk/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sk/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sv/messages.po +98 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sv/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/tr/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/tr/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/uk/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/uk/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_CN/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_CN/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_TW/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_TW/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/package.json +19 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/translations.pot +88 -0
- invenio_vocabularies/cli.py +175 -0
- invenio_vocabularies/config.py +231 -0
- invenio_vocabularies/contrib/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/__init__.py +20 -0
- invenio_vocabularies/contrib/affiliations/affiliations.py +61 -0
- invenio_vocabularies/contrib/affiliations/api.py +13 -0
- invenio_vocabularies/contrib/affiliations/config.py +79 -0
- invenio_vocabularies/contrib/affiliations/datastreams.py +301 -0
- invenio_vocabularies/contrib/affiliations/facets.py +36 -0
- invenio_vocabularies/contrib/affiliations/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +63 -0
- invenio_vocabularies/contrib/affiliations/mappings/__init__.py +10 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +112 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v2.0.0.json +171 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +112 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v2.0.0.json +171 -0
- invenio_vocabularies/contrib/affiliations/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +112 -0
- invenio_vocabularies/contrib/affiliations/models.py +13 -0
- invenio_vocabularies/contrib/affiliations/resources.py +16 -0
- invenio_vocabularies/contrib/affiliations/schema.py +71 -0
- invenio_vocabularies/contrib/affiliations/services.py +15 -0
- invenio_vocabularies/contrib/awards/__init__.py +19 -0
- invenio_vocabularies/contrib/awards/api.py +13 -0
- invenio_vocabularies/contrib/awards/awards.py +96 -0
- invenio_vocabularies/contrib/awards/config.py +59 -0
- invenio_vocabularies/contrib/awards/datastreams.py +372 -0
- invenio_vocabularies/contrib/awards/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +91 -0
- invenio_vocabularies/contrib/awards/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +147 -0
- invenio_vocabularies/contrib/awards/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +147 -0
- invenio_vocabularies/contrib/awards/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +147 -0
- invenio_vocabularies/contrib/awards/models.py +13 -0
- invenio_vocabularies/contrib/awards/resources.py +16 -0
- invenio_vocabularies/contrib/awards/schema.py +119 -0
- invenio_vocabularies/contrib/awards/serializer.py +47 -0
- invenio_vocabularies/contrib/awards/services.py +15 -0
- invenio_vocabularies/contrib/common/__init__.py +9 -0
- invenio_vocabularies/contrib/common/openaire/__init__.py +9 -0
- invenio_vocabularies/contrib/common/openaire/datastreams.py +84 -0
- invenio_vocabularies/contrib/common/ror/__init__.py +9 -0
- invenio_vocabularies/contrib/common/ror/datastreams.py +230 -0
- invenio_vocabularies/contrib/funders/__init__.py +19 -0
- invenio_vocabularies/contrib/funders/api.py +13 -0
- invenio_vocabularies/contrib/funders/config.py +78 -0
- invenio_vocabularies/contrib/funders/datastreams.py +97 -0
- invenio_vocabularies/contrib/funders/facets.py +36 -0
- invenio_vocabularies/contrib/funders/funders.py +72 -0
- invenio_vocabularies/contrib/funders/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +65 -0
- invenio_vocabularies/contrib/funders/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +90 -0
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json +156 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +90 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json +156 -0
- invenio_vocabularies/contrib/funders/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +90 -0
- invenio_vocabularies/contrib/funders/models.py +13 -0
- invenio_vocabularies/contrib/funders/resources.py +16 -0
- invenio_vocabularies/contrib/funders/schema.py +88 -0
- invenio_vocabularies/contrib/funders/serializer.py +33 -0
- invenio_vocabularies/contrib/funders/services.py +15 -0
- invenio_vocabularies/contrib/names/__init__.py +19 -0
- invenio_vocabularies/contrib/names/api.py +13 -0
- invenio_vocabularies/contrib/names/components.py +24 -0
- invenio_vocabularies/contrib/names/config.py +75 -0
- invenio_vocabularies/contrib/names/datastreams.py +483 -0
- invenio_vocabularies/contrib/names/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +68 -0
- invenio_vocabularies/contrib/names/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +101 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v2.0.0.json +165 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +101 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v2.0.0.json +165 -0
- invenio_vocabularies/contrib/names/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +101 -0
- invenio_vocabularies/contrib/names/models.py +13 -0
- invenio_vocabularies/contrib/names/names.py +80 -0
- invenio_vocabularies/contrib/names/permissions.py +30 -0
- invenio_vocabularies/contrib/names/resources.py +54 -0
- invenio_vocabularies/contrib/names/s3client.py +50 -0
- invenio_vocabularies/contrib/names/schema.py +121 -0
- invenio_vocabularies/contrib/names/services.py +64 -0
- invenio_vocabularies/contrib/subjects/__init__.py +22 -0
- invenio_vocabularies/contrib/subjects/api.py +14 -0
- invenio_vocabularies/contrib/subjects/config.py +90 -0
- invenio_vocabularies/contrib/subjects/datastreams.py +63 -0
- invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/euroscivoc/datastreams.py +101 -0
- invenio_vocabularies/contrib/subjects/facets.py +23 -0
- invenio_vocabularies/contrib/subjects/gemet/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/gemet/datastreams.py +140 -0
- invenio_vocabularies/contrib/subjects/jsonschemas/__init__.py +10 -0
- invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +69 -0
- invenio_vocabularies/contrib/subjects/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +96 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +96 -0
- invenio_vocabularies/contrib/subjects/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +96 -0
- invenio_vocabularies/contrib/subjects/mesh/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mesh/datastreams.py +48 -0
- invenio_vocabularies/contrib/subjects/models.py +14 -0
- invenio_vocabularies/contrib/subjects/nvs/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/nvs/datastreams.py +114 -0
- invenio_vocabularies/contrib/subjects/resources.py +17 -0
- invenio_vocabularies/contrib/subjects/schema.py +101 -0
- invenio_vocabularies/contrib/subjects/services.py +30 -0
- invenio_vocabularies/contrib/subjects/subjects.py +55 -0
- invenio_vocabularies/datastreams/__init__.py +18 -0
- invenio_vocabularies/datastreams/datastreams.py +239 -0
- invenio_vocabularies/datastreams/errors.py +29 -0
- invenio_vocabularies/datastreams/factories.py +86 -0
- invenio_vocabularies/datastreams/readers.py +448 -0
- invenio_vocabularies/datastreams/tasks.py +115 -0
- invenio_vocabularies/datastreams/transformers.py +130 -0
- invenio_vocabularies/datastreams/writers.py +222 -0
- invenio_vocabularies/datastreams/xml.py +34 -0
- invenio_vocabularies/ext.py +179 -0
- invenio_vocabularies/factories.py +193 -0
- invenio_vocabularies/fixtures.py +52 -0
- invenio_vocabularies/jobs.py +207 -0
- invenio_vocabularies/proxies.py +27 -0
- invenio_vocabularies/records/__init__.py +9 -0
- invenio_vocabularies/records/api.py +53 -0
- invenio_vocabularies/records/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +30 -0
- invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +55 -0
- invenio_vocabularies/records/mappings/__init__.py +9 -0
- invenio_vocabularies/records/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/records/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +109 -0
- invenio_vocabularies/records/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/records/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +109 -0
- invenio_vocabularies/records/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/records/mappings/v7/vocabularies/vocabulary-v1.0.0.json +109 -0
- invenio_vocabularies/records/models.py +90 -0
- invenio_vocabularies/records/pidprovider.py +118 -0
- invenio_vocabularies/records/systemfields/__init__.py +16 -0
- invenio_vocabularies/records/systemfields/pid.py +125 -0
- invenio_vocabularies/records/systemfields/relations.py +51 -0
- invenio_vocabularies/resources/__init__.py +23 -0
- invenio_vocabularies/resources/config.py +105 -0
- invenio_vocabularies/resources/resource.py +156 -0
- invenio_vocabularies/resources/schema.py +21 -0
- invenio_vocabularies/resources/serializer.py +39 -0
- invenio_vocabularies/services/__init__.py +19 -0
- invenio_vocabularies/services/components.py +58 -0
- invenio_vocabularies/services/config.py +173 -0
- invenio_vocabularies/services/custom_fields/__init__.py +17 -0
- invenio_vocabularies/services/custom_fields/subject.py +82 -0
- invenio_vocabularies/services/custom_fields/vocabulary.py +96 -0
- invenio_vocabularies/services/facets.py +114 -0
- invenio_vocabularies/services/generators.py +38 -0
- invenio_vocabularies/services/permissions.py +30 -0
- invenio_vocabularies/services/querystr.py +57 -0
- invenio_vocabularies/services/results.py +110 -0
- invenio_vocabularies/services/schema.py +163 -0
- invenio_vocabularies/services/service.py +189 -0
- invenio_vocabularies/services/tasks.py +38 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/subjects.html +23 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabularies-list.html +12 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabulary-details.html +71 -0
- invenio_vocabularies/translations/ar/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ar/LC_MESSAGES/messages.po +277 -0
- invenio_vocabularies/translations/bg/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/bg/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ca/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ca/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/cs/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/cs/LC_MESSAGES/messages.po +281 -0
- invenio_vocabularies/translations/da/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/da/LC_MESSAGES/messages.po +271 -0
- invenio_vocabularies/translations/de/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/de/LC_MESSAGES/messages.po +293 -0
- invenio_vocabularies/translations/el/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/el/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/es/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/es/LC_MESSAGES/messages.po +281 -0
- invenio_vocabularies/translations/et/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/et/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/fa/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fa/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/fr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fr/LC_MESSAGES/messages.po +279 -0
- invenio_vocabularies/translations/hr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hr/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/hu/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hu/LC_MESSAGES/messages.po +280 -0
- invenio_vocabularies/translations/it/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/it/LC_MESSAGES/messages.po +277 -0
- invenio_vocabularies/translations/ja/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ja/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ka/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ka/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ko/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ko/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/lt/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/lt/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/messages.pot +270 -0
- invenio_vocabularies/translations/no/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/no/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/pl/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/pl/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/pt/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/pt/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ro/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ro/LC_MESSAGES/messages.po +280 -0
- invenio_vocabularies/translations/ru/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ru/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/sk/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sk/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/sv/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sv/LC_MESSAGES/messages.po +280 -0
- invenio_vocabularies/translations/tr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/tr/LC_MESSAGES/messages.po +277 -0
- invenio_vocabularies/translations/uk/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/uk/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/views.py +53 -0
- invenio_vocabularies/webpack.py +51 -0
- invenio_vocabularies-9.1.2.dist-info/METADATA +517 -0
- invenio_vocabularies-9.1.2.dist-info/RECORD +337 -0
- invenio_vocabularies-9.1.2.dist-info/WHEEL +6 -0
- invenio_vocabularies-9.1.2.dist-info/entry_points.txt +73 -0
- invenio_vocabularies-9.1.2.dist-info/licenses/AUTHORS.rst +13 -0
- invenio_vocabularies-9.1.2.dist-info/licenses/LICENSE +21 -0
- invenio_vocabularies-9.1.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": {
|
|
3
|
+
"dynamic_templates": [
|
|
4
|
+
{
|
|
5
|
+
"i18n_title": {
|
|
6
|
+
"path_match": "title.*",
|
|
7
|
+
"match_mapping_type": "string",
|
|
8
|
+
"mapping": {
|
|
9
|
+
"type": "search_as_you_type"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, {
|
|
13
|
+
"i18n_description": {
|
|
14
|
+
"path_match": "description.*",
|
|
15
|
+
"match_mapping_type": "string",
|
|
16
|
+
"mapping": {
|
|
17
|
+
"type": "text"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"dynamic": "strict",
|
|
23
|
+
"properties": {
|
|
24
|
+
"$schema": {
|
|
25
|
+
"type": "keyword",
|
|
26
|
+
"index": "false"
|
|
27
|
+
},
|
|
28
|
+
"created": {
|
|
29
|
+
"type": "date"
|
|
30
|
+
},
|
|
31
|
+
"updated": {
|
|
32
|
+
"type": "date"
|
|
33
|
+
},
|
|
34
|
+
"indexed_at": {
|
|
35
|
+
"type": "date"
|
|
36
|
+
},
|
|
37
|
+
"uuid": {
|
|
38
|
+
"type": "keyword"
|
|
39
|
+
},
|
|
40
|
+
"version_id": {
|
|
41
|
+
"type": "integer"
|
|
42
|
+
},
|
|
43
|
+
"id": {
|
|
44
|
+
"type": "keyword",
|
|
45
|
+
"fields": {
|
|
46
|
+
"text": {
|
|
47
|
+
"type": "search_as_you_type"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"type": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"pid_type": {
|
|
55
|
+
"type": "keyword"
|
|
56
|
+
},
|
|
57
|
+
"id": {
|
|
58
|
+
"type": "keyword"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"pid": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"pk": {
|
|
66
|
+
"type": "integer"
|
|
67
|
+
},
|
|
68
|
+
"pid_type": {
|
|
69
|
+
"type": "keyword"
|
|
70
|
+
},
|
|
71
|
+
"obj_type": {
|
|
72
|
+
"type": "keyword"
|
|
73
|
+
},
|
|
74
|
+
"status": {
|
|
75
|
+
"type": "keyword"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"title_sort": {
|
|
80
|
+
"type": "keyword"
|
|
81
|
+
},
|
|
82
|
+
"title": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"dynamic": "true",
|
|
85
|
+
"properties": {
|
|
86
|
+
"en": {
|
|
87
|
+
"type": "search_as_you_type",
|
|
88
|
+
"copy_to": "title_sort"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"description": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"dynamic": "true"
|
|
95
|
+
},
|
|
96
|
+
"icon": {
|
|
97
|
+
"type": "keyword",
|
|
98
|
+
"index": "false"
|
|
99
|
+
},
|
|
100
|
+
"tags": {
|
|
101
|
+
"type": "keyword"
|
|
102
|
+
},
|
|
103
|
+
"props": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"dynamic": "true"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": {
|
|
3
|
+
"dynamic_templates": [
|
|
4
|
+
{
|
|
5
|
+
"i18n_title": {
|
|
6
|
+
"path_match": "title.*",
|
|
7
|
+
"match_mapping_type": "string",
|
|
8
|
+
"mapping": {
|
|
9
|
+
"type": "search_as_you_type"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, {
|
|
13
|
+
"i18n_description": {
|
|
14
|
+
"path_match": "description.*",
|
|
15
|
+
"match_mapping_type": "string",
|
|
16
|
+
"mapping": {
|
|
17
|
+
"type": "text"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"dynamic": "strict",
|
|
23
|
+
"properties": {
|
|
24
|
+
"$schema": {
|
|
25
|
+
"type": "keyword",
|
|
26
|
+
"index": "false"
|
|
27
|
+
},
|
|
28
|
+
"created": {
|
|
29
|
+
"type": "date"
|
|
30
|
+
},
|
|
31
|
+
"updated": {
|
|
32
|
+
"type": "date"
|
|
33
|
+
},
|
|
34
|
+
"indexed_at": {
|
|
35
|
+
"type": "date"
|
|
36
|
+
},
|
|
37
|
+
"uuid": {
|
|
38
|
+
"type": "keyword"
|
|
39
|
+
},
|
|
40
|
+
"version_id": {
|
|
41
|
+
"type": "integer"
|
|
42
|
+
},
|
|
43
|
+
"id": {
|
|
44
|
+
"type": "keyword",
|
|
45
|
+
"fields": {
|
|
46
|
+
"text": {
|
|
47
|
+
"type": "search_as_you_type"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"type": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"pid_type": {
|
|
55
|
+
"type": "keyword"
|
|
56
|
+
},
|
|
57
|
+
"id": {
|
|
58
|
+
"type": "keyword"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"pid": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"pk": {
|
|
66
|
+
"type": "integer"
|
|
67
|
+
},
|
|
68
|
+
"pid_type": {
|
|
69
|
+
"type": "keyword"
|
|
70
|
+
},
|
|
71
|
+
"obj_type": {
|
|
72
|
+
"type": "keyword"
|
|
73
|
+
},
|
|
74
|
+
"status": {
|
|
75
|
+
"type": "keyword"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"title_sort": {
|
|
80
|
+
"type": "keyword"
|
|
81
|
+
},
|
|
82
|
+
"title": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"dynamic": "true",
|
|
85
|
+
"properties": {
|
|
86
|
+
"en": {
|
|
87
|
+
"type": "search_as_you_type",
|
|
88
|
+
"copy_to": "title_sort"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"description": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"dynamic": "true"
|
|
95
|
+
},
|
|
96
|
+
"icon": {
|
|
97
|
+
"type": "keyword",
|
|
98
|
+
"index": "false"
|
|
99
|
+
},
|
|
100
|
+
"tags": {
|
|
101
|
+
"type": "keyword"
|
|
102
|
+
},
|
|
103
|
+
"props": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"dynamic": "true"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2020-2021 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
"""Elasticsearch version 7 mappings."""
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": {
|
|
3
|
+
"dynamic_templates": [
|
|
4
|
+
{
|
|
5
|
+
"i18n_title": {
|
|
6
|
+
"path_match": "title.*",
|
|
7
|
+
"match_mapping_type": "string",
|
|
8
|
+
"mapping": {
|
|
9
|
+
"type": "search_as_you_type"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, {
|
|
13
|
+
"i18n_description": {
|
|
14
|
+
"path_match": "description.*",
|
|
15
|
+
"match_mapping_type": "string",
|
|
16
|
+
"mapping": {
|
|
17
|
+
"type": "text"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"dynamic": "strict",
|
|
23
|
+
"properties": {
|
|
24
|
+
"$schema": {
|
|
25
|
+
"type": "keyword",
|
|
26
|
+
"index": "false"
|
|
27
|
+
},
|
|
28
|
+
"created": {
|
|
29
|
+
"type": "date"
|
|
30
|
+
},
|
|
31
|
+
"updated": {
|
|
32
|
+
"type": "date"
|
|
33
|
+
},
|
|
34
|
+
"indexed_at": {
|
|
35
|
+
"type": "date"
|
|
36
|
+
},
|
|
37
|
+
"uuid": {
|
|
38
|
+
"type": "keyword"
|
|
39
|
+
},
|
|
40
|
+
"version_id": {
|
|
41
|
+
"type": "integer"
|
|
42
|
+
},
|
|
43
|
+
"id": {
|
|
44
|
+
"type": "keyword",
|
|
45
|
+
"fields": {
|
|
46
|
+
"text": {
|
|
47
|
+
"type": "search_as_you_type"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"type": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"pid_type": {
|
|
55
|
+
"type": "keyword"
|
|
56
|
+
},
|
|
57
|
+
"id": {
|
|
58
|
+
"type": "keyword"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"pid": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"pk": {
|
|
66
|
+
"type": "integer"
|
|
67
|
+
},
|
|
68
|
+
"pid_type": {
|
|
69
|
+
"type": "keyword"
|
|
70
|
+
},
|
|
71
|
+
"obj_type": {
|
|
72
|
+
"type": "keyword"
|
|
73
|
+
},
|
|
74
|
+
"status": {
|
|
75
|
+
"type": "keyword"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"title_sort": {
|
|
80
|
+
"type": "keyword"
|
|
81
|
+
},
|
|
82
|
+
"title": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"dynamic": "true",
|
|
85
|
+
"properties": {
|
|
86
|
+
"en": {
|
|
87
|
+
"type": "search_as_you_type",
|
|
88
|
+
"copy_to": "title_sort"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"description": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"dynamic": "true"
|
|
95
|
+
},
|
|
96
|
+
"icon": {
|
|
97
|
+
"type": "keyword",
|
|
98
|
+
"index": "false"
|
|
99
|
+
},
|
|
100
|
+
"tags": {
|
|
101
|
+
"type": "keyword"
|
|
102
|
+
},
|
|
103
|
+
"props": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"dynamic": "true"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2020-2024 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
"""Vocabulary models."""
|
|
10
|
+
|
|
11
|
+
from invenio_db import db
|
|
12
|
+
from invenio_i18n import gettext as _
|
|
13
|
+
from invenio_records.models import RecordMetadataBase
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class VocabularyType(db.Model):
|
|
17
|
+
"""Vocabulary type model."""
|
|
18
|
+
|
|
19
|
+
__tablename__ = "vocabularies_types"
|
|
20
|
+
|
|
21
|
+
id = db.Column(db.String(255), primary_key=True)
|
|
22
|
+
pid_type = db.Column(db.String(255), unique=True)
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def create(cls, **data):
|
|
26
|
+
"""Create a new vocabulary type."""
|
|
27
|
+
with db.session.begin_nested():
|
|
28
|
+
obj = cls(**data)
|
|
29
|
+
db.session.add(obj)
|
|
30
|
+
return obj
|
|
31
|
+
|
|
32
|
+
@classmethod
|
|
33
|
+
def dump_obj(cls, field, record, obj):
|
|
34
|
+
"""Serializer the object into a record."""
|
|
35
|
+
record[field.attr_name] = {
|
|
36
|
+
"id": obj.id,
|
|
37
|
+
"pid_type": obj.pid_type,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def load_obj(cls, field, record):
|
|
42
|
+
"""Deserializer the object from a record."""
|
|
43
|
+
data = record.get(field.attr_name)
|
|
44
|
+
if data:
|
|
45
|
+
obj = cls(
|
|
46
|
+
id=data.get("id"),
|
|
47
|
+
pid_type=data.get("pid_type"),
|
|
48
|
+
)
|
|
49
|
+
return obj
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class VocabularyMetadata(db.Model, RecordMetadataBase):
|
|
54
|
+
"""Model for vocabulary metadata."""
|
|
55
|
+
|
|
56
|
+
__tablename__ = "vocabularies_metadata"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class VocabularyScheme(db.Model):
|
|
60
|
+
"""Vocabulary scheme model.
|
|
61
|
+
|
|
62
|
+
This table stores the metadata for schemes (subtypes) of VocabularyType
|
|
63
|
+
or separate specific vocabularies.
|
|
64
|
+
|
|
65
|
+
It is only used to store metadata for subject schemes for now.
|
|
66
|
+
But we might store affiliations's schemes or other schemes later.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
__tablename__ = "vocabularies_schemes"
|
|
70
|
+
|
|
71
|
+
id = db.Column(db.String(255), primary_key=True)
|
|
72
|
+
# This is e.g. `subjects`, 'affiliations', ...
|
|
73
|
+
parent_id = db.Column(db.String(255), primary_key=True)
|
|
74
|
+
name = db.Column(db.String(255))
|
|
75
|
+
uri = db.Column(db.String(255))
|
|
76
|
+
# Any extra metadata is added as columns.
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def create(cls, **data):
|
|
80
|
+
"""Create a new vocabulary subtype."""
|
|
81
|
+
banned = [",", ":"]
|
|
82
|
+
for b in banned:
|
|
83
|
+
assert b not in data["id"], _(
|
|
84
|
+
"No '%(banned_char)s' allowed in VocabularyScheme.id", banned_char=b
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
with db.session.begin_nested():
|
|
88
|
+
obj = cls(**data)
|
|
89
|
+
db.session.add(obj)
|
|
90
|
+
return obj
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2021-2024 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
"""Persistent identifier provider for vocabularies."""
|
|
10
|
+
|
|
11
|
+
from invenio_pidstore.models import PIDStatus
|
|
12
|
+
from invenio_pidstore.providers.base import BaseProvider
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class VocabularyIdProvider(BaseProvider):
|
|
16
|
+
"""Vocabulary identifier provider.
|
|
17
|
+
|
|
18
|
+
This PID provider requires a Vocabulary record to be passed, and relies
|
|
19
|
+
on the vocabulary record having an 'id' key and a type defined.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def create(cls, object_type=None, object_uuid=None, record=None, **kwargs):
|
|
24
|
+
"""Create a new vocabulary identifier.
|
|
25
|
+
|
|
26
|
+
Relies on the a vocabulary record being
|
|
27
|
+
|
|
28
|
+
Note: if the object_type and object_uuid values are passed, then the
|
|
29
|
+
PID status will be automatically setted to
|
|
30
|
+
:attr:`invenio_pidstore.models.PIDStatus.REGISTERED`.
|
|
31
|
+
|
|
32
|
+
For more information about parameters,
|
|
33
|
+
see :meth:`invenio_pidstore.providers.base.BaseProvider.create`.
|
|
34
|
+
|
|
35
|
+
:param object_type: The object type. (Default: None.)
|
|
36
|
+
:param object_uuid: The object identifier. (Default: None).
|
|
37
|
+
:param record: A vocabulary record.
|
|
38
|
+
:param kwargs: Addtional options
|
|
39
|
+
:returns: A :class:`VocabularyIdProvider` instance.
|
|
40
|
+
"""
|
|
41
|
+
assert record is not None, "Missing or invalid 'record'."
|
|
42
|
+
assert "id" in record and isinstance(
|
|
43
|
+
record["id"], str
|
|
44
|
+
), "Missing 'id' key in record."
|
|
45
|
+
|
|
46
|
+
# Retrieve pid type from type.
|
|
47
|
+
pid_type = record.type.pid_type
|
|
48
|
+
# Retrieve pid value form record.
|
|
49
|
+
pid_value = record["id"]
|
|
50
|
+
|
|
51
|
+
# You must assign immediately.
|
|
52
|
+
assert object_uuid
|
|
53
|
+
assert object_type
|
|
54
|
+
|
|
55
|
+
return super().create(
|
|
56
|
+
pid_type=pid_type,
|
|
57
|
+
pid_value=pid_value,
|
|
58
|
+
object_type=object_type,
|
|
59
|
+
object_uuid=object_uuid,
|
|
60
|
+
status=PIDStatus.REGISTERED,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class CustomVocabularyPIDProvider(BaseProvider):
|
|
65
|
+
"""Affiliations PID provider."""
|
|
66
|
+
|
|
67
|
+
pid_type = None
|
|
68
|
+
"""Type of persistent identifier."""
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def create(cls, object_type=None, object_uuid=None, record=None, **kwargs):
|
|
72
|
+
"""Create a new affiliation identifier.
|
|
73
|
+
|
|
74
|
+
Relies on the record having already a pid_value.
|
|
75
|
+
|
|
76
|
+
For more information about parameters,
|
|
77
|
+
see :meth:`invenio_pidstore.providers.base.BaseProvider.create`.
|
|
78
|
+
|
|
79
|
+
:param object_type: The object type. (Default: None.)
|
|
80
|
+
:param object_uuid: The object identifier. (Default: None).
|
|
81
|
+
:param record: An affiliation vocabulary record.
|
|
82
|
+
:param kwargs: Addtional options
|
|
83
|
+
:returns: A :class:`AffiliationProvider` instance.
|
|
84
|
+
"""
|
|
85
|
+
assert record is not None, "Missing or invalid 'record'."
|
|
86
|
+
assert "id" in record and isinstance(
|
|
87
|
+
record["id"], str
|
|
88
|
+
), "Missing 'id' key in record."
|
|
89
|
+
|
|
90
|
+
# Retrieve pid value form record.
|
|
91
|
+
pid_value = record["id"]
|
|
92
|
+
|
|
93
|
+
# You must assign immediately.
|
|
94
|
+
assert object_uuid
|
|
95
|
+
assert object_type
|
|
96
|
+
|
|
97
|
+
return super().create(
|
|
98
|
+
pid_type=cls.pid_type,
|
|
99
|
+
pid_value=pid_value,
|
|
100
|
+
object_type=object_type,
|
|
101
|
+
object_uuid=object_uuid,
|
|
102
|
+
status=PIDStatus.REGISTERED,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class PIDProviderFactory:
|
|
107
|
+
"""Vocabulary PID provider factory."""
|
|
108
|
+
|
|
109
|
+
@staticmethod
|
|
110
|
+
def create(pid_type, base_cls=CustomVocabularyPIDProvider):
|
|
111
|
+
"""Returns a CustomVocabularyPIDProvider with the given PID type."""
|
|
112
|
+
provider_class_attributes = {
|
|
113
|
+
"pid_type": pid_type,
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return type(
|
|
117
|
+
"CustomVocabularyPIDProvider", (base_cls,), provider_class_attributes
|
|
118
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2020-2021 CERN.
|
|
4
|
+
#
|
|
5
|
+
# Invenio-Vocabularies is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
"""System fields module."""
|
|
10
|
+
|
|
11
|
+
from .pid import BaseVocabularyPIDFieldContext, VocabularyPIDFieldContext
|
|
12
|
+
|
|
13
|
+
__all__ = (
|
|
14
|
+
"BaseVocabularyPIDFieldContext",
|
|
15
|
+
"VocabularyPIDFieldContext",
|
|
16
|
+
)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2020-2021 CERN.
|
|
4
|
+
# Copyright (C) 2020 Northwestern University.
|
|
5
|
+
#
|
|
6
|
+
# Invenio-Records-Resources is free software; you can redistribute it and/or
|
|
7
|
+
# modify it under the terms of the MIT License; see LICENSE file for more
|
|
8
|
+
# details.
|
|
9
|
+
|
|
10
|
+
"""System field context for the Vocabulary PID field.
|
|
11
|
+
|
|
12
|
+
The context overrides the PID resolver to be aware of the vocabulary type, and
|
|
13
|
+
hence the PID type.
|
|
14
|
+
|
|
15
|
+
The context is used when you initialise a PIField, for instance:
|
|
16
|
+
|
|
17
|
+
.. code-block:: python
|
|
18
|
+
|
|
19
|
+
class Vocabulary(Record):
|
|
20
|
+
pid = PIDField(
|
|
21
|
+
'id',
|
|
22
|
+
provider=VocabularyIdProvider,
|
|
23
|
+
context_cls=VocabularyPIDFieldContext
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
You can then resolve vocabulary records using the type:
|
|
27
|
+
|
|
28
|
+
.. code-block:: python
|
|
29
|
+
|
|
30
|
+
Vocabulary.pid.resolve(('<type>', '<pid_value>'))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Also, it's possible to make initialise the field with a type context:
|
|
34
|
+
|
|
35
|
+
.. code-block:: python
|
|
36
|
+
|
|
37
|
+
Vocabulary.pid.with_type_ctx('<type>').resolve('<pid_value>')
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
from copy import copy
|
|
42
|
+
|
|
43
|
+
from invenio_db import db
|
|
44
|
+
from invenio_pidstore.errors import PIDDoesNotExistError
|
|
45
|
+
from invenio_records_resources.records.systemfields.pid import PIDFieldContext
|
|
46
|
+
|
|
47
|
+
from invenio_vocabularies.records.models import VocabularyType
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class BaseVocabularyPIDFieldContext(PIDFieldContext):
|
|
51
|
+
"""PIDField context for vocabularies.
|
|
52
|
+
|
|
53
|
+
This class implements the class-level methods available on a PIDField
|
|
54
|
+
for vocabulary records.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
def create(self, record):
|
|
58
|
+
"""Proxy to the field's create method."""
|
|
59
|
+
return self.field.create(record)
|
|
60
|
+
|
|
61
|
+
def delete(self, record):
|
|
62
|
+
"""Proxy to the field's delete method."""
|
|
63
|
+
return self.field.delete(record)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class VocabularyPIDFieldContext(BaseVocabularyPIDFieldContext):
|
|
67
|
+
"""PIDField context for vocabularies.
|
|
68
|
+
|
|
69
|
+
This class implements the class-level methods available on a PIDField
|
|
70
|
+
for vocabulary records.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
def resolve(self, pid_value):
|
|
74
|
+
"""Resolve identifier.
|
|
75
|
+
|
|
76
|
+
:params pid_value: Either a tuple ``(type_id, pid_value)`` or just a
|
|
77
|
+
``pid_value`` if the type context has been initialized using
|
|
78
|
+
``with_type_ctx()``.
|
|
79
|
+
"""
|
|
80
|
+
pid_type = self.pid_type
|
|
81
|
+
if pid_type is None:
|
|
82
|
+
type_id, pid_value = pid_value
|
|
83
|
+
pid_type = self.get_pid_type(type_id)
|
|
84
|
+
|
|
85
|
+
# Create resolver
|
|
86
|
+
resolver = self.field._resolver_cls(
|
|
87
|
+
pid_type=pid_type,
|
|
88
|
+
object_type=self.field._object_type,
|
|
89
|
+
getter=self.record_cls.get_record,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Resolve
|
|
93
|
+
pid, record = resolver.resolve(pid_value)
|
|
94
|
+
|
|
95
|
+
# Store pid in cache on record.
|
|
96
|
+
self.field._set_cache(record, pid)
|
|
97
|
+
|
|
98
|
+
return record
|
|
99
|
+
|
|
100
|
+
def get_pid_type(self, type_id):
|
|
101
|
+
"""Get the PID type for a vocabulary type."""
|
|
102
|
+
# Get type based on name.
|
|
103
|
+
vocab_type = VocabularyType.query.filter_by(id=type_id).one_or_none()
|
|
104
|
+
if vocab_type is None:
|
|
105
|
+
raise PIDDoesNotExistError(None, None)
|
|
106
|
+
return vocab_type.pid_type
|
|
107
|
+
|
|
108
|
+
@property
|
|
109
|
+
def pid_type(self):
|
|
110
|
+
"""Get the current defined type."""
|
|
111
|
+
# This ensures that when we use Vocabulary.pid.with_type_ctx('...')
|
|
112
|
+
# we cache the pid type to avoid querying the database every time.
|
|
113
|
+
type_id = getattr(self, "_type_id", None)
|
|
114
|
+
if type_id:
|
|
115
|
+
pid_type = getattr(self, "_pid_type", None)
|
|
116
|
+
if pid_type is None:
|
|
117
|
+
pid_type = self.get_pid_type(type_id)
|
|
118
|
+
self._pid_type = pid_type
|
|
119
|
+
return pid_type
|
|
120
|
+
|
|
121
|
+
def with_type_ctx(self, type_id):
|
|
122
|
+
"""Returns a new context initialized with the type context."""
|
|
123
|
+
ctx = copy(self)
|
|
124
|
+
ctx._type_id = type_id
|
|
125
|
+
return ctx
|