ontometer_corpus.metadata¶
Projection of raw registry metadata down to the fields the corpus work uses.
Registries return a large JSON document per submission, and it would be stored
twice: in corpus.db and in manifest.jsonl. Verbatim registry responses are
mostly not research data:
linksand@contextare JSON-LD boilerplate, templated URLs repeated once per submission;contact,administeredBy,reviewsandprojectscarry the personal details of ontology maintainers — names and email addresses harvested from registry APIs — which a public corpus should not redistribute.
The allowlist keeps the descriptive fields and drops the contact data. What is left is what the corpus analysis wants: what the ontology is called, what domain it claims, what language it is written in, how it is licensed, and where it came from. That is the input for the domain classification and coverage work.
The projection runs at fetch time, so a new crawl never materialises the dropped fields, and the same function backfills older artifacts.
Attributes¶
SUBMISSION_FIELDS = frozenset({'creationDate', 'deprecated', 'description', 'documentation', 'hasLicense', 'hasOntologyLanguage', 'homepage', 'license', 'publication', 'released', 'status', 'submissionId', 'version'})
module-attribute
¶
ONTOLOGY_FIELDS = frozenset({'acronym', 'group', 'hasDomain', 'name', 'notes', 'ontologyType', 'viewingRestriction'})
module-attribute
¶
DROPPED_FIELDS = frozenset({'@context', 'administeredBy', 'contact', 'contacts', 'email', 'links', 'mailing_list', 'mailingList', 'projects', 'reviews', 'tracker'})
module-attribute
¶
REDACTED = '[email redacted]'
module-attribute
¶
SECRET_REDACTED = 'REDACTED'
module-attribute
¶
Functions:¶
scrub_text(value)
¶
Redact email addresses from retained free text.
description is kept because it is the input the domain-classification
work reads, and some of them mention a maintainer's address in passing.
Redacting the address costs that work nothing — it reads the words,
not the contact details — and keeping it would let personal data into the
corpus through the side door that dropping the contact fields closes.
Source code in ontometer_corpus/metadata.py
redact_secrets(value)
¶
Replace credential query-parameter values in a URL or message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | None
|
A URL, or free text such as an HTTP error that quotes one. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The text with every |
str | None
|
|
Source code in ontometer_corpus/metadata.py
project_registry_metadata(raw)
¶
Reduce one registry metadata document to the fields worth keeping.
Returns an empty dict for anything that is not a mapping, so a registry that changes its response shape degrades to "no metadata" rather than raising in the middle of a crawl.