Skip to content

Metadata standards

Intent and scope

Most projects reach Data Director with no metadata record a repository would accept, so the Metadata Librarian drafts one (Drafting documents). A repository expects its own standard: re3data lists Dublin Core for 17 repositories and DataCite for 13, the NERC EDS centres expect UK GEMINI on ISO 19115, and social science archives expect DDI. The Librarian must be able to draft in whichever standard the chosen repository's requirements follow, without a new drafter for each, and without any one standard becoming the format of the tool.

This spec says what a metadata standard is to Data Director, where each part of it lives, how a record is written, read and checked in any standard, and how a record is carried from one standard to another. It does not cover what a repository asks beyond its standard, which is a requirement set (Deposit); what a drafter may infer, ask and write (Drafting documents); or how a record reaches a repository (Deposit, Packagers and transports).

It does not cover reading a record a researcher already has, or extracting metadata from data files (#789). The design leaves room for both: a standard's definition is the place to say how a record in it is recognised, and the codecs are shared. Neither is built or specified here.

What is built. The library metadata-records/ holds a JSON codec, an XML codec, and two standards' definitions: DataCite's in its JSON form, and Dublin Core's 15 elements as OAI-DC XML. The harness reads an approved record through it to validate it, describe the package's root dataset and render the Zenodo item, and refuses a record in a pair of standard and serialisation no registered definition covers. The Documentation Editor and the FAIR Assessor read records through the pivot. The Metadata Librarian drafts in whichever registered standard the merged set follows, from its definition alone: its value keys, its drafting block, and the researchers' ORCID records written into the standard's own keys from pivot terms. The harness converts an approved record to another registered standard through the pivot and keeps the result as a package derived from it, and the Repository tab offers it. UK GEMINI is TODO(#1361). A requirement set's field may leave out its term, and a field that names one is checked against the definition. A statement below that the code does not yet meet is marked in place.

Invariants

  1. A record is in one standard and one serialisation, and says which. A metadata record is a Document of kind metadata_record whose conforms_to names its standard and whose media_type names its serialisation. The harness accepts a record only for a pair that a registered standard defines, and refuses any other before it is validated or packaged.
  2. The record is the record of truth. Every other form of its content, the pivot graph, a conversion, a platform's item, is derived from it, kept by its digest, never edited and never a document (Deposit, invariant 16). A conversion is never approved in the record's place.
  3. A standard is a definition, not code. Adding a standard adds a definition, and a codec only if its serialisation has none. No module outside a standard's own definition names one of its properties. A check fails a module that does, as scripts/check_boundaries.py fails an undeclared import: scripts/check_standard_keys.py reports a string literal in a member's src/ that is a distinctive identifier of a definition (a camelCase or dotted property path, value key, part key or qualifier key).
  4. A codec knows no standard, and writes the same bytes for the same tree. A codec parses a serialisation into a generic tree and writes a tree back to it. Approval, the package and a deposit name a record by its digest, so a codec's output is deterministic, and its identifier names one serialisation for good: a changed output is a new identifier, as a canonicalisation keeps its bytes (Evidence and grounding).
  5. A property has one name, the standard's own, in every serialisation. A standard's property is identified by the path the standard uses for it in its logical model, such as DataCite's titles[0].title, whatever serialisation wrote the record. Requirement sets, the drafter's questions and their identifiers use that path, so a question has the same identifier in a JSON draft and an XML draft of the same standard.
  6. A placeholder is never a value, in any serialisation. A drafted record has a gap where the researcher must say something (Drafting documents, invariant 2). Each standard says how its serialisations write a gap, and every reader, including the validation, the package and the Documentation Editor, takes it as no value.
  7. The pivot uses terms that already exist. A standard's property maps to a term of an existing vocabulary, such as schema.org, Dublin Core Terms, DCAT or PROV-O, named by its IRI, and none is invented (Contract, Vocabularies). A property with no such term has no pivot term: it is not validated through the pivot and a conversion reports it as unplaced.
  8. Two fields of a merged requirement set never share a term, as before (Deposit, invariant 4), now over the expanded IRI. A standard's definition may map two properties to one term, as DataCite's descriptions of different types are, and a set that names both is refused on load.
  9. A conversion reports every loss and invents nothing. Converting a record goes through the pivot. It reports each value it could not place and each it placed less precisely, with the reason, and a property the target requires that the source cannot supply is a question for the researcher, never a value the converter chose (metadata-records/tests/test_convert.py, harness/tests/test_conversion.py, app/tests/test_conversions_route.py).
  10. No model writes a mapping, converts a record or writes a value at run time. A standard's definition is a file a person reviews, as a requirement set is, and a drafter follows Drafting documents: it infers only from the project's facts, asks for the rest, and a model suggests only beside a question.
  11. A standard is available by being registered. Standards and codecs are registered by entry point, by identifier, as transports are (Deposit, invariant 17). Unlike a transport, a standard sends nothing outside the deployment, so the profile does not choose which registered standards are offered. A requirement set that names a standard that is not registered stops start-up, as a pair of transport and format the table does not allow does.
  12. A choice records the definition it used. The project log names the standard's definition by <standard_id>@v<version> and the SHA-256 of its file, and its codec by identifier, as it names each requirement set (Deposit, invariant 6). A definition's version is raised on every change; nothing checks this. The repository_chosen event records it as standard, with ref, sha256 and the codec of each serialisation by media type.
  13. A parser reads only the record. An XML codec resolves no external entity or DTD, fetches nothing, and refuses input over a size limit. A record is a few kilobytes, and a parser that follows what the document says is a way to read or reach what a researcher did not mean to share.

Boundaries and contracts

Three layers. A record passes through them in this order, and each knows nothing of the one after it.

  1. A codec turns a serialisation into a generic tree and back: JSON first, then XML. It is identified by its media type and knows no standard.
  2. A standard's definition says how a standard's logical model is written in each serialisation it has, and what each property means in the pivot.
  3. The pivot is the graph a record is read as, so that a record in any standard can be checked and described in the same terms.

A standard's definition. One file per standard, shipped with the library that holds the codecs and versioned by its own version. It says:

  • which conforms_to URIs it covers and which serialisations, each with its codec;
  • its properties, by their path in its logical model, and for each one that repeats, the key or element that holds its value;
  • where each property is in each serialisation;
  • the pivot term each property maps to, if it has one, and the source of the mapping, as a set cites its guidance (DataCite's published mapping to schema.org, for instance);
  • how a gap is written in each serialisation (invariant 6);
  • optionally, for a drafter, what to ask about each property, what fills itself by rule, what a person must decide may be published before the value is asked, and which properties a model may suggest a value for. It is advice to a drafter and a ceiling, not a licence: the drafter's own rules in Drafting documents still apply. Which of a README's shared fields a property gives is Data Director's contract, not the standard's, so it stays with the drafter.

The definition says nothing about what a repository requires. A definition has no obligation, no licence list, no form label and no size limit.

A requirement set stays as Deposit describes it: what a repository requires of a record in a standard, written in YAML by the people who know the repository. Its fields name properties of the standard by their path and their qualifier, and their obligation. The term a field is read under comes from the standard's definition. A field of an override for something the standard has no property for, such as a Dataverse contact email, names its own term, and a field may not name a term that differs from the one the standard's definition gives its property. A field may still name its term, as a CURIE or IRI, and the set is refused on load if it differs; one that leaves it out is read under the definition's.

A definition and a requirement set have different owners and change at different rates. A definition describes the format, and changes when the standard does. A set describes a repository's wishes and changes when it changes its form.

The pivot. A record is read as an RDF graph whose subject is the dataset. A property that holds a value becomes a literal of its term, and a property that holds a structure, such as a creator with a name, an identifier and an affiliation, becomes a node whose parts have terms of their own, which a definition lists. A qualifier that says what kind of entry it is, such as DataCite's descriptionType or relationType, is a part too, under dcterms:type, and a definition may give the entries a qualifier selects a term of their own, as DataCite's Methods descriptions are read as dcterms:provenance. Each node keeps the path of the property it came from, so that a reader names what it could not place in the standard's own words, and the record's values that no term holds are listed beside the pivot, never dropped. The validation counts only that a term has a value, as it does today, and a conversion uses the parts. Shapes are generated from the merged requirement set's fields, and pySHACL runs them, as before (Deposit, Validation). The pivot is built for a check, a platform's item or a conversion and is not kept as a record; the package's root dataset properties are written from it.

Drafting in a standard. The Metadata Librarian drafts a record in the standard the merged set follows, from the standard's definition and the project's facts, and writes it through the standard's codec with conforms_to and media_type set. It asks one question for each gap, named by the property's path (invariant 5), and places the researcher's answer as given. It drafts the record as a logical tree in which a gap is None, and the codec's serialisation writes each gap as the definition says (invariant 6), so the questions and their identifiers are the same whatever the serialisation. It writes in the definition's first serialisation. What it fills from a researcher's ORCID record (a creator with an iD and affiliations, keywords, grants) it gives as nodes of the pivot, which the definition writes into the standard's own keys; a part the standard has no key for is left out. Which of the definition's properties is the licence, the keywords, the files' formats and sizes or the schema version, it finds by their pivot terms. A standard that is not registered is an abstention, capability_not_implemented, and so are requirements that name a property the standard's serialisation has no place for. DataCite in JSON and Dublin Core as OAI-DC XML are defined.

Converting a record. A conversion reads a record into the pivot with its standard's definition and writes the pivot into another with the target's, so that n standards need n definitions, not n² converters. A property is placed if it has a pivot term in both. The result lists what was not placed, as a platform's item lists unplaced (Deposit, Depositing through an API), and what was reduced, such as a structured value written as text. A conversion is a package derived from the approved record (invariant 2). A property's cardinality is the definition's: a property whose entries have a value key holds a list, as does one marked repeats (or every property of a definition marked properties_repeat, as Dublin Core's elements are), and a second value for a property that holds one is reported as reduced. A value read under a qualified term is written with the qualifier its rule names, so a DataCite methods description stays one. A gap is not copied.

The harness converts the project's approved record (dd_harness.conversion). It writes the result in the target's first serialisation and reads it back, and checks it against the required fields of the deployment's set for the target standard. If one has no value, nothing is kept: the refusal names each field and says to add it to the approved record and approve it again, since the converter fills in nothing. Otherwise the result is kept by its digest with a package_built event of format metadata-record, which names the approved record by digest (derived_from) and as the document version it is (documents), both definitions by reference and digest, and what was unplaced and reduced. The Repository tab offers the deployment's other standards, lists each conversion with these losses, and downloads it in its own media type (/api/projects/{id}/conversions). A conversion is not deposited: a project has one chosen repository, and its record is drafted in that repository's standard.

Where the code lives. The codecs and definitions are a member of their own, metadata-records/ (distribution data-director-metadata-records), that imports no other member, as inventory/ and mcp-pid/ do not. The harness and each agent that drafts or reads a record depend on it, and the System and boundaries graph says so. It is not in sdk/, which holds only the contract, and not in the harness, which no agent may import. Nothing in it speaks the Data Director contract, so it can be published and used without the rest ("Build for reuse" in the root AGENTS.md); the agents and the harness add the contract's parts, such as classes, evidence and outcomes.

Rationale

  • Definitions beside a requirement-set mechanism that already works. The deposit check already reads a record as RDF through a table and generates its shapes. Taking that table out of the sets, completing it, and letting a set name only what it requires, makes one description of each standard serve validation, packaging, drafting and conversion.
  • One name for a property in every serialisation, so that a researcher's answer, a question's identifier and a requirement stay the same when a record is written in another serialisation.
  • A pivot of existing terms, and a reported loss, not a promise of equivalence. Standards differ in what they can say, and no vocabulary says everything; DataCite has no lineage, and schema.org has no free term for it. Reporting what was not placed is honest, and the researcher or steward can see what a conversion costs before a repository sees the record.
  • Completeness in the definition, not the set. A set lists only what is required or recommended, but a conversion needs every property, so the pivot term lives in the definition.
  • A standard needs no profile key. The profile holds a deployment's choices about what may act on its behalf. A function from a record to bytes is not one, and installing the standard is enough.
  • A member of its own, so that others can use the codecs and mappings without Data Director, as the Build for reuse rules ask, and so that the harness, which depends on sdk/ alone, and the agents do not copy it (scripts/check_duplication.py).

Rejected alternatives

  • DataCite as the canonical model, with every other standard crosswalked through it. DataCite is a citation schema. Everything it cannot hold would be lost on the way through it, and a researcher depositing in DDI or ISO 19115 would be held to a citation record.
  • A Data Director metadata model as the pivot. It would be a fourth format that no repository reads, it would need a mapping to every standard in both directions, and it would invent terms where external ones exist (Contract, Vocabularies).
  • A converter for each pair of standards. n standards would need n² of them, each to review and keep working, and two repositories that take the same standard would share nothing.
  • A drafter for each standard. The questions, the rules against inventing a value and the place of a model are the same for every standard and would be written again for each.
  • JSON-LD as the serialisation of every record. Repositories take their own serialisation, such as OAI-DC or ISO 19139 XML, so a record in JSON-LD would still need writing in it.
  • Standard definitions as deployment configuration beside the requirement sets. A steward who edits a repository's licence list should not be able to change where a standard writes a title. Two kinds of file with two owners need two places.
  • A model that maps or converts at run time. A misread mapping would become the definition of a correct record, and each conversion would differ. The same reasoning rejected requirements drafted by an agent (Deposit, Rejected alternatives). A model may help a person write a definition, which is then reviewed like a set.
  • A published JSON Schema or XSD per standard as the only check. Its errors are not in the validation report's vocabulary (Deposit, Rejected alternatives); see Open questions for what is decided about it.
  • The codecs in sdk/ or in the harness. sdk/ holds only the contract, and an agent may not import the harness. A copy in each agent is what scripts/check_duplication.py exists to stop.

Non-functional requirements

  • Reproducibility. The same tree, definition and codec give the same bytes on any host, so a digest recorded at approval is the digest of what is deposited (invariants 4 and 12).
  • Security. Invariant 13. A record's text is data: it is parsed, never executed, and a parser makes no network call.
  • Portability. The library is pure Python, makes no network call and holds no credential. A dependency it needs, such as an XML parser, is registered in Dependencies with a fallback behind the codec's interface, in the pull request that adds it.
  • Honesty about coverage. A definition says which properties of its standard it covers. A record in a standard that a definition covers only in part says so, as a repository without an override is told its own form is not checked.

Decided

  • The XML parser is the standard library's xml.etree.ElementTree pull parser, behind the codec's interface, so the library needs no new dependency. The codec refuses a document type or entity declaration before parsing, and writes with its own writer so that prefixes are fixed and no process-wide state is touched. If the standard library's parser is ever found wanting, defusedxml is the fallback behind the same interface.
  • Dublin Core is the 15 elements OAI-DC carries, the form a repository harvested over OAI-PMH serves and the one re3data's "Dublin Core" most often means. DCMI Terms refinements would be a definition of their own.
  • A record is checked against its standard's published schema in the library's tests, not by the harness. The OAI-DC XML Schema is kept with the tests (metadata-records/tests/data/xsd/) and a drafted record is validated against it there. The harness's validation stays in the validation report's vocabulary (Deposit, Rejected alternatives).
  • An XML serialisation's layout is the definition's. A definition says, for an XML serialisation, the root element, the namespaces declared on it, the schema it names, and the element each property is written as; the codec turns the document into a tree of elements and knows no standard. Only properties written as repeatable text elements under the root are supported; nested elements are TODO(#1361).
  • Which standard a repository's record is in is the override's; else a person's explicit choice; else the one standard the repository declares that the deployment has a set for; else, of several, the first in the deployment's standard_preference.yaml; else DataCite's. Each choice records why (Deposit, invariant 5). A standard re3data does not list, such as Croissant (#933), is reached by a person's choice once it has a definition and a set.
  • A conversion is a derived package, not a document. A person approves the record in one standard; its conversions are kept by digest beside it and name it, and a conversion that would need a value the record lacks is refused rather than approved on its own (invariant 2). To change a converted record, a person edits and approves the record it came from, and converts again.
  • A gap in OAI-DC is the text :unav, the ERC code for a value not yet available, which the schema accepts, since an element holds a string and no other attribute than xml:lang.

Open questions

  • How a standard's controlled vocabularies are reached and cited is decided for the subject classifications a repository names (ANZSRC, OECD): through the tool gateway, from mcp-subjects, each suggested field citing its record (Drafting documents, invariant 7). Which terminology services keywords and other terms come from: TODO(#956).