invenio-vocabularies 6.4.0__py2.py3-none-any.whl → 6.5.0__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.

Potentially problematic release.


This version of invenio-vocabularies might be problematic. Click here for more details.

@@ -10,6 +10,6 @@
10
10
 
11
11
  from .ext import InvenioVocabularies
12
12
 
13
- __version__ = "6.4.0"
13
+ __version__ = "6.5.0"
14
14
 
15
15
  __all__ = ("__version__", "InvenioVocabularies")
@@ -172,7 +172,7 @@ VOCABULARIES_TYPES_SEARCH = {
172
172
  }
173
173
  """Vocabulary type search configuration."""
174
174
 
175
- SUBJECTS_EUROSCIVOC_FILE_URL = "https://op.europa.eu/o/opportal-service/euvoc-download-handler?cellarURI=http%3A%2F%2Fpublications.europa.eu%2Fresource%2Fdistribution%2Feuroscivoc%2F20231115-0%2Frdf%2Fskos_ap_eu%2FEuroSciVoc-skos-ap-eu.rdf&fileName=EuroSciVoc-skos-ap-eu.rdf"
175
+ SUBJECTS_EUROSCIVOC_FILE_URL = "https://publications.europa.eu/resource/distribution/euroscivoc/rdf/skos_ap_eu/EuroSciVoc-skos-ap-eu.rdf"
176
176
  """Subject EuroSciVoc file download link."""
177
177
 
178
178
  VOCABULARIES_ORCID_ACCESS_KEY = "TODO"
@@ -9,8 +9,11 @@
9
9
 
10
10
  """Affiliations datastreams, transformers, writers and readers."""
11
11
 
12
+ from copy import deepcopy
13
+
12
14
  from flask import current_app
13
15
 
16
+ from ...datastreams import StreamEntry
14
17
  from ...datastreams.errors import TransformerError, WriterError
15
18
  from ...datastreams.transformers import BaseTransformer
16
19
  from ...datastreams.writers import ServiceWriter
@@ -96,15 +99,24 @@ class OpenAIREAffiliationsServiceWriter(ServiceWriter):
96
99
  """Get the id from an entry."""
97
100
  return entry["id"]
98
101
 
99
- def write(self, stream_entry, *args, **kwargs):
100
- """Writes the input entry using a given service."""
101
- entry = stream_entry.entry
102
-
103
- return super().write(stream_entry, *args, **kwargs)
104
-
105
- def write_many(self, stream_entries, *args, **kwargs):
106
- """Writes the input entries using a given service."""
107
- return super().write_many(stream_entries, *args, **kwargs)
102
+ def _do_update(self, entry):
103
+ vocab_id = self._entry_id(entry)
104
+ current = self._resolve(vocab_id)
105
+ updated = deepcopy(current.to_dict())
106
+
107
+ if "identifiers" in entry:
108
+ # For each new identifier
109
+ for new_identifier in entry["identifiers"]:
110
+ # Either find an existing identifier with the same scheme and update the "identifier" value
111
+ for existing_identifier in updated["identifiers"]:
112
+ if existing_identifier["scheme"] == new_identifier["scheme"]:
113
+ existing_identifier["identifier"] = new_identifier["identifier"]
114
+ break
115
+ # Or add the new identifier to the list of identifiers
116
+ else:
117
+ updated["identifiers"].append(new_identifier)
118
+
119
+ return StreamEntry(self._service.update(self._identity, vocab_id, updated))
108
120
 
109
121
 
110
122
  VOCABULARIES_DATASTREAM_READERS = {}
@@ -14,8 +14,8 @@
14
14
  "type": "custom",
15
15
  "char_filter": ["strip_special_chars"],
16
16
  "filter": [
17
- "lowercase",
18
- "asciifolding",
17
+ "lowercasepreserveoriginal",
18
+ "asciifoldingpreserveoriginal",
19
19
  "edgegrams"
20
20
  ]
21
21
  },
@@ -24,8 +24,8 @@
24
24
  "type": "custom",
25
25
  "char_filter": ["strip_special_chars"],
26
26
  "filter": [
27
- "lowercase",
28
- "asciifolding"
27
+ "lowercasepreserveoriginal",
28
+ "asciifoldingpreserveoriginal"
29
29
  ]
30
30
  }
31
31
  },
@@ -40,11 +40,11 @@
40
40
  }
41
41
  },
42
42
  "filter": {
43
- "lowercase": {
43
+ "lowercasepreserveoriginal": {
44
44
  "type": "lowercase",
45
45
  "preserve_original": true
46
46
  },
47
- "asciifolding": {
47
+ "asciifoldingpreserveoriginal": {
48
48
  "type": "asciifolding",
49
49
  "preserve_original": true
50
50
  },
@@ -14,8 +14,8 @@
14
14
  "type": "custom",
15
15
  "char_filter": ["strip_special_chars"],
16
16
  "filter": [
17
- "lowercase",
18
- "asciifolding",
17
+ "lowercasepreserveoriginal",
18
+ "asciifoldingpreserveoriginal",
19
19
  "edgegrams"
20
20
  ]
21
21
  },
@@ -24,8 +24,8 @@
24
24
  "type": "custom",
25
25
  "char_filter": ["strip_special_chars"],
26
26
  "filter": [
27
- "lowercase",
28
- "asciifolding"
27
+ "lowercasepreserveoriginal",
28
+ "asciifoldingpreserveoriginal"
29
29
  ]
30
30
  }
31
31
  },
@@ -40,11 +40,11 @@
40
40
  }
41
41
  },
42
42
  "filter": {
43
- "lowercase": {
43
+ "lowercasepreserveoriginal": {
44
44
  "type": "lowercase",
45
45
  "preserve_original": true
46
46
  },
47
- "asciifolding": {
47
+ "asciifoldingpreserveoriginal": {
48
48
  "type": "asciifolding",
49
49
  "preserve_original": true
50
50
  },
@@ -13,7 +13,7 @@
13
13
  from functools import partial
14
14
 
15
15
  from invenio_i18n import get_locale
16
- from marshmallow import Schema, fields, pre_load
16
+ from marshmallow import EXCLUDE, Schema, fields, pre_load
17
17
  from marshmallow_utils.fields import IdentifierSet, SanitizedUnicode
18
18
  from marshmallow_utils.schemas import IdentifierSchema
19
19
 
@@ -59,6 +59,14 @@ class SubjectSchema(BaseVocabularySchema):
59
59
  class SubjectRelationSchema(ContribVocabularyRelationSchema):
60
60
  """Schema to define an optional subject relation in another schema."""
61
61
 
62
+ # If re-running an OpenAIRE awards update on existing awards which already have subjects,
63
+ # the subject entries will contains `scheme` and `props`, which are unknown since they are `dump_only`.
64
+ # This makes the update exclude unknown field and go through with the update.
65
+ class Meta:
66
+ """Metadata class."""
67
+
68
+ unknown = EXCLUDE
69
+
62
70
  ftf_name = "subject"
63
71
  parent_field_name = "subjects"
64
72
  subject = SanitizedUnicode()
@@ -87,23 +87,8 @@ class ServiceWriter(BaseWriter):
87
87
  def _do_update(self, entry):
88
88
  vocab_id = self._entry_id(entry)
89
89
  current = self._resolve(vocab_id)
90
- combined_dict = current.to_dict()
91
-
92
- # Update fields from entry
93
- for key, value in entry.items():
94
- if key in combined_dict:
95
- if isinstance(combined_dict[key], list) and isinstance(value, list):
96
- combined_dict[key].extend(
97
- item for item in value if item not in combined_dict[key]
98
- )
99
- else:
100
- combined_dict[key] = value
101
- else:
102
- combined_dict[key] = value
103
-
104
- return StreamEntry(
105
- self._service.update(self._identity, vocab_id, combined_dict)
106
- )
90
+ updated = dict(current.to_dict(), **entry)
91
+ return StreamEntry(self._service.update(self._identity, vocab_id, updated))
107
92
 
108
93
  def write(self, stream_entry, *args, **kwargs):
109
94
  """Writes the input entry using a given service."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: invenio-vocabularies
3
- Version: 6.4.0
3
+ Version: 6.5.0
4
4
  Summary: Invenio module for managing vocabularies.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-vocabularies
6
6
  Author: CERN
@@ -83,6 +83,17 @@ https://invenio-vocabularies.readthedocs.io/
83
83
  Changes
84
84
  =======
85
85
 
86
+ Version v6.5.0 (released 2024-10-31)
87
+
88
+ - subjects: euroscivoc: change default to latest version-less URL
89
+ - Rename patched filters so the normalizer uses the default ones (#409)
90
+ * rename patched filters so the normalizer uses the default ones
91
+
92
+ Version v6.4.1 (released 2024-10-15)
93
+
94
+ - fix: exclude unknown fields when updating awards with subjects
95
+ - fix: revert generic writer and define OpenAIRE awards writer logic
96
+
86
97
  Version v6.4.0 (released 2024-10-15)
87
98
 
88
99
  - jobs: add import awards OpenAIRE; Update CORDIS
@@ -1,6 +1,6 @@
1
- invenio_vocabularies/__init__.py,sha256=jky3oxkIimkLgucO1IDyWkzGZqBqrjPrgFGLkFtnx8s,377
1
+ invenio_vocabularies/__init__.py,sha256=RojgHMHpQAzjFxZhRH31r4GvA4kZAkhfR-T-HZvyrGQ,377
2
2
  invenio_vocabularies/cli.py,sha256=S3lBsLxsSYa83sCDaGZr5mP7TwPvmmwxzzbB13h8VBI,5856
3
- invenio_vocabularies/config.py,sha256=bpNKVgwfb7bgkP5zbmoawnAMD6bHWXIJV-6CpEhi-M8,5752
3
+ invenio_vocabularies/config.py,sha256=l-mKnoZaIO0p-9K2gnlBvExdjzpQw5aU1lFI16ZI4Mk,5614
4
4
  invenio_vocabularies/ext.py,sha256=GujJ4UARd4Fxf4z7zznRk9JAgHamZuYCOdrKU5czg00,5987
5
5
  invenio_vocabularies/factories.py,sha256=mVg4yGKe58e4uS8rYe0DmIO6oMpmtNTcK3wH9eM5jVU,4380
6
6
  invenio_vocabularies/fixtures.py,sha256=nNWwH04HFASjfj1oy5kMdcQGKmVjzUuA5wSw-ER1QAg,1585
@@ -47,7 +47,7 @@ invenio_vocabularies/contrib/affiliations/__init__.py,sha256=rV8YAzBRoSKsBYcVjCN
47
47
  invenio_vocabularies/contrib/affiliations/affiliations.py,sha256=BSEjzAjLq17GGKHyPrgC5VLluvZqVnKMepIiqqLQKzo,2077
48
48
  invenio_vocabularies/contrib/affiliations/api.py,sha256=5nIOvpfcseuAAg2XgblHc8jb7TAdfU79XOBRpL-p398,326
49
49
  invenio_vocabularies/contrib/affiliations/config.py,sha256=kk-zAl7Uyi6N4qVOiCkBD9cN1KKOvDcILDHJ-zoIzJA,2084
50
- invenio_vocabularies/contrib/affiliations/datastreams.py,sha256=vEH6wj951LLa9pSsNb0rS8IVJ1zWbEQDDe0Cu770J9k,5479
50
+ invenio_vocabularies/contrib/affiliations/datastreams.py,sha256=M99qM0R2_Tpa1IR_WC9xI2jHQDaVjvEHSn7Mh17_AHI,6060
51
51
  invenio_vocabularies/contrib/affiliations/facets.py,sha256=w316MGvtdyTpRCPOpCEmMxxLraRkbFFb1VvLkFlEc9o,1229
52
52
  invenio_vocabularies/contrib/affiliations/models.py,sha256=JUcj-1ydc2Cw2Rsc24JwXE3TFBJ_6fivhUYhGq4rT8A,329
53
53
  invenio_vocabularies/contrib/affiliations/resources.py,sha256=DBEbRxQmp-o-PeZlgFG588Q4sGcruuwIL8L9O-SzCes,435
@@ -104,10 +104,10 @@ invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json,sha2
104
104
  invenio_vocabularies/contrib/funders/mappings/__init__.py,sha256=aSr-tZd9rsjet6leeS336gdSdZHXwZKdaPStNtVNQVk,244
105
105
  invenio_vocabularies/contrib/funders/mappings/os-v1/__init__.py,sha256=xXEX3tacmXp0I1KFtDw7ohIahozd2oIGp1UN40IhFic,251
106
106
  invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json,sha256=E7Zp4IHsQGdaxVrksr-SaQtieV7tV0W6-LgGe231G1w,1646
107
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json,sha256=31shkTYZDvx7tSCnOA4OlqRmQ0IEv2qhePJsIStReJo,3385
107
+ invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json,sha256=gx2CkNWNcTxP94iCU9remCrWxR-AmNqloYTh47gwNHQ,3481
108
108
  invenio_vocabularies/contrib/funders/mappings/os-v2/__init__.py,sha256=YvMRlKYTnEmyTzI9smZp_lO3w-zcK-8IpqT-jGUXEEY,251
109
109
  invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json,sha256=E7Zp4IHsQGdaxVrksr-SaQtieV7tV0W6-LgGe231G1w,1646
110
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json,sha256=31shkTYZDvx7tSCnOA4OlqRmQ0IEv2qhePJsIStReJo,3385
110
+ invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json,sha256=gx2CkNWNcTxP94iCU9remCrWxR-AmNqloYTh47gwNHQ,3481
111
111
  invenio_vocabularies/contrib/funders/mappings/v7/__init__.py,sha256=yFHmi3QYD65YKzLU5vMEtwAZn0gwkFYa6Db_tSbHjKE,254
112
112
  invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json,sha256=E7Zp4IHsQGdaxVrksr-SaQtieV7tV0W6-LgGe231G1w,1646
113
113
  invenio_vocabularies/contrib/names/__init__.py,sha256=DBfsM7JMETZGaV5QmXEwE7zhCaAXvc2SZN6uXnW_V-c,451
@@ -139,7 +139,7 @@ invenio_vocabularies/contrib/subjects/datastreams.py,sha256=CiLSTm9PukzLKm34VDmm
139
139
  invenio_vocabularies/contrib/subjects/facets.py,sha256=qQ7_rppFBzsmrlZu4-MvOIdUcjeOmDA9gOHAcs0lWwI,695
140
140
  invenio_vocabularies/contrib/subjects/models.py,sha256=8XgbVRxDDvhWPjMWsoCriNlOKdmV_113a14yLRtlvM4,363
141
141
  invenio_vocabularies/contrib/subjects/resources.py,sha256=0KRfUMizwgIziZybk4HnIjiSsXbrCv_XmguNPwnxoo8,506
142
- invenio_vocabularies/contrib/subjects/schema.py,sha256=5pM9FFVdeb1nUuTwr2SqkUJh-oHIjYN-EXXI8_SSjCQ,2446
142
+ invenio_vocabularies/contrib/subjects/schema.py,sha256=MtJ-YijukyK77MlCayGHJbjEMf7YTiRAS9nfFJ3YAyI,2813
143
143
  invenio_vocabularies/contrib/subjects/services.py,sha256=s1U6HMmpjuz7rrgR0DtT9C28TC6sZEeDTsa4Jh1TXQk,864
144
144
  invenio_vocabularies/contrib/subjects/subjects.py,sha256=NwZycExLyV8l7ikGStH4GOecVuDSxFT70KoNv6qC78I,1877
145
145
  invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py,sha256=e5L9E4l5JHqVzijAX8tn2DIa2n01vJ5wOAZdN62RnIo,247
@@ -162,7 +162,7 @@ invenio_vocabularies/datastreams/factories.py,sha256=H8a2gAy7KNImtdCdtqpVKC5gIvE
162
162
  invenio_vocabularies/datastreams/readers.py,sha256=Gr_KbN-tZtoQ8R4TJG4dTBTE8028eLRlcxSv2-IqI9c,11386
163
163
  invenio_vocabularies/datastreams/tasks.py,sha256=0fuH_PRt9Ncv6WHM4pkYmfheRVGDKkERZiMPvgV4bZU,1129
164
164
  invenio_vocabularies/datastreams/transformers.py,sha256=0ymZiHtNtgfYxt2MIjthtSzikRH1jAqhIAZ1yScoAHs,1733
165
- invenio_vocabularies/datastreams/writers.py,sha256=PO9UPQ8rT4pstfoCiB-zCfuvCNOHRgFbysq6-spXm34,7218
165
+ invenio_vocabularies/datastreams/writers.py,sha256=FMTQdGavRgq6Qk21UcifYeDVH3jUA3rmwdyICr1ywxU,6719
166
166
  invenio_vocabularies/datastreams/xml.py,sha256=HFa-lfxj7kFrr2IjeN1jxSLDfcvpBwO9nZLZF2-BryE,997
167
167
  invenio_vocabularies/records/__init__.py,sha256=Uj7O6fYdAtLOkLXUGSAYPADBB7aqP4yVs9b6OAjA158,243
168
168
  invenio_vocabularies/records/api.py,sha256=Lynt6Sz4BVN1orh0zgJ5ljhnUobEtcq8c22PmSeUo2U,1494
@@ -297,10 +297,10 @@ invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo,sha256=g1I5aNO8r
297
297
  invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po,sha256=vg8qC8ofpAdJ3mQz7mWM1ylKDpiNWXFs7rlMdSPkgKk,4629
298
298
  invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo,sha256=cqSm8NtMAwrP9O6qbmtkDtRT1e9D93qpsJN5X9_PPVw,600
299
299
  invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po,sha256=9ACePz_EpB-LfcIJajZ2kp8Q04tcdrQLOtug162ZUss,4115
300
- invenio_vocabularies-6.4.0.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
301
- invenio_vocabularies-6.4.0.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
302
- invenio_vocabularies-6.4.0.dist-info/METADATA,sha256=bex12nauN9gFRDmQpgZPHPfhUM3Hrdd7K41hGPwogsI,10260
303
- invenio_vocabularies-6.4.0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
304
- invenio_vocabularies-6.4.0.dist-info/entry_points.txt,sha256=xskfdwhOV074XHL1g8x8BZ6BNsdZ6D7XPVqcU5JqB2g,3118
305
- invenio_vocabularies-6.4.0.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
306
- invenio_vocabularies-6.4.0.dist-info/RECORD,,
300
+ invenio_vocabularies-6.5.0.dist-info/AUTHORS.rst,sha256=8d0p_WWE1r9DavvzMDi2D4YIGBHiMYcN3LYxqQOj8sY,291
301
+ invenio_vocabularies-6.5.0.dist-info/LICENSE,sha256=UvI8pR8jGWqe0sTkb_hRG6eIrozzWwWzyCGEpuXX4KE,1062
302
+ invenio_vocabularies-6.5.0.dist-info/METADATA,sha256=VRg_aDoS0NrNaNMJTEiX-k-kMCuSMDKo7pQBHgOjP9I,10679
303
+ invenio_vocabularies-6.5.0.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
304
+ invenio_vocabularies-6.5.0.dist-info/entry_points.txt,sha256=xskfdwhOV074XHL1g8x8BZ6BNsdZ6D7XPVqcU5JqB2g,3118
305
+ invenio_vocabularies-6.5.0.dist-info/top_level.txt,sha256=x1gRNbaODF_bCD0SBLM3nVOFPGi06cmGX5X94WKrFKk,21
306
+ invenio_vocabularies-6.5.0.dist-info/RECORD,,