ontometer_corpus.paper.github_ontologies¶
Ontologies published on GitHub, as a second list beside the registries.
Part of the resource paper's analysis. The registries hold only the ontologies someone registered; GitHub holds many that were never registered. Matching a random sample of GitHub ontologies against the corpus by ontology IRI gives, per period of first appearance, the share of GitHub ontologies the registries hold (their coverage) and, with the corpus, a two-list (Lincoln-Petersen) estimate of the population both draw from.
Sampling. GitHub's code search covers default branches and files under 384 KB
and returns at most 1,000 results per query, so the files are sampled rather
than listed. Each file type (FILE_TYPES) is split into size bins
(SIZE_EDGES); each bin's total comes from the search, and within each bin a
few randomly placed narrow size windows are listed in full. A file's weight is
its bin's total over the files sampled from that bin.
plan counts the files per (type, size bin).
sample lists the files in the random windows.
enrich fetches each sampled file, reads its ontology IRI, and dates it
by the oldest commit touching its path.
recall checks the search index against repositories the registries name in
their own metadata: for each, whether code search finds a file declaring
an ontology there, with the repository's creation and last-push dates, so
that the index's coverage can be compared across old and recent
repositories. Writes <dir>/recall.csv.
signals for the authored ontologies first committed since SIGNALS_FROM,
looks for signs of LLM assistance: an AI co-author or tool named in
the first commit's message, AI terms in the repository's description
or topics, and a note in the file saying a model generated it.
Writes <dir>/signals.csv.
baseline counts the repositories created on GitHub each year (forks excluded), the
growth of GitHub itself against which the ontologies' growth is read.
Writes <dir>/baseline.csv.
analyse matches the IRIs to the corpus and writes
<dir>/github_ontologies.parquet: one row per distinct
ontology IRI with its earliest first-commit date, its weight,
whether a registry holds it, the registry's earliest release date,
its kind (FILE_KINDS: an authored ontology, or a generated file,
a test or example file, or a shapes file that also declares
owl:Ontology) and the sampling window it was drawn in.
Every API answer is cached under <dir>/cache/, so a rerun reads the cache
and analyse runs offline. Requests go through an authenticated GitHub CLI
(gh api), read-only. The CLI uses GH_TOKEN when it is set, so a
fine-grained token limited to read-only access to public repositories keeps
the harvest off a personal login.
Usage
ontometer-corpus paper github plan --dir DIR ontometer-corpus paper github sample --dir DIR ontometer-corpus paper github enrich --dir DIR ontometer-corpus paper github recall --dir DIR --corpus CORPUS ontometer-corpus paper github analyse --dir DIR --corpus CORPUS ontometer-corpus paper github signals --dir DIR ontometer-corpus paper github baseline --dir DIR
Attributes¶
FILE_TYPES = {'ttl': '"owl:Ontology" extension:ttl', 'owl': '"owl:Ontology" extension:owl', 'rdf': '"owl:Ontology" extension:rdf', 'owx': '"Ontology" extension:owx', 'obo': 'format-version extension:obo'}
module-attribute
¶
SIZE_EDGES = (0, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000, 256000, 384000)
module-attribute
¶
WINDOWS_PER_BIN = 4
module-attribute
¶
FILES_PER_WINDOW = 20
module-attribute
¶
SEED = 0
module-attribute
¶
SEARCH_PAUSE = 6.5
module-attribute
¶
EXCLUDED_KEY = re.compile('^(www\\.w3\\.org/(2002/07/owl|1999/02/22-rdf-syntax-ns|2000/01/rdf-schema|2001/XMLSchema)|(www\\.)?example\\.(org|com|net)|localhost|127\\.0\\.0\\.1)')
module-attribute
¶
FILE_KINDS = {'test or example': (re.compile('(^|/)(tests?|testing|fixtures?|examples?|samples?|demos?|testdata|test-data)(/|$)|_test\\.|test_|\\.test\\.'), re.compile('example|/test')), 'generated': (re.compile('(^|/)(output|build|dist|target|gen|generated|site|public)/|(valueset|codesystem|structuredefinition|searchparameter|conceptmap|capabilitystatement|implementationguide|operationdefinition)-'), re.compile('model\\.geneontology\\.org|/fhir/')), 'shapes': (re.compile('shacl|shapes?(/|\\.|_)'), None)}
module-attribute
¶
SIGNALS_FROM = 2018
module-attribute
¶
BASELINE_FROM = 2008
module-attribute
¶
Classes¶
Cache
¶
JSON answers on disk, keyed by a hash of the request.
Source code in ontometer_corpus/paper/github_ontologies.py
Functions:¶
gh(endpoint, params, include_headers=False)
¶
One read-only GET through the GitHub CLI; returns the JSON body and the raw headers.
Source code in ontometer_corpus/paper/github_ontologies.py
search_count(cache, query)
¶
Source code in ontometer_corpus/paper/github_ontologies.py
search_items(cache, query)
¶
Every result of a query (at most 1,000), as repository, path and commit.
Source code in ontometer_corpus/paper/github_ontologies.py
ontology_iri(text, file_type)
¶
The IRI the file declares as its ontology, or None.
Source code in ontometer_corpus/paper/github_ontologies.py
main()
¶
plan(directory)
¶
Count the files per file type and size bin.
Source code in ontometer_corpus/paper/github_ontologies.py
sample(directory)
¶
List every file in a few random size windows of each bin.
Source code in ontometer_corpus/paper/github_ontologies.py
enrich(directory)
¶
Read each sampled file's ontology IRI and date its first commit.
Source code in ontometer_corpus/paper/github_ontologies.py
recall(directory, corpus)
¶
Does code search find the ontologies of repositories the registries name?
Source code in ontometer_corpus/paper/github_ontologies.py
file_kind(path, iri)
¶
ontology for an authored ontology, else the first matching kind of FILE_KINDS.
Source code in ontometer_corpus/paper/github_ontologies.py
signals(directory)
¶
Signs of LLM assistance in recently committed authored ontologies.
Source code in ontometer_corpus/paper/github_ontologies.py
baseline(directory, until)
¶
Repositories created on GitHub per year, forks excluded.
Source code in ontometer_corpus/paper/github_ontologies.py
analyse(directory, corpus)
¶
One row per distinct GitHub ontology, matched to the registries.