ontometer_corpus.steps.fetch_ontologies¶
Ontology bulk fetcher (orchestrator).
About
Thin orchestrator that drives the per-source fetcher modules in
ontometer_corpus.fetchers and writes results to a consolidated
manifest.jsonl in the corpus directory.
Raw files go into the content-addressed object store under
<store>/objects/. Every download attempt, successful or not,
produces one FetchRecord (see ontometer_corpus.fetchers._base) that is
appended to manifest.jsonl (one JSON object per line) with status
ok or fail. Failures are also written to fetch_failures.log
in the corpus directory. Source_ids already captured with status ok are
skipped on a re-run; failed ones are retried.
--sources selects the non-OntoPortal fetchers (LOV, OBO, OKG, Ontohub); --ontoportal selects OntoPortal Alliance instance(s). Independent instances can be run concurrently as separate processes, since each has its own host and rate limit.
API keys are read from the environment only, one variable per OntoPortal
instance (BIOPORTAL, AGROPORTAL, …); an instance without its key
is skipped.
Usage
ontometer-corpus fetch --store /path/to/store --sources all ontometer-corpus fetch --store /path/to/store --ontoportal BioPortal ONTOMETER_STORE=/path/to/store ontometer-corpus fetch --sources lov,okg
Attributes¶
ONTOPORTAL_INSTANCES = [OntoPortalInstance('BioPortal', 'bp', 'https://data.bioontology.org', os.environ.get('BIOPORTAL', '')), OntoPortalInstance('AgroPortal', 'agroportal', 'https://data.agroportal.eu', os.environ.get('AGROPORTAL', '')), OntoPortalInstance('BiodivPortal', 'biodivportal', 'https://data.biodivportal.gfbio.org', os.environ.get('BIODIVPORTAL', '')), OntoPortalInstance('MatPortal', 'matportal', 'https://rest.matportal.org', os.environ.get('MATPORTAL', '')), OntoPortalInstance('OntoPortal-Astro', 'ontoportalastro', 'https://data.ontoportal-astro.eu', os.environ.get('ONTOPORTAL_ASTRO', '')), OntoPortalInstance('TechnoPortal', 'technoportal', 'https://data.technoportal.hevs.ch', os.environ.get('TECHNOPORTAL', ''))]
module-attribute
¶
SOURCE_NAMES = ('lov', 'obo', 'okg', 'ontohub')
module-attribute
¶
Classes¶
Functions:¶
load_captured_source_ids(manifest_path)
¶
Return the set of source_ids already captured (status 'ok') in a previous run, so they can be skipped. Failed attempts are NOT included — they are retried on the next run.
Source code in ontometer_corpus/steps/fetch_ontologies.py
build_source_fetchers(fail_log, objects_dir, manifest)
¶
Bind every non-OntoPortal fetcher to this run's resolved paths.
Returns a mapping from source name to a callable taking
(session, resume) and returning list[FetchRecord], so main()
can dispatch every selected source the same way.
Source code in ontometer_corpus/steps/fetch_ontologies.py
main(sources, ontoportal, paths)
¶
Fetch ontologies from the registries into the object store and the manifest.
Each OntoPortal instance is an independent host with its own rate limit and API key, so instances can run as parallel processes. All of them append to the same manifest.jsonl, which is safe: each appends only its own records.
ontometer-corpus fetch --sources lov,okg --ontoportal BioPortal ontometer-corpus fetch --sources all ontometer-corpus fetch --ontoportal AgroPortal &
Source code in ontometer_corpus/steps/fetch_ontologies.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |