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.
Files changed (337) hide show
  1. invenio_vocabularies/__init__.py +16 -0
  2. invenio_vocabularies/administration/__init__.py +10 -0
  3. invenio_vocabularies/administration/views/__init__.py +10 -0
  4. invenio_vocabularies/administration/views/vocabularies.py +43 -0
  5. invenio_vocabularies/alembic/17c703ce1eb7_create_names_table.py +54 -0
  6. invenio_vocabularies/alembic/3ba812d80559_add_internal_name_id.py +36 -0
  7. invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py +37 -0
  8. invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py +92 -0
  9. invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py +96 -0
  10. invenio_vocabularies/alembic/6312f33645c1_create_affiliations_table.py +54 -0
  11. invenio_vocabularies/alembic/676dd587542d_create_funders_vocabulary_table.py +58 -0
  12. invenio_vocabularies/alembic/8ff82dfb0be8_create_vocabularies_branch.py +28 -0
  13. invenio_vocabularies/alembic/__init__.py +9 -0
  14. invenio_vocabularies/alembic/af2457652217_drop_unique_constraint_from_internal_id.py +37 -0
  15. invenio_vocabularies/alembic/e1146238edd3_create_awards_table.py +56 -0
  16. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.eslintrc.yml +11 -0
  17. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.prettierrc +1 -0
  18. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/index.js +7 -0
  19. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/package.json +25 -0
  20. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/AwardResults.js +95 -0
  21. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +139 -0
  22. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FunderDropdown.js +87 -0
  23. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +244 -0
  24. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.test.js +1 -0
  25. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingFieldItem.js +152 -0
  26. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingModal.js +246 -0
  27. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/NoAwardResults.js +37 -0
  28. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/index.js +8 -0
  29. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/index.js +7 -0
  30. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/index.js +7 -0
  31. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/index.js +7 -0
  32. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next.js +36 -0
  33. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/_generatedTranslations.js +66 -0
  34. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ar/messages.po +96 -0
  35. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ar/translations.json +28 -0
  36. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/bg/messages.po +94 -0
  37. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/bg/translations.json +28 -0
  38. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ca/messages.po +94 -0
  39. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ca/translations.json +28 -0
  40. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/cs/messages.po +97 -0
  41. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/cs/translations.json +28 -0
  42. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/da/messages.po +94 -0
  43. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/da/translations.json +28 -0
  44. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/de/messages.po +98 -0
  45. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/de/translations.json +28 -0
  46. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/el/messages.po +94 -0
  47. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/el/translations.json +28 -0
  48. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/en/messages.po +88 -0
  49. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/en/translations.json +28 -0
  50. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/es/messages.po +96 -0
  51. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/es/translations.json +28 -0
  52. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/et/messages.po +95 -0
  53. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/et/translations.json +28 -0
  54. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fa/messages.po +94 -0
  55. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fa/translations.json +28 -0
  56. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fr/messages.po +96 -0
  57. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fr/translations.json +28 -0
  58. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hr/messages.po +94 -0
  59. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hr/translations.json +28 -0
  60. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hu/messages.po +96 -0
  61. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hu/translations.json +28 -0
  62. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/index.js +24 -0
  63. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/it/messages.po +96 -0
  64. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/it/translations.json +28 -0
  65. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ja/messages.po +94 -0
  66. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ja/translations.json +28 -0
  67. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ka/messages.po +94 -0
  68. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ka/translations.json +28 -0
  69. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ko/messages.po +90 -0
  70. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ko/translations.json +28 -0
  71. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/lt/messages.po +94 -0
  72. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/lt/translations.json +28 -0
  73. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/no/messages.po +94 -0
  74. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/no/translations.json +28 -0
  75. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pl/messages.po +94 -0
  76. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pl/translations.json +28 -0
  77. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pt/messages.po +94 -0
  78. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pt/translations.json +28 -0
  79. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ro/messages.po +95 -0
  80. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ro/translations.json +28 -0
  81. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ru/messages.po +95 -0
  82. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ru/translations.json +28 -0
  83. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sk/messages.po +94 -0
  84. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sk/translations.json +28 -0
  85. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sv/messages.po +98 -0
  86. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sv/translations.json +28 -0
  87. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/tr/messages.po +96 -0
  88. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/tr/translations.json +28 -0
  89. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/uk/messages.po +94 -0
  90. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/uk/translations.json +28 -0
  91. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_CN/messages.po +96 -0
  92. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_CN/translations.json +28 -0
  93. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_TW/messages.po +94 -0
  94. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_TW/translations.json +28 -0
  95. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/package.json +19 -0
  96. invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/translations.pot +88 -0
  97. invenio_vocabularies/cli.py +175 -0
  98. invenio_vocabularies/config.py +231 -0
  99. invenio_vocabularies/contrib/__init__.py +9 -0
  100. invenio_vocabularies/contrib/affiliations/__init__.py +20 -0
  101. invenio_vocabularies/contrib/affiliations/affiliations.py +61 -0
  102. invenio_vocabularies/contrib/affiliations/api.py +13 -0
  103. invenio_vocabularies/contrib/affiliations/config.py +79 -0
  104. invenio_vocabularies/contrib/affiliations/datastreams.py +301 -0
  105. invenio_vocabularies/contrib/affiliations/facets.py +36 -0
  106. invenio_vocabularies/contrib/affiliations/jsonschemas/__init__.py +9 -0
  107. invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +63 -0
  108. invenio_vocabularies/contrib/affiliations/mappings/__init__.py +10 -0
  109. invenio_vocabularies/contrib/affiliations/mappings/os-v1/__init__.py +9 -0
  110. invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +112 -0
  111. invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v2.0.0.json +171 -0
  112. invenio_vocabularies/contrib/affiliations/mappings/os-v2/__init__.py +9 -0
  113. invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +112 -0
  114. invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v2.0.0.json +171 -0
  115. invenio_vocabularies/contrib/affiliations/mappings/v7/__init__.py +9 -0
  116. invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +112 -0
  117. invenio_vocabularies/contrib/affiliations/models.py +13 -0
  118. invenio_vocabularies/contrib/affiliations/resources.py +16 -0
  119. invenio_vocabularies/contrib/affiliations/schema.py +71 -0
  120. invenio_vocabularies/contrib/affiliations/services.py +15 -0
  121. invenio_vocabularies/contrib/awards/__init__.py +19 -0
  122. invenio_vocabularies/contrib/awards/api.py +13 -0
  123. invenio_vocabularies/contrib/awards/awards.py +96 -0
  124. invenio_vocabularies/contrib/awards/config.py +59 -0
  125. invenio_vocabularies/contrib/awards/datastreams.py +372 -0
  126. invenio_vocabularies/contrib/awards/jsonschemas/__init__.py +9 -0
  127. invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +91 -0
  128. invenio_vocabularies/contrib/awards/mappings/__init__.py +9 -0
  129. invenio_vocabularies/contrib/awards/mappings/os-v1/__init__.py +9 -0
  130. invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +147 -0
  131. invenio_vocabularies/contrib/awards/mappings/os-v2/__init__.py +9 -0
  132. invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +147 -0
  133. invenio_vocabularies/contrib/awards/mappings/v7/__init__.py +9 -0
  134. invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +147 -0
  135. invenio_vocabularies/contrib/awards/models.py +13 -0
  136. invenio_vocabularies/contrib/awards/resources.py +16 -0
  137. invenio_vocabularies/contrib/awards/schema.py +119 -0
  138. invenio_vocabularies/contrib/awards/serializer.py +47 -0
  139. invenio_vocabularies/contrib/awards/services.py +15 -0
  140. invenio_vocabularies/contrib/common/__init__.py +9 -0
  141. invenio_vocabularies/contrib/common/openaire/__init__.py +9 -0
  142. invenio_vocabularies/contrib/common/openaire/datastreams.py +84 -0
  143. invenio_vocabularies/contrib/common/ror/__init__.py +9 -0
  144. invenio_vocabularies/contrib/common/ror/datastreams.py +230 -0
  145. invenio_vocabularies/contrib/funders/__init__.py +19 -0
  146. invenio_vocabularies/contrib/funders/api.py +13 -0
  147. invenio_vocabularies/contrib/funders/config.py +78 -0
  148. invenio_vocabularies/contrib/funders/datastreams.py +97 -0
  149. invenio_vocabularies/contrib/funders/facets.py +36 -0
  150. invenio_vocabularies/contrib/funders/funders.py +72 -0
  151. invenio_vocabularies/contrib/funders/jsonschemas/__init__.py +9 -0
  152. invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +65 -0
  153. invenio_vocabularies/contrib/funders/mappings/__init__.py +9 -0
  154. invenio_vocabularies/contrib/funders/mappings/os-v1/__init__.py +9 -0
  155. invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +90 -0
  156. invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json +156 -0
  157. invenio_vocabularies/contrib/funders/mappings/os-v2/__init__.py +9 -0
  158. invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +90 -0
  159. invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json +156 -0
  160. invenio_vocabularies/contrib/funders/mappings/v7/__init__.py +9 -0
  161. invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +90 -0
  162. invenio_vocabularies/contrib/funders/models.py +13 -0
  163. invenio_vocabularies/contrib/funders/resources.py +16 -0
  164. invenio_vocabularies/contrib/funders/schema.py +88 -0
  165. invenio_vocabularies/contrib/funders/serializer.py +33 -0
  166. invenio_vocabularies/contrib/funders/services.py +15 -0
  167. invenio_vocabularies/contrib/names/__init__.py +19 -0
  168. invenio_vocabularies/contrib/names/api.py +13 -0
  169. invenio_vocabularies/contrib/names/components.py +24 -0
  170. invenio_vocabularies/contrib/names/config.py +75 -0
  171. invenio_vocabularies/contrib/names/datastreams.py +483 -0
  172. invenio_vocabularies/contrib/names/jsonschemas/__init__.py +9 -0
  173. invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +68 -0
  174. invenio_vocabularies/contrib/names/mappings/__init__.py +9 -0
  175. invenio_vocabularies/contrib/names/mappings/os-v1/__init__.py +9 -0
  176. invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +101 -0
  177. invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v2.0.0.json +165 -0
  178. invenio_vocabularies/contrib/names/mappings/os-v2/__init__.py +9 -0
  179. invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +101 -0
  180. invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v2.0.0.json +165 -0
  181. invenio_vocabularies/contrib/names/mappings/v7/__init__.py +9 -0
  182. invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +101 -0
  183. invenio_vocabularies/contrib/names/models.py +13 -0
  184. invenio_vocabularies/contrib/names/names.py +80 -0
  185. invenio_vocabularies/contrib/names/permissions.py +30 -0
  186. invenio_vocabularies/contrib/names/resources.py +54 -0
  187. invenio_vocabularies/contrib/names/s3client.py +50 -0
  188. invenio_vocabularies/contrib/names/schema.py +121 -0
  189. invenio_vocabularies/contrib/names/services.py +64 -0
  190. invenio_vocabularies/contrib/subjects/__init__.py +22 -0
  191. invenio_vocabularies/contrib/subjects/api.py +14 -0
  192. invenio_vocabularies/contrib/subjects/config.py +90 -0
  193. invenio_vocabularies/contrib/subjects/datastreams.py +63 -0
  194. invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py +9 -0
  195. invenio_vocabularies/contrib/subjects/euroscivoc/datastreams.py +101 -0
  196. invenio_vocabularies/contrib/subjects/facets.py +23 -0
  197. invenio_vocabularies/contrib/subjects/gemet/__init__.py +9 -0
  198. invenio_vocabularies/contrib/subjects/gemet/datastreams.py +140 -0
  199. invenio_vocabularies/contrib/subjects/jsonschemas/__init__.py +10 -0
  200. invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +69 -0
  201. invenio_vocabularies/contrib/subjects/mappings/__init__.py +9 -0
  202. invenio_vocabularies/contrib/subjects/mappings/os-v1/__init__.py +9 -0
  203. invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +96 -0
  204. invenio_vocabularies/contrib/subjects/mappings/os-v2/__init__.py +9 -0
  205. invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +96 -0
  206. invenio_vocabularies/contrib/subjects/mappings/v7/__init__.py +9 -0
  207. invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +96 -0
  208. invenio_vocabularies/contrib/subjects/mesh/__init__.py +9 -0
  209. invenio_vocabularies/contrib/subjects/mesh/datastreams.py +48 -0
  210. invenio_vocabularies/contrib/subjects/models.py +14 -0
  211. invenio_vocabularies/contrib/subjects/nvs/__init__.py +9 -0
  212. invenio_vocabularies/contrib/subjects/nvs/datastreams.py +114 -0
  213. invenio_vocabularies/contrib/subjects/resources.py +17 -0
  214. invenio_vocabularies/contrib/subjects/schema.py +101 -0
  215. invenio_vocabularies/contrib/subjects/services.py +30 -0
  216. invenio_vocabularies/contrib/subjects/subjects.py +55 -0
  217. invenio_vocabularies/datastreams/__init__.py +18 -0
  218. invenio_vocabularies/datastreams/datastreams.py +239 -0
  219. invenio_vocabularies/datastreams/errors.py +29 -0
  220. invenio_vocabularies/datastreams/factories.py +86 -0
  221. invenio_vocabularies/datastreams/readers.py +448 -0
  222. invenio_vocabularies/datastreams/tasks.py +115 -0
  223. invenio_vocabularies/datastreams/transformers.py +130 -0
  224. invenio_vocabularies/datastreams/writers.py +222 -0
  225. invenio_vocabularies/datastreams/xml.py +34 -0
  226. invenio_vocabularies/ext.py +179 -0
  227. invenio_vocabularies/factories.py +193 -0
  228. invenio_vocabularies/fixtures.py +52 -0
  229. invenio_vocabularies/jobs.py +207 -0
  230. invenio_vocabularies/proxies.py +27 -0
  231. invenio_vocabularies/records/__init__.py +9 -0
  232. invenio_vocabularies/records/api.py +53 -0
  233. invenio_vocabularies/records/jsonschemas/__init__.py +9 -0
  234. invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +30 -0
  235. invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +55 -0
  236. invenio_vocabularies/records/mappings/__init__.py +9 -0
  237. invenio_vocabularies/records/mappings/os-v1/__init__.py +9 -0
  238. invenio_vocabularies/records/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +109 -0
  239. invenio_vocabularies/records/mappings/os-v2/__init__.py +9 -0
  240. invenio_vocabularies/records/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +109 -0
  241. invenio_vocabularies/records/mappings/v7/__init__.py +9 -0
  242. invenio_vocabularies/records/mappings/v7/vocabularies/vocabulary-v1.0.0.json +109 -0
  243. invenio_vocabularies/records/models.py +90 -0
  244. invenio_vocabularies/records/pidprovider.py +118 -0
  245. invenio_vocabularies/records/systemfields/__init__.py +16 -0
  246. invenio_vocabularies/records/systemfields/pid.py +125 -0
  247. invenio_vocabularies/records/systemfields/relations.py +51 -0
  248. invenio_vocabularies/resources/__init__.py +23 -0
  249. invenio_vocabularies/resources/config.py +105 -0
  250. invenio_vocabularies/resources/resource.py +156 -0
  251. invenio_vocabularies/resources/schema.py +21 -0
  252. invenio_vocabularies/resources/serializer.py +39 -0
  253. invenio_vocabularies/services/__init__.py +19 -0
  254. invenio_vocabularies/services/components.py +58 -0
  255. invenio_vocabularies/services/config.py +173 -0
  256. invenio_vocabularies/services/custom_fields/__init__.py +17 -0
  257. invenio_vocabularies/services/custom_fields/subject.py +82 -0
  258. invenio_vocabularies/services/custom_fields/vocabulary.py +96 -0
  259. invenio_vocabularies/services/facets.py +114 -0
  260. invenio_vocabularies/services/generators.py +38 -0
  261. invenio_vocabularies/services/permissions.py +30 -0
  262. invenio_vocabularies/services/querystr.py +57 -0
  263. invenio_vocabularies/services/results.py +110 -0
  264. invenio_vocabularies/services/schema.py +163 -0
  265. invenio_vocabularies/services/service.py +189 -0
  266. invenio_vocabularies/services/tasks.py +38 -0
  267. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/subjects.html +23 -0
  268. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabularies-list.html +12 -0
  269. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabulary-details.html +71 -0
  270. invenio_vocabularies/translations/ar/LC_MESSAGES/messages.mo +0 -0
  271. invenio_vocabularies/translations/ar/LC_MESSAGES/messages.po +277 -0
  272. invenio_vocabularies/translations/bg/LC_MESSAGES/messages.mo +0 -0
  273. invenio_vocabularies/translations/bg/LC_MESSAGES/messages.po +275 -0
  274. invenio_vocabularies/translations/ca/LC_MESSAGES/messages.mo +0 -0
  275. invenio_vocabularies/translations/ca/LC_MESSAGES/messages.po +276 -0
  276. invenio_vocabularies/translations/cs/LC_MESSAGES/messages.mo +0 -0
  277. invenio_vocabularies/translations/cs/LC_MESSAGES/messages.po +281 -0
  278. invenio_vocabularies/translations/da/LC_MESSAGES/messages.mo +0 -0
  279. invenio_vocabularies/translations/da/LC_MESSAGES/messages.po +271 -0
  280. invenio_vocabularies/translations/de/LC_MESSAGES/messages.mo +0 -0
  281. invenio_vocabularies/translations/de/LC_MESSAGES/messages.po +293 -0
  282. invenio_vocabularies/translations/el/LC_MESSAGES/messages.mo +0 -0
  283. invenio_vocabularies/translations/el/LC_MESSAGES/messages.po +275 -0
  284. invenio_vocabularies/translations/es/LC_MESSAGES/messages.mo +0 -0
  285. invenio_vocabularies/translations/es/LC_MESSAGES/messages.po +281 -0
  286. invenio_vocabularies/translations/et/LC_MESSAGES/messages.mo +0 -0
  287. invenio_vocabularies/translations/et/LC_MESSAGES/messages.po +276 -0
  288. invenio_vocabularies/translations/fa/LC_MESSAGES/messages.mo +0 -0
  289. invenio_vocabularies/translations/fa/LC_MESSAGES/messages.po +275 -0
  290. invenio_vocabularies/translations/fr/LC_MESSAGES/messages.mo +0 -0
  291. invenio_vocabularies/translations/fr/LC_MESSAGES/messages.po +279 -0
  292. invenio_vocabularies/translations/hr/LC_MESSAGES/messages.mo +0 -0
  293. invenio_vocabularies/translations/hr/LC_MESSAGES/messages.po +275 -0
  294. invenio_vocabularies/translations/hu/LC_MESSAGES/messages.mo +0 -0
  295. invenio_vocabularies/translations/hu/LC_MESSAGES/messages.po +280 -0
  296. invenio_vocabularies/translations/it/LC_MESSAGES/messages.mo +0 -0
  297. invenio_vocabularies/translations/it/LC_MESSAGES/messages.po +277 -0
  298. invenio_vocabularies/translations/ja/LC_MESSAGES/messages.mo +0 -0
  299. invenio_vocabularies/translations/ja/LC_MESSAGES/messages.po +275 -0
  300. invenio_vocabularies/translations/ka/LC_MESSAGES/messages.mo +0 -0
  301. invenio_vocabularies/translations/ka/LC_MESSAGES/messages.po +275 -0
  302. invenio_vocabularies/translations/ko/LC_MESSAGES/messages.mo +0 -0
  303. invenio_vocabularies/translations/ko/LC_MESSAGES/messages.po +275 -0
  304. invenio_vocabularies/translations/lt/LC_MESSAGES/messages.mo +0 -0
  305. invenio_vocabularies/translations/lt/LC_MESSAGES/messages.po +275 -0
  306. invenio_vocabularies/translations/messages.pot +270 -0
  307. invenio_vocabularies/translations/no/LC_MESSAGES/messages.mo +0 -0
  308. invenio_vocabularies/translations/no/LC_MESSAGES/messages.po +275 -0
  309. invenio_vocabularies/translations/pl/LC_MESSAGES/messages.mo +0 -0
  310. invenio_vocabularies/translations/pl/LC_MESSAGES/messages.po +275 -0
  311. invenio_vocabularies/translations/pt/LC_MESSAGES/messages.mo +0 -0
  312. invenio_vocabularies/translations/pt/LC_MESSAGES/messages.po +275 -0
  313. invenio_vocabularies/translations/ro/LC_MESSAGES/messages.mo +0 -0
  314. invenio_vocabularies/translations/ro/LC_MESSAGES/messages.po +280 -0
  315. invenio_vocabularies/translations/ru/LC_MESSAGES/messages.mo +0 -0
  316. invenio_vocabularies/translations/ru/LC_MESSAGES/messages.po +276 -0
  317. invenio_vocabularies/translations/sk/LC_MESSAGES/messages.mo +0 -0
  318. invenio_vocabularies/translations/sk/LC_MESSAGES/messages.po +276 -0
  319. invenio_vocabularies/translations/sv/LC_MESSAGES/messages.mo +0 -0
  320. invenio_vocabularies/translations/sv/LC_MESSAGES/messages.po +280 -0
  321. invenio_vocabularies/translations/tr/LC_MESSAGES/messages.mo +0 -0
  322. invenio_vocabularies/translations/tr/LC_MESSAGES/messages.po +277 -0
  323. invenio_vocabularies/translations/uk/LC_MESSAGES/messages.mo +0 -0
  324. invenio_vocabularies/translations/uk/LC_MESSAGES/messages.po +275 -0
  325. invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
  326. invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po +276 -0
  327. invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
  328. invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po +275 -0
  329. invenio_vocabularies/views.py +53 -0
  330. invenio_vocabularies/webpack.py +51 -0
  331. invenio_vocabularies-9.1.2.dist-info/METADATA +517 -0
  332. invenio_vocabularies-9.1.2.dist-info/RECORD +337 -0
  333. invenio_vocabularies-9.1.2.dist-info/WHEEL +6 -0
  334. invenio_vocabularies-9.1.2.dist-info/entry_points.txt +73 -0
  335. invenio_vocabularies-9.1.2.dist-info/licenses/AUTHORS.rst +13 -0
  336. invenio_vocabularies-9.1.2.dist-info/licenses/LICENSE +21 -0
  337. invenio_vocabularies-9.1.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,193 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2024-2025 CERN.
4
+ # Copyright (C) 2024 KTH Royal Institute of Technology.
5
+ #
6
+ # Invenio-Vocabularies 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
+ """Generate Vocabulary Config."""
10
+
11
+ from copy import deepcopy
12
+
13
+ import yaml
14
+ from invenio_records_resources.proxies import current_service_registry
15
+
16
+ from .contrib.affiliations.datastreams import (
17
+ DATASTREAM_CONFIG as affiliations_ds_config,
18
+ )
19
+ from .contrib.affiliations.datastreams import (
20
+ DATASTREAM_CONFIG_EDMO as affiliations_edmo_ds_config,
21
+ )
22
+ from .contrib.affiliations.datastreams import (
23
+ DATASTREAM_CONFIG_OPENAIRE as affiliations_openaire_ds_config,
24
+ )
25
+ from .contrib.awards.datastreams import DATASTREAM_CONFIG as awards_ds_config
26
+ from .contrib.awards.datastreams import (
27
+ DATASTREAM_CONFIG_CORDIS as awards_cordis_ds_config,
28
+ )
29
+ from .contrib.funders.datastreams import DATASTREAM_CONFIG as funders_ds_config
30
+ from .contrib.names.datastreams import DATASTREAM_CONFIG as names_ds_config
31
+ from .contrib.subjects.datastreams import DATASTREAM_CONFIG as subjects_ds_config
32
+ from .contrib.subjects.euroscivoc.datastreams import (
33
+ DATASTREAM_CONFIG as euroscivoc_ds_config,
34
+ )
35
+ from .contrib.subjects.gemet.datastreams import DATASTREAM_CONFIG as gemet_ds_config
36
+ from .contrib.subjects.nvs.datastreams import DATASTREAM_CONFIG as nvs_ds_config
37
+
38
+
39
+ class VocabularyConfig:
40
+ """Vocabulary Config Factory."""
41
+
42
+ config = None
43
+ vocabulary_name = None
44
+
45
+ def get_config(self, filepath=None, origin=None):
46
+ """Get the configuration for the vocabulary."""
47
+ config = deepcopy(self.config)
48
+ if filepath:
49
+ with open(filepath, encoding="utf-8") as f:
50
+ config = yaml.safe_load(f).get(self.vocabulary_name)
51
+ if origin:
52
+ config["readers"][0].setdefault("args", {})
53
+ config["readers"][0]["args"]["origin"] = origin
54
+ return config
55
+
56
+ def get_service(self):
57
+ """Get the service for the vocabulary."""
58
+ return current_service_registry.get(self.vocabulary_name)
59
+
60
+
61
+ class NamesVocabularyConfig(VocabularyConfig):
62
+ """Names Vocabulary Config."""
63
+
64
+ config = names_ds_config
65
+ vocabulary_name = "names"
66
+
67
+
68
+ class FundersVocabularyConfig(VocabularyConfig):
69
+ """Funders Vocabulary Config."""
70
+
71
+ config = funders_ds_config
72
+ vocabulary_name = "funders"
73
+
74
+ def get_service(self):
75
+ """Get the service for the vocabulary."""
76
+ raise NotImplementedError("Service not implemented for Funders")
77
+
78
+
79
+ class SubjectsVocabularyConfig(VocabularyConfig):
80
+ """Subjects Vocabulary Config."""
81
+
82
+ config = subjects_ds_config
83
+ vocabulary_name = "subjects"
84
+
85
+ def get_service(self):
86
+ """Get the service for the vocabulary."""
87
+ raise NotImplementedError("Service not implemented for Subjects")
88
+
89
+
90
+ class AwardsVocabularyConfig(VocabularyConfig):
91
+ """Awards Vocabulary Config."""
92
+
93
+ config = awards_ds_config
94
+ vocabulary_name = "awards"
95
+
96
+ def get_service(self):
97
+ """Get the service for the vocabulary."""
98
+ raise NotImplementedError("Service not implemented for Awards")
99
+
100
+
101
+ class AwardsCordisVocabularyConfig(VocabularyConfig):
102
+ """Awards Vocabulary Config."""
103
+
104
+ config = awards_cordis_ds_config
105
+ vocabulary_name = "awards:cordis"
106
+
107
+ def get_service(self):
108
+ """Get the service for the vocabulary."""
109
+ raise NotImplementedError("Service not implemented for CORDIS Awards")
110
+
111
+
112
+ class AffiliationsVocabularyConfig(VocabularyConfig):
113
+ """Affiliations Vocabulary Config."""
114
+
115
+ config = affiliations_ds_config
116
+ vocabulary_name = "affiliations"
117
+
118
+ def get_service(self):
119
+ """Get the service for the vocabulary."""
120
+ raise NotImplementedError("Service not implemented for Affiliations")
121
+
122
+
123
+ class AffiliationsOpenAIREVocabularyConfig(VocabularyConfig):
124
+ """OpenAIRE Affiliations Vocabulary Config."""
125
+
126
+ config = affiliations_openaire_ds_config
127
+ vocabulary_name = "affiliations:openaire"
128
+
129
+ def get_service(self):
130
+ """Get the service for the vocabulary."""
131
+ raise NotImplementedError("Service not implemented for OpenAIRE Affiliations")
132
+
133
+
134
+ class AffiliationsEDMOVocabularyConfig(VocabularyConfig):
135
+ """European Directory of Marine Organisations (EDMO) Affiliations Vocabulary Config."""
136
+
137
+ config = affiliations_edmo_ds_config
138
+ vocabulary_name = "affiliations:edmo"
139
+
140
+ def get_service(self):
141
+ """Get the service for the vocabulary."""
142
+ raise NotImplementedError("Service not implemented for EDMO Affiliations")
143
+
144
+
145
+ class SubjectsEuroSciVocVocabularyConfig(VocabularyConfig):
146
+ """EuroSciVoc Subjects Vocabulary Config."""
147
+
148
+ config = euroscivoc_ds_config
149
+ vocabulary_name = "subjects:euroscivoc"
150
+
151
+ def get_service(self):
152
+ """Get the service for the vocabulary."""
153
+ raise NotImplementedError("Service not implemented for EuroSciVoc Subjects")
154
+
155
+
156
+ class SubjectsGEMETVocabularyConfig(VocabularyConfig):
157
+ """GEMET Subjects Vocabulary Config."""
158
+
159
+ config = gemet_ds_config
160
+ vocabulary_name = "subjects:gemet"
161
+
162
+ def get_service(self):
163
+ """Get the service for the vocabulary."""
164
+ raise NotImplementedError("Service not implemented for GEMET Subjects")
165
+
166
+
167
+ class SubjectsNVSVocabularyConfig(VocabularyConfig):
168
+ """NVS Subjects Vocabulary Config."""
169
+
170
+ config = nvs_ds_config
171
+ vocabulary_name = "subjects:nvs"
172
+
173
+ def get_service(self):
174
+ """Get the service for the vocabulary."""
175
+ raise NotImplementedError("Service not implemented for NVS Subjects")
176
+
177
+
178
+ def get_vocabulary_config(vocabulary):
179
+ """Factory function to get the appropriate Vocabulary Config."""
180
+ vocab_config = {
181
+ "names": NamesVocabularyConfig,
182
+ "funders": FundersVocabularyConfig,
183
+ "awards": AwardsVocabularyConfig,
184
+ "awards:cordis": AwardsCordisVocabularyConfig,
185
+ "affiliations": AffiliationsVocabularyConfig,
186
+ "affiliations:openaire": AffiliationsOpenAIREVocabularyConfig,
187
+ "affiliations:edmo": AffiliationsEDMOVocabularyConfig,
188
+ "subjects": SubjectsVocabularyConfig,
189
+ "subjects:gemet": SubjectsGEMETVocabularyConfig,
190
+ "subjects:nvs": SubjectsNVSVocabularyConfig,
191
+ "subjects:euroscivoc": SubjectsEuroSciVocVocabularyConfig,
192
+ }
193
+ return vocab_config.get(vocabulary, VocabularyConfig)()
@@ -0,0 +1,52 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2021-2022 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
+ """Fixtures module."""
10
+
11
+ import yaml
12
+ from invenio_access.permissions import system_identity
13
+
14
+ from .datastreams.factories import DataStreamFactory
15
+ from .proxies import current_service
16
+
17
+
18
+ class VocabularyFixture:
19
+ """Vocabulary fixture."""
20
+
21
+ def __init__(self, filepath, delay=True):
22
+ """Constructor."""
23
+ self._filepath = filepath
24
+
25
+ def _load_vocabulary(self, config, delay=True, **kwargs):
26
+ """Given an entry from the vocabularies.yaml file, load its content."""
27
+ datastream = DataStreamFactory.create(
28
+ readers_config=config["readers"],
29
+ transformers_config=config.get("transformers"),
30
+ writers_config=config["writers"],
31
+ batch_size=config.get("batch_size", 1000),
32
+ write_many=config.get("write_many", False),
33
+ )
34
+
35
+ errors = []
36
+ for result in datastream.process():
37
+ if result.errors:
38
+ errors.append(result)
39
+
40
+ return errors
41
+
42
+ def _create_vocabulary(self, id_, pid_type, *args, **kwargs):
43
+ """Creates a vocabulary."""
44
+ return current_service.create_type(system_identity, id_, pid_type)
45
+
46
+ def load(self, *args, **kwargs):
47
+ """Return content of vocabularies file."""
48
+ with open(self._filepath) as f:
49
+ data = yaml.safe_load(f) or {}
50
+ for id_, config in data.items():
51
+ self._create_vocabulary(id_, config["pid-type"])
52
+ yield self._load_vocabulary(config)
@@ -0,0 +1,207 @@
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
+ """Jobs module."""
10
+
11
+ from datetime import datetime, timedelta
12
+
13
+ from flask import current_app
14
+ from invenio_i18n import lazy_gettext as _
15
+ from invenio_jobs.jobs import JobType
16
+
17
+ from invenio_vocabularies.services.tasks import process_datastream
18
+
19
+ from .contrib.names.datastreams import ORCID_PRESET_DATASTREAM_CONFIG
20
+
21
+
22
+ class ProcessDataStreamJob(JobType):
23
+ """Generic process data stream job type."""
24
+
25
+ task = process_datastream
26
+
27
+
28
+ class ProcessRORAffiliationsJob(ProcessDataStreamJob):
29
+ """Process ROR affiliations datastream registered task."""
30
+
31
+ description = _("Process ROR affiliations")
32
+ title = _("Load ROR affiliations")
33
+ id = "process_ror_affiliations"
34
+
35
+ @classmethod
36
+ def build_task_arguments(cls, job_obj, since=None, **kwargs):
37
+ """Process ROR affiliations."""
38
+ # NOTE: Update is set to False for now given we don't have the logic to re-index dependent records yet.
39
+ # Since jobs support custom args, update true can be passed via that.
40
+ return {
41
+ "config": {
42
+ "readers": [
43
+ {
44
+ "args": {"since": since},
45
+ "type": "ror-http",
46
+ },
47
+ {"args": {"regex": "-ror-data\\.json$"}, "type": "zip"},
48
+ {"type": "json"},
49
+ ],
50
+ "writers": [
51
+ {
52
+ "args": {
53
+ "writer": {
54
+ "type": "affiliations-service",
55
+ "args": {"update": False},
56
+ }
57
+ },
58
+ "type": "async",
59
+ }
60
+ ],
61
+ "transformers": [{"type": "ror-affiliations"}],
62
+ }
63
+ }
64
+
65
+
66
+ class ProcessRORFundersJob(ProcessDataStreamJob):
67
+ """Process ROR funders datastream registered task."""
68
+
69
+ description = _("Process ROR funders")
70
+ title = _("Load ROR funders")
71
+ id = "process_ror_funders"
72
+
73
+ @classmethod
74
+ def build_task_arguments(cls, job_obj, since=None, **kwargs):
75
+ """Process ROR funders."""
76
+ # NOTE: Update is set to False for now given we don't have the logic to re-index dependent records yet.
77
+ # Since jobs support custom args, update true can be passed via that.
78
+ return {
79
+ "config": {
80
+ "readers": [
81
+ {
82
+ "args": {"since": since},
83
+ "type": "ror-http",
84
+ },
85
+ {"args": {"regex": "-ror-data\\.json$"}, "type": "zip"},
86
+ {"type": "json"},
87
+ ],
88
+ "writers": [
89
+ {
90
+ "args": {
91
+ "writer": {
92
+ "type": "funders-service",
93
+ "args": {"update": False},
94
+ }
95
+ },
96
+ "type": "async",
97
+ }
98
+ ],
99
+ "transformers": [{"type": "ror-funders"}],
100
+ }
101
+ }
102
+
103
+
104
+ class ImportAwardsOpenAIREJob(ProcessDataStreamJob):
105
+ """Import awards from OpenAIRE registered task."""
106
+
107
+ description = _("Import awards from OpenAIRE")
108
+ title = _("Import Awards OpenAIRE")
109
+ id = "import_awards_openaire"
110
+
111
+ @classmethod
112
+ def build_task_arguments(cls, job_obj, since=None, **kwargs):
113
+ """Process awards OpenAIRE."""
114
+ return {
115
+ "config": {
116
+ "readers": [
117
+ {
118
+ "type": "openaire-http",
119
+ "args": {"origin": "diff", "tar_href": "/project.tar"},
120
+ },
121
+ {
122
+ "type": "tar",
123
+ "args": {
124
+ "mode": "r",
125
+ "regex": "\\.json.gz$",
126
+ },
127
+ },
128
+ {"type": "gzip"},
129
+ {"type": "jsonl"},
130
+ ],
131
+ "transformers": [{"type": "openaire-award"}],
132
+ "writers": [
133
+ {"args": {"writer": {"type": "awards-service"}}, "type": "async"}
134
+ ],
135
+ }
136
+ }
137
+
138
+
139
+ class UpdateAwardsCordisJob(ProcessDataStreamJob):
140
+ """Update awards from CORDIS registered task."""
141
+
142
+ description = _("Update awards from CORDIS")
143
+ title = _("Update Awards CORDIS")
144
+ id = "update_awards_cordis"
145
+
146
+ @classmethod
147
+ def build_task_arguments(cls, job_obj, since=None, **kwargs):
148
+ """Process awards Cordis."""
149
+ return {
150
+ "config": {
151
+ "readers": [
152
+ {"args": {"origin": "HE"}, "type": "cordis-project-http"},
153
+ {"args": {"mode": "r", "regex": "\\.xml$"}, "type": "zip"},
154
+ {"args": {"root_element": "project"}, "type": "xml"},
155
+ ],
156
+ "transformers": [{"type": "cordis-award"}],
157
+ "writers": [
158
+ {
159
+ "args": {"writer": {"type": "cordis-awards-service"}},
160
+ "type": "async",
161
+ }
162
+ ],
163
+ }
164
+ }
165
+
166
+
167
+ class ImportORCIDJob(ProcessDataStreamJob):
168
+ """Import ORCID data registered task."""
169
+
170
+ description = _("Import ORCID data")
171
+ title = _("Import ORCID data")
172
+ id = "import_orcid"
173
+
174
+ @classmethod
175
+ def build_task_arguments(cls, job_obj, since=None, **kwargs):
176
+ """Process ORCID data."""
177
+ task_args = {"config": {**ORCID_PRESET_DATASTREAM_CONFIG}}
178
+ for reader in task_args["config"]["readers"]:
179
+ # Assign since to all readers of the ORCID job
180
+ # It is the responsibility of the reader to handle it or ignore it
181
+ reader["args"] = {**reader.get("args", {}), "since": str(since)}
182
+ return task_args
183
+
184
+ @classmethod
185
+ def _build_task_arguments(cls, job_obj, since=None, custom_args=None, **kwargs):
186
+ """Build dict of arguments injected on task execution.
187
+
188
+ :param job_obj (Job): the Job object.
189
+ :param since (datetime): last time the job was executed.
190
+ :param custom_args (dict): when provided, takes precedence over any other
191
+ provided argument.
192
+ :return: a dict of arguments to be injected on task execution.
193
+ """
194
+ if custom_args:
195
+ return custom_args
196
+
197
+ if since is None:
198
+ """We set since to a time in the past defined by the VOCABULARIES_ORCID_SYNC_SINCE."""
199
+
200
+ since = datetime.now() - timedelta(
201
+ **current_app.config["VOCABULARIES_ORCID_SYNC_SINCE"]
202
+ )
203
+ """
204
+ Otherwise, since is already specified as a datetime with a timezone (see PredefinedArgsSchema) or we have never
205
+ run the job before so there is no logical value.
206
+ """
207
+ return {**cls.build_task_arguments(job_obj, since=since, **kwargs)}
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2021-2024 CERN.
4
+ # Copyright (C) 2021 Northwestern University.
5
+ #
6
+ # Invenio-Vocabularies 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
+ """Proxies to the service and resource."""
11
+
12
+ from flask import current_app
13
+ from werkzeug.local import LocalProxy
14
+
15
+
16
+ def _ext_proxy(attr):
17
+ return LocalProxy(
18
+ lambda: getattr(current_app.extensions["invenio-vocabularies"], attr)
19
+ )
20
+
21
+
22
+ current_service = _ext_proxy("vocabularies_service")
23
+ """Proxy to the instantiated vocabulary service."""
24
+
25
+
26
+ current_resource = _ext_proxy("resource")
27
+ """Proxy to the instantiated vocabulary resource."""
@@ -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
+ """Records directory."""
@@ -0,0 +1,53 @@
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
+ """Vocabulary data API."""
10
+
11
+ from invenio_records.dumpers import SearchDumper
12
+ from invenio_records.dumpers.indexedat import IndexedAtDumperExt
13
+ from invenio_records.systemfields import ConstantField, RelatedModelField
14
+ from invenio_records_resources.records.api import Record
15
+ from invenio_records_resources.records.systemfields import IndexField, PIDField
16
+
17
+ from .models import VocabularyMetadata, VocabularyType
18
+ from .pidprovider import VocabularyIdProvider
19
+ from .systemfields import VocabularyPIDFieldContext
20
+
21
+
22
+ class Vocabulary(Record):
23
+ """A generic vocabulary record."""
24
+
25
+ # Configuration
26
+ model_cls = VocabularyMetadata
27
+
28
+ # System fields
29
+ # TODO: Can schema name be changed (remove localhost)
30
+ schema = ConstantField(
31
+ "$schema",
32
+ "local://vocabularies/vocabulary-v1.0.0.json",
33
+ )
34
+
35
+ index = IndexField("vocabularies-vocabulary-v1.0.0", search_alias="vocabularies")
36
+
37
+ #: Disable the metadata system field.
38
+ metadata = None
39
+
40
+ type = RelatedModelField(VocabularyType, required=True)
41
+
42
+ pid = PIDField(
43
+ "id",
44
+ provider=VocabularyIdProvider,
45
+ context_cls=VocabularyPIDFieldContext,
46
+ create=False,
47
+ )
48
+
49
+ dumper = SearchDumper(
50
+ extensions=[
51
+ IndexedAtDumperExt(),
52
+ ]
53
+ )
@@ -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
+ """JSONSchema directory."""
@@ -0,0 +1,30 @@
1
+ {
2
+ "title": {
3
+ "type": "object",
4
+ "description": "Title of vocabulary item. Keys are locale codes.",
5
+ "patternProperties": {
6
+ "^[a-z]{2}$": {
7
+ "type": "string"
8
+ }
9
+ }
10
+ },
11
+ "description": {
12
+ "type": "object",
13
+ "description": "Description of vocabulary item. Keys are locale codes.",
14
+ "patternProperties": {
15
+ "^[a-z]{2}$": {
16
+ "type": "string"
17
+ }
18
+ }
19
+ },
20
+ "icon": {
21
+ "type": "string"
22
+ },
23
+ "tags": {
24
+ "type": "array",
25
+ "description": "Tags for a vocabulary item.",
26
+ "items": {
27
+ "type": "string"
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "local://vocabularies/vocabulary-v1.0.0.json",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "properties": {
7
+ "$schema": {
8
+ "$ref": "local://definitions-v1.0.0.json#/$schema"
9
+ },
10
+ "description": {
11
+ "type": "object",
12
+ "description": "Description of vocabulary item. Key are locale codes.",
13
+ "patternProperties": {
14
+ "^[a-z]{2}$": {
15
+ "type": "string"
16
+ }
17
+ }
18
+ },
19
+ "icon": {
20
+ "$ref": "local://vocabularies/definitions-v1.0.0.json#/icon"
21
+ },
22
+ "id": {
23
+ "$ref": "local://definitions-v1.0.0.json#/identifier"
24
+ },
25
+ "pid": {
26
+ "$ref": "local://definitions-v1.0.0.json#/internal-pid"
27
+ },
28
+ "props": {
29
+ "type": "object",
30
+ "patternProperties": {
31
+ "^.*$": {
32
+ "type": "string"
33
+ }
34
+ }
35
+ },
36
+ "tags": {
37
+ "$ref": "local://vocabularies/definitions-v1.0.0.json#/tags"
38
+ },
39
+ "title": {
40
+ "$ref": "local://vocabularies/definitions-v1.0.0.json#/title"
41
+ },
42
+ "type": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "properties": {
46
+ "id": {
47
+ "type": "string"
48
+ },
49
+ "pid_type": {
50
+ "type": "string"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
@@ -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
+ """Mappings directory."""
@@ -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
+ """OpenSearch v1 mappings."""