ontometer_corpus.dating¶
When an ontology first existed: the earliest date any source attests to it.
No single source dates an ontology's birth. A registry records when it took a submission, so a mirror portal that loaded a long-established ontology last year dates it last year; a web archive records its first crawl of the IRI, which lags publication and misses IRIs that moved; knowledge bases record an inception date for a minority of ontologies. Each is therefore an upper bound on the birth date, and the earliest of them is the tightest bound available — the first-evidence date.
A second bound comes from the dependency structure itself: a class cannot be
specialised before it exists, so an ontology existed no later than the first
observed specialisation of one of its classes. :func:bound_births applies
that bound.
Attributes¶
EARLIEST_PLAUSIBLE = '1995-01-01'
module-attribute
¶
Classes¶
DatingConsistency
dataclass
¶
How often specialisations point from a younger ontology to an older one.
Attributes:
| Name | Type | Description |
|---|---|---|
n_pairs |
int
|
specialisation pairs with both ends dated. |
share |
float
|
share of those pairs whose child is born no earlier than its parent. |
null_mean |
float
|
the same share, averaged over permutations of the birth dates. |
null_q975 |
float
|
97.5th percentile of the permuted shares. |
Source code in ontometer_corpus/dating.py
Functions:¶
iri_match_key(iri)
¶
Matching key of an ontology IRI: scheme-less, lower-cased, extension-stripped.
https://example.org/onto.owl# and http://example.org/onto get the
same key; used to link rows of one ontology across registries. The key is
not an IRI and is not meant to be dereferenced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iri
|
str | None
|
an ontology IRI, or None. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The key without scheme, trailing |
str | None
|
extension; None for a missing, non-string or empty input. |
Source code in ontometer_corpus/dating.py
archive_candidates(iri)
¶
URLs under which a web archive may have captured an ontology IRI.
The IRI itself (scheme-less, separators stripped), and for OBO PURLs also
the .owl download, which is what crawlers usually saw. IRIs without a
host — local file paths an author left in place — have none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iri
|
str | None
|
an ontology IRI, or None. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Scheme-less candidate URLs, possibly empty. |
Source code in ontometer_corpus/dating.py
archive_timestamp_date(ts)
¶
ISO date of a YYYYMMDDhhmmss capture timestamp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ts
|
str | None
|
a web-archive capture timestamp, or None. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
|
str | None
|
eight digits. |
Source code in ontometer_corpus/dating.py
plausible(date, latest)
¶
date truncated to YYYY-MM-DD if it lies in the plausible range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
str | None
|
an ISO date or datetime string; a bare year becomes 1 January. |
required |
latest
|
str
|
the latest acceptable |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The truncated date if it lies in |
str | None
|
otherwise None. |
Source code in ontometer_corpus/dating.py
earliest(dates)
¶
The minimum of the ISO dates given, ignoring missing ones.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dates
|
Iterable[str | float | None]
|
ISO date strings; None, NaN and empty strings are skipped. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The earliest date, or None when none is present. |
Source code in ontometer_corpus/dating.py
bound_births(births, parent, edge_time)
¶
Bound each ontology's birth by the time it was first observed being specialised.
births holds days since an epoch (NaN when unknown); specialisation
i of a class of parent[i] was observed at edge_time[i] (NaN when
unknown). A class exists before anything specialises it, so the result is
min(births[p], edge_time[i] for every i with parent[i] == p); an undated
parent with a dated specialisation becomes dated.
The bound is applied once, not chained: an ontology observed to exist early is not thereby observed to have made its own specialisations early.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
births
|
ndarray
|
birth per ontology, in days since an epoch. |
required |
parent
|
ndarray
|
parent ontology index of each specialisation. |
required |
edge_time
|
ndarray
|
observation time of each specialisation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The bounded birth per ontology, same shape as |
Source code in ontometer_corpus/dating.py
time_pairs(birth, release, child, parent, panel_first)
¶
Arrival time of each specialisation pair, and the bounded births.
All times are days since an epoch, NaN when unknown. Pair i says
child[i] specialises a class of parent[i]; panel_first[i] is the
first release of the child that asserts it, where the child's release
history is known.
- Arrival:
panel_firstwhere known, otherwise the child's first evidencebirth[child]— an assumption that the pair dates from the child's first release. - Bounded birth: :func:
bound_birthsover observed times only — the first release asserting the pair, or the child's captured releaserelease[child]. The assumed arrival never moves a parent's birth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
birth
|
ndarray
|
first-evidence birth per ontology. |
required |
release
|
ndarray
|
captured release date per ontology. |
required |
child
|
ndarray
|
child ontology index of each pair. |
required |
parent
|
ndarray
|
parent ontology index of each pair. |
required |
panel_first
|
ndarray
|
first release of the child asserting each pair. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
ndarray
|
than its parent's birth. |
Source code in ontometer_corpus/dating.py
dating_consistency(births, child, parent, reps=500, seed=0)
¶
Check dates against the specialisation network.
A child that specialises a parent's class should not be born before the parent. Correct dates make that the rule; dates unrelated to the network leave it at the share a random assignment gives, which the permutation null estimates by shuffling the births among the dated ontologies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
births
|
ndarray
|
birth per ontology, in days since an epoch (NaN when unknown). |
required |
child
|
ndarray
|
child ontology index of each specialisation pair. |
required |
parent
|
ndarray
|
parent ontology index of each specialisation pair. |
required |
reps
|
int
|
number of permutations. |
500
|
seed
|
int
|
seed of the permutation generator. |
0
|
Returns:
| Type | Description |
|---|---|
DatingConsistency
|
The observed share and its permutation null. |