Skip to content

Commit 4a674ac

Browse files
committed
bodc: updated file uri & subject label
1 parent 340ce04 commit 4a674ac

File tree

3 files changed

+42
-40
lines changed

3 files changed

+42
-40
lines changed

invenio_vocabularies/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def is_edmo(val):
196196
)
197197
"""Subject GEMET file download link."""
198198

199-
VOCABULARIES_SUBJECTS_BODC_PUV_FILE_URL = "http://vocab.nerc.ac.uk/collection/P01/current/?_profile=nvs&_mediatype=application/rdf+xml"
199+
VOCABULARIES_SUBJECTS_BODC_PUV_FILE_URL = "http://vocab.nerc.ac.uk/collection/P02/current/?_profile=nvs&_mediatype=application/rdf+xml"
200200
"""Subject BODC-PUV file download link."""
201201

202202
VOCABULARIES_AFFILIATIONS_EDMO_COUNTRY_MAPPING = {

invenio_vocabularies/contrib/subjects/bodc/datastreams.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ def _transform_entry(self, subject, rdf_graph):
7878
else:
7979
raise TransformerError(f"No id found for: {subject}")
8080

81-
alt_labels = [obj for obj in subject_data.get(str(self.skos_core.altLabel), [])]
82-
subject_text = str(alt_labels[0]) if alt_labels else ""
81+
pref_labels = [
82+
obj for obj in subject_data.get(str(self.skos_core.prefLabel), [])
83+
]
84+
85+
if not pref_labels:
86+
raise TransformerError(f"No preferred label found for subject: {subject}")
87+
88+
subject_text = str(pref_labels[0])
8389
definition = str(subject_data.get(str(self.skos_core.definition), [None])[0])
8490

8591
return {

tests/contrib/subjects/bodc/test_subjects_bodc_datastream.py

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,39 @@
2020

2121
VALID_XML_DATA = bytes(
2222
"""<?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:dc="http://purl.org/dc/terms/" xmlns:dce="http://purl.org/dc/elements/1.1/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:grg="http://www.isotc211.org/schemas/grg/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:void="http://rdfs.org/ns/void#" xmlns:pav="http://purl.org/pav/" xmlns:prov="https://www.w3.org/ns/prov#" xmlns:reg="http://purl.org/linked-data/registry#" xmlns:cpm="http://purl.org/voc/cpm#" xmlns:qudt="https://qudt.org/2.1/schema/qudt#" xmlns:semapv="http://w3id.org/semapv/vocab/" xmlns:iop="https://w3id.org/iadopt/ont#" xmlns:sssom="https://w3id.org/sssom/schema/" xmlns:puv="https://w3id.org/env/puv#">
23-
<skos:Collection rdf:about="http://vocab.nerc.ac.uk/collection/P01/current/">
24-
<skos:prefLabel>BODC Parameter Usage Vocabulary</skos:prefLabel>
25-
<dc:title>BODC Parameter Usage Vocabulary</dc:title>
26-
<skos:altLabel>BODC PUV</skos:altLabel>
27-
<dc:alternative>BODC PUV</dc:alternative>
28-
<dc:description>Terms built using the BODC parameter semantic model designed to describe individual measured phenomena. May be used to mark up sets of data such as a NetCDF array or spreadsheet column. Units must be specified when using a P01 code. The P06 unit that is linked to individual P01 in the NVS is the one used in BODC's systems but external users can use any appropriate units.</dc:description>
29-
<dc:license rdf:resource="https://creativecommons.org/licenses/by/4.0/"/>
30-
<skos:member>
31-
<skos:Concept xml:base="http://vocab.nerc.ac.uk/collection/P01/current/SAGEMSFM/" rdf:about="http://vocab.nerc.ac.uk/collection/P01/current/SAGEMSFM/">
32-
<dc:identifier>SDN:P01::SAGEMSFM</dc:identifier>
33-
<dce:identifier>SDN:P01::SAGEMSFM</dce:identifier>
34-
<dc:date>2008-10-16 16:27:06.0</dc:date>
35-
<skos:notation>SDN:P01::SAGEMSFM</skos:notation>
36-
<skos:prefLabel xml:lang="en">14C age of Foraminiferida (ITIS: 44030: WoRMS 22528) [Subcomponent: tests] in sediment by picking and accelerator mass spectrometry</skos:prefLabel>
37-
<skos:altLabel>AMSSedAge</skos:altLabel>
38-
<skos:definition xml:lang="en">Accelerated mass spectrometry on picked tests</skos:definition>
39-
<owl:versionInfo>1</owl:versionInfo>
40-
<pav:hasCurrentVersion rdf:resource="http://vocab.nerc.ac.uk/collection/P01/current/SAGEMSFM/1/"/>
41-
<pav:version>1</pav:version>
42-
<pav:authoredOn>2008-10-16 16:27:06.0</pav:authoredOn>
43-
<skos:note xml:lang="en">accepted</skos:note>
44-
<owl:deprecated>false</owl:deprecated>
45-
<iop:hasMatrix rdf:resource="http://vocab.nerc.ac.uk/collection/S21/current/S21S022/"/>
46-
<skos:related rdf:resource="http://vocab.nerc.ac.uk/collection/P06/current/UYBP/"/>
47-
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/S25/current/BE002325/"/>
48-
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/S26/current/MAT00136/"/>
49-
<void:inDataset rdf:resource="http://vocab.nerc.ac.uk/.well-known/void"/>
50-
</skos:Concept>
51-
</skos:member>
52-
</skos:Collection>
23+
<rdf:Description rdf:about="http://vocab.nerc.ac.uk/collection/P02/current/QDMD/">
24+
<pav:authoredOn>2008-08-15 10:07:03.0</pav:authoredOn>
25+
<pav:hasCurrentVersion rdf:resource="http://vocab.nerc.ac.uk/collection/P02/current/QDMD/1/"/>
26+
<dce:identifier>SDN:P02::QDMD</dce:identifier>
27+
<pav:version>1</pav:version>
28+
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/C47/current/IN6_1_2/"/>
29+
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/P22/current/19/"/>
30+
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
31+
<skos:definition xml:lang="en">Parameters quantifying the amount of liquids (e.g. ship's ballast) or solids (e.g. dredge spoil) deposited into the water column as a result of man's activities</skos:definition>
32+
<void:inDataset rdf:resource="http://vocab.nerc.ac.uk/.well-known/void"/>
33+
<owl:deprecated>false</owl:deprecated>
34+
<skos:note xml:lang="en">accepted</skos:note>
35+
<dc:identifier>SDN:P02::QDMD</dc:identifier>
36+
<skos:prefLabel xml:lang="en">Quantity of material dumped</skos:prefLabel>
37+
<owl:versionInfo>1</owl:versionInfo>
38+
<dc:date>2008-08-15 10:07:03.0</dc:date>
39+
<skos:altLabel>Amount_dumped</skos:altLabel>
40+
<skos:inScheme rdf:resource="http://vocab.nerc.ac.uk/scheme/EDMED_DCAT_THEMES/current/"/>
41+
<skos:notation>SDN:P02::QDMD</skos:notation>
42+
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/D01/current/D0100001/"/>
43+
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/L19/current/005/"/>
44+
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/P03/current/H001/"/>
45+
<skos:broader rdf:resource="http://vocab.nerc.ac.uk/collection/P05/current/007/"/>
46+
</rdf:Description>
5347
</rdf:RDF>""",
5448
encoding="utf-8",
5549
)
5650

5751
INVALID_XML_DATA = bytes(
5852
"""<?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#">
59-
<skos:Collection rdf:about="http://vocab.nerc.ac.uk/collection/P01/current/">
53+
<skos:Collection rdf:about="http://vocab.nerc.ac.uk/collection/P02/current/">
6054
<skos:member>
61-
<skos:Concept rdf:about="http://vocab.nerc.ac.uk/collection/P01/current/SAGEMSFM/">
55+
<skos:Concept rdf:about="http://vocab.nerc.ac.uk/collection/P02/current/QDMD/">
6256
<skos:prefLabel>Invalid Data</skos:prefLabel>
6357
<!-- No skos:notation present -->
6458
</skos:Concept>
@@ -73,17 +67,19 @@
7367
def expected_from_rdf():
7468
return [
7569
{
76-
"id": "SDN:P01::SAGEMSFM",
70+
"id": "SDN:P02::QDMD",
7771
"scheme": "BODC-PUV",
78-
"subject": "AMSSedAge",
72+
"subject": "Quantity of material dumped",
7973
"title": {
80-
"en": "14c age of foraminiferida (itis: 44030: worms 22528) [subcomponent: tests] in sediment by picking and accelerator mass spectrometry",
74+
"en": "Quantity of material dumped",
75+
},
76+
"props": {
77+
"definition": "Parameters quantifying the amount of liquids (e.g. ship's ballast) or solids (e.g. dredge spoil) deposited into the water column as a result of man's activities"
8178
},
82-
"props": {"definition": "Accelerated mass spectrometry on picked tests"},
8379
"identifiers": [
8480
{
8581
"scheme": "url",
86-
"identifier": "http://vocab.nerc.ac.uk/collection/P01/current/SAGEMSFM/",
82+
"identifier": "http://vocab.nerc.ac.uk/collection/P02/current/QDMD/",
8783
}
8884
],
8985
}

0 commit comments

Comments
 (0)