Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
559 changes: 559 additions & 0 deletions datacite/schema46.py

Large diffs are not rendered by default.

636 changes: 636 additions & 0 deletions datacite/schemas/datacite-v4.6.json

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ Errors
.. automodule:: datacite.errors
:members:

DataCite v4.6 Metadata Management
==================================

.. automodule:: datacite.schema46
:members: dump_etree, tostring, validate

DataCite v4.5 Metadata Management
==================================

Expand Down
51 changes: 50 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ def example_json_file45():
return file.read()


@pytest.fixture
def example_json_file46():
"""Load DataCite v4.6 full example JSON."""
path = dirname(__file__)
with open(join(path, "data", "datacite-v4.6-full-example.json")) as file:
return file.read()


@pytest.fixture
def example_json40(example_json_file40):
"""Load the DataCite v4.0 full example into a dict."""
Expand Down Expand Up @@ -108,6 +116,12 @@ def example_json45(example_json_file45):
return json.loads(example_json_file45)


@pytest.fixture
def example_json46(example_json_file46):
"""Load the DataCite v4.6 full example into a dict."""
return json.loads(example_json_file46)


def load_xml(filename):
"""Helper method for loading the XML example file."""
path = dirname(__file__)
Expand Down Expand Up @@ -146,6 +160,12 @@ def example_xml_file45():
return load_xml("datacite-v4.5-full-example.xml")


@pytest.fixture
def example_xml_file46():
"""Load DataCite v4.6 full example XML."""
return load_xml("datacite-v4.6-full-example.xml")


@pytest.fixture
def example_xml40(example_xml_file40):
"""Load DataCite v4.0 full example as an etree."""
Expand All @@ -172,10 +192,16 @@ def example_xml43(example_xml_file43):

@pytest.fixture
def example_xml45(example_xml_file45):
"""Load DataCite v4.3 full example as an etree."""
"""Load DataCite v4.5 full example as an etree."""
return etree.fromstring(example_xml_file45.encode("utf-8"))


@pytest.fixture
def example_xml46(example_xml_file46):
"""Load DataCite v4.6 full example as an etree."""
return etree.fromstring(example_xml_file46.encode("utf-8"))


def _load_xsd(xsd_filename):
"""Load one of the XSD schemas."""
return etree.XMLSchema(
Expand Down Expand Up @@ -213,6 +239,12 @@ def xsd45():
return _load_xsd("4.5/metadata.xsd")


@pytest.fixture(scope="session")
def xsd46():
"""Load DataCite v4.6 full example as an etree."""
return _load_xsd("4.6/metadata.xsd")


@pytest.fixture(scope="function")
def minimal_json42():
"""Minimal valid JSON for DataCite 4.2."""
Expand Down Expand Up @@ -270,3 +302,20 @@ def minimal_json45():
"schemaVersion": "http://datacite.org/schema/kernel-4",
"url": "https://www.example.com",
}


@pytest.fixture(scope="function")
def minimal_json46():
"""Minimal valid JSON for DataCite 4.6."""
return {
"doi": "10.1234/foo.bar",
"creators": [
{"name": "Nielsen, Lars Holm"},
],
"titles": [{"title": "Minimal Test Case"}],
"publisher": {"name": "Invenio Software"},
"publicationYear": "2016",
"types": {"resourceType": "", "resourceTypeGeneral": "Software"},
"schemaVersion": "http://datacite.org/schema/kernel-4",
"url": "https://www.example.com",
}
201 changes: 201 additions & 0 deletions tests/data/4.6/datacite-example-dataset-v4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"doi": "10.82433/9184-dy35",
"prefix": "10.82433",
"suffix": "9184-dy35",
"alternateIdentifiers": [],
"creators": [
{
"name": "National Gallery",
"nameType": "Organizational",
"affiliation": [],
"nameIdentifiers": [
{
"schemeUri": "https://ror.org",
"nameIdentifier": "https://ror.org/043kfff89",
"nameIdentifierScheme": "ROR"
}
]
}
],
"titles": [
{
"lang": "en",
"title": "External Environmental Data, 2010-2020, National Gallery"
}
],
"publisher": {
"lang": "en",
"name": "National Gallery",
"schemeUri": "https://ror.org/",
"publisherIdentifier": "https://ror.org/043kfff89",
"publisherIdentifierScheme": "ROR"
},
"container": {},
"publicationYear": "2022",
"subjects": [
{
"subject": "FOS: Earth and related environmental sciences",
"schemeUri": "http://www.oecd.org/science/inno/38235147.pdf",
"subjectScheme": "Fields of Science and Technology (FOS)"
},
{
"subject": "temperature",
"valueUri": "https://www.wikidata.org/wiki/Q11466",
"schemeUri": "https://www.wikidata.org/wiki",
"subjectScheme": "Wikidata"
},
{
"subject": "relative humidity",
"valueUri": "http://vocab.getty.edu/aat/300192097",
"schemeUri": "http://vocab.getty.edu/aat",
"subjectScheme": "Art and Architecture Thesaurus"
},
{
"subject": "illuminance",
"valueUri": "https://www.wikidata.org/wiki/Q194411",
"schemeUri": "https://www.wikidata.org/wiki",
"subjectScheme": "Wikidata"
},
{
"subject": "moisture content",
"valueUri": "http://vocab.getty.edu/aat/300379432",
"schemeUri": "http://vocab.getty.edu/aat",
"subjectScheme": "Art and Architecture Thesaurus"
},
{
"subject": "Environmental monitoring",
"valueUri": "http://id.worldcat.org/fast/913214",
"schemeUri": "http://id.worldcat.org/fast",
"subjectScheme": "FAST"
}
],
"contributors": [
{
"name": "Padfield, Joseph",
"nameType": "Personal",
"givenName": "Joseph",
"familyName": "Padfield",
"affiliation": [
{
"name": "National Gallery",
"affiliationIdentifier": "https://ror.org/043kfff89",
"affiliationIdentifierScheme": "ROR"
}
],
"contributorType": "ContactPerson",
"nameIdentifiers": [
{
"schemeUri": "https://orcid.org",
"nameIdentifier": "https://orcid.org/0000-0002-2572-6428",
"nameIdentifierScheme": "ORCID"
}
]
},
{
"name": "Building Facilities Department",
"nameType": "Organizational",
"affiliation": [
{
"name": "National Gallery",
"affiliationIdentifier": "https://ror.org/043kfff89",
"affiliationIdentifierScheme": "ROR"
}
],
"contributorType": "DataCollector",
"nameIdentifiers": []
}
],
"dates": [
{
"date": "2010/2020",
"dateType": "Collected"
},
{
"date": "2010/2020",
"dateType": "Coverage"
},
{
"date": "2022",
"dateType": "Issued"
}
],
"language": "en",
"types": {
"resourceType": "Environmental data",
"resourceTypeGeneral": "Dataset"
},
"relatedIdentifiers": [
{
"relationType": "IsSupplementTo",
"relatedIdentifier": "https://www.nationalgallery.org.uk/research/research-resources/research-papers/improving-our-environment",
"resourceTypeGeneral": "Report",
"relatedIdentifierType": "URL"
},
{
"relationType": "IsSourceOf",
"relatedIdentifier": "https://research.ng-london.org.uk/scientific/env/",
"resourceTypeGeneral": "InteractiveResource",
"relatedIdentifierType": "URL"
},
{
"relationType": "IsSupplementedBy",
"relatedIdentifier": "10.1080/00393630.2018.1504449/",
"resourceTypeGeneral": "JournalArticle",
"relatedIdentifierType": "DOI"
},
{
"relationType": "IsDocumentedBy",
"relatedIdentifier": "10.5281/zenodo.7629200",
"resourceTypeGeneral": "ConferencePaper",
"relatedIdentifierType": "DOI"
}
],
"relatedItems": [],
"sizes": [
"13.6 MB"
],
"formats": [
"application/json"
],
"version": "1.0",
"rightsList": [
{
"lang": "en",
"rights": "Creative Commons Attribution 4.0 International",
"rightsUri": "https://creativecommons.org/licenses/by/4.0/legalcode",
"schemeUri": "https://spdx.org/licenses/",
"rightsIdentifier": "cc-by-4.0",
"rightsIdentifierScheme": "SPDX"
}
],
"descriptions": [
{
"lang": "en",
"description": "The National Gallery houses one of the greatest ‒ and most visited ‒ collections of Western European painting, often welcoming more than 6 million visitors a year. The Scientific Department researches the history of materials and techniques and their degradation mechanisms (fading, darkening, etc.), through analysis using a range of micro-analytical and imaging methods. It also works in the fields of preventive conservation and environmental management of galleries (monitoring, lighting, vibration), as well as the development of a wide range of new instruments and methods (both analytical and imaging) for technical examination of artworks, most often in collaboration with universities. The examination of the environmental conditions within The National Gallery began soon after it was established in 1824. Early concerns often related to dust and pollution. The first electronic data logger, recording light levels, was introduced in 1975, with the regular logging of temperature and relative humidity followed soon after. Today the Gallery has hundreds of sensors, monitoring the environmental conditions in over hundreds of locations, 24/7. The National Gallery currently archives millions of environmental readings every year, which are used to monitor the Gallery conditions ensuring the on-going care of the collections. These readings are also used to examine long term environmental trends, manage additional events, and within the planning and management of preventive conservation work and research at the National Gallery. The National Gallery Environmental Database is an internal, bespoke system which has been developed, over the last 20 years, to act as an archive for all of these environmental readings. This dataset contains a selected range of the data gathered from a few of the external sensors that have been used to monitor ambient light levels, temperature, relative humidity and air moisture content 24 hours a day, 7 days a week over the last two decades.",
"descriptionType": "Abstract"
}
],
"geoLocations": [
{
"geoLocationPlace": "Roof of National Gallery, London, UK",
"geoLocationPoint": {
"pointLatitude": 51.50872,
"pointLongitude": -0.12841
}
}
],
"fundingReferences": [
{
"awardUri": "https://cordis.europa.eu/project/id/871034",
"awardTitle": "Integrating Platforms for the European Research Infrastructure ON Heritage Science",
"funderName": "H2020 Excellent Science",
"awardNumber": "871034",
"funderIdentifier": "https://doi.org/10.13039/100010662",
"funderIdentifierType": "Crossref Funder ID"
}
],
"url": "https://research.ng-london.org.uk/scientific/env/External%20Environmental%20Data%202010-2020%20National%20Gallery%20V1.0.json",
"schemaVersion": "http://datacite.org/schema/kernel-4"
}


80 changes: 80 additions & 0 deletions tests/data/4.6/datacite-example-dataset-v4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example: Dataset -->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
<identifier identifierType="DOI">10.82433/9184-DY35</identifier>
<creators>
<creator>
<creatorName nameType="Organizational">National Gallery</creatorName>
<nameIdentifier nameIdentifierScheme="ROR" schemeURI="https://ror.org">https://ror.org/043kfff89</nameIdentifier>
</creator>
</creators>
<titles>
<title xml:lang="en">External Environmental Data, 2010-2020, National Gallery</title>
</titles>
<publisher xml:lang="en" publisherIdentifier="https://ror.org/043kfff89" publisherIdentifierScheme="ROR" schemeURI="https://ror.org/">National Gallery</publisher>
<publicationYear>2022</publicationYear>
<resourceType resourceTypeGeneral="Dataset">Environmental data</resourceType>
<subjects>
<subject subjectScheme="Fields of Science and Technology (FOS)" schemeURI="http://www.oecd.org/science/inno/38235147.pdf">FOS: Earth and related environmental sciences</subject>
<subject subjectScheme="Wikidata" schemeURI="https://www.wikidata.org/wiki" valueURI="https://www.wikidata.org/wiki/Q11466">temperature</subject>
<subject subjectScheme="Art and Architecture Thesaurus" schemeURI="http://vocab.getty.edu/aat" valueURI="http://vocab.getty.edu/aat/300192097">relative humidity</subject>
<subject subjectScheme="Wikidata" schemeURI="https://www.wikidata.org/wiki" valueURI="https://www.wikidata.org/wiki/Q194411">illuminance</subject>
<subject subjectScheme="Art and Architecture Thesaurus" schemeURI="http://vocab.getty.edu/aat" valueURI="http://vocab.getty.edu/aat/300379432">moisture content</subject>
<subject subjectScheme="FAST" schemeURI="http://id.worldcat.org/fast" valueURI="http://id.worldcat.org/fast/913214">Environmental monitoring</subject>
</subjects>
<contributors>
<contributor contributorType="ContactPerson">
<contributorName nameType="Personal">Padfield, Joseph</contributorName>
<givenName>Joseph</givenName>
<familyName>Padfield</familyName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI="https://orcid.org">https://orcid.org/0000-0002-2572-6428</nameIdentifier>
<affiliation affiliationIdentifier="https://ror.org/043kfff89" affiliationIdentifierScheme="ROR">National Gallery</affiliation>
</contributor>
<contributor contributorType="DataCollector">
<contributorName nameType="Organizational">Building Facilities Department</contributorName>
<affiliation affiliationIdentifier="https://ror.org/043kfff89" affiliationIdentifierScheme="ROR">National Gallery</affiliation>
</contributor>
</contributors>
<dates>
<date dateType="Collected">2010/2020</date>
<date dateType="Coverage">2010/2020</date>
<date dateType="Issued">2022</date>
</dates>
<language>en</language>
<relatedIdentifiers>
<relatedIdentifier relatedIdentifierType="URL" relationType="IsSupplementTo" resourceTypeGeneral="Report">https://www.nationalgallery.org.uk/research/research-resources/research-papers/improving-our-environment</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="URL" relationType="IsSourceOf" resourceTypeGeneral="InteractiveResource">https://research.ng-london.org.uk/scientific/env/</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsSupplementedBy" resourceTypeGeneral="JournalArticle">10.1080/00393630.2018.1504449/</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsDocumentedBy" resourceTypeGeneral="ConferencePaper">10.5281/zenodo.7629200</relatedIdentifier>
</relatedIdentifiers>
<sizes>
<size>13.6 MB</size>
</sizes>
<formats>
<format>application/json</format>
</formats>
<version>1.0</version>
<rightsList>
<rights xml:lang="en" schemeURI="https://spdx.org/licenses/" rightsIdentifierScheme="SPDX" rightsIdentifier="CC-BY-4.0" rightsURI="https://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution Non Commercial 4.0 International</rights>
</rightsList>
<descriptions>
<description xml:lang="en" descriptionType="Abstract">The National Gallery houses one of the greatest ‒ and most visited ‒ collections of Western European painting, often welcoming more than 6 million visitors a year. The Scientific Department researches the history of materials and techniques and their degradation mechanisms (fading, darkening, etc.), through analysis using a range of micro-analytical and imaging methods. It also works in the fields of preventive conservation and environmental management of galleries (monitoring, lighting, vibration), as well as the development of a wide range of new instruments and methods (both analytical and imaging) for technical examination of artworks, most often in collaboration with universities. The examination of the environmental conditions within The National Gallery began soon after it was established in 1824. Early concerns often related to dust and pollution. The first electronic data logger, recording light levels, was introduced in 1975, with the regular logging of temperature and relative humidity followed soon after. Today the Gallery has hundreds of sensors, monitoring the environmental conditions in over hundreds of locations, 24/7. The National Gallery currently archives millions of environmental readings every year, which are used to monitor the Gallery conditions ensuring the on-going care of the collections. These readings are also used to examine long term environmental trends, manage additional events, and within the planning and management of preventive conservation work and research at the National Gallery. The National Gallery Environmental Database is an internal, bespoke system which has been developed, over the last 20 years, to act as an archive for all of these environmental readings. This dataset contains a selected range of the data gathered from a few of the external sensors that have been used to monitor ambient light levels, temperature, relative humidity and air moisture content 24 hours a day, 7 days a week over the last two decades.</description>
</descriptions>
<geoLocations>
<geoLocation>
<geoLocationPlace>Roof of National Gallery, London, UK</geoLocationPlace>
<geoLocationPoint>
<pointLatitude>51.50872</pointLatitude>
<pointLongitude>-0.12841</pointLongitude>
</geoLocationPoint>
</geoLocation>
</geoLocations>
<fundingReferences>
<fundingReference>
<funderName>H2020 Excellent Science</funderName>
<funderIdentifier funderIdentifierType="Crossref Funder ID">https://doi.org/10.13039/100010662</funderIdentifier>
<awardNumber awardURI="https://cordis.europa.eu/project/id/871034">871034</awardNumber>
<awardTitle>Integrating Platforms for the European Research Infrastructure ON Heritage Science</awardTitle>
</fundingReference>
</fundingReferences>
</resource>
Loading
Loading