prefixmaps.ingest package
Submodules
prefixmaps.ingest.etl_runner module
prefixmaps.ingest.ingest module
prefixmaps.ingest.ingest_bioregistry module
prefixmaps.ingest.ingest_go module
Ingests the GO prefix registry.
- prefixmaps.ingest.ingest_go.parse_go_xrefs(input)
Parse GO db-xrefs.yaml file.
Note that most entries in the file are ignored. We only extract the “embedded JSON-LD context” which are those marked rdf_uri_prefix, which indicates the semantic expansions used in the triplestore.
- Parameters:
file –
- Return type:
- Returns:
prefixmaps.ingest.ingest_jsonld module
Generic JSON-LD ingests.
- prefixmaps.ingest.ingest_jsonld.from_jsonld_context(jsonld_context, name, excludes=None)
Ingests from a JSON-LD context stored as a dictionary.
Note
Does not support JSON-LD 1.1 contexts.
- Parameters:
jsonld_context (
Dict[str,Any]) –name (
str) –excludes (
Optional[List[str]]) –
- Return type:
- Returns:
- prefixmaps.ingest.ingest_jsonld.from_jsonld_context_file(file, name, excludes=None)
Ingests from a local JSON-LD context.
- Parameters:
file (
Union[TextIO,str]) –name (
str) –excludes (
Optional[List[str]]) –
- Return type:
- Returns:
- prefixmaps.ingest.ingest_jsonld.from_jsonld_context_url(url, name, excludes=None)
Ingests from a remote JSON-LD context.
- Parameters:
url (
str) –name (
str) –excludes (
Optional[List[str]]) –
- Return type:
- Returns:
- prefixmaps.ingest.ingest_jsonld.from_prefixcc()
Ingests from prefix.cc.
Note that prefix.cc is an extremely messy source, but it can be useful for semweb namespaces.
In order to prioritize “better” prefixes we have an exclusion list, that attempts to exclude the most egregious entries, and prioritize more official sources. However, there are still no guarantees as to quality.
Longer term we should focus on the curated linked_data.yaml file, and moving this to bioregistry.
Spam and broken entries listed in prefixcc.excluded.yaml are dropped.
- Return type:
- Returns:
- prefixmaps.ingest.ingest_jsonld.from_prefixcc_snapshot()
Loads the prefix.cc snapshot bundled with this package.
prefix.cc has no curation, so it is not refreshed by default, see https://github.com/linkml/prefixmaps/issues/61. To fix a semweb prefix, add it to linked_data.curated.yaml, which takes precedence over prefix.cc in merged contexts.
Entries listed in prefixcc.excluded.yaml are still dropped, so a new exclusion takes effect on the next ETL run. Canonical expansions come first, so that merging the snapshot gives the same statuses as merging a fresh download. That relies on prefix.cc having no prefix aliases, which holds because its prefixes are unique and lowercase.
- Return type:
- Returns:
- prefixmaps.ingest.ingest_jsonld.is_excluded_from_prefixcc(prefix, namespace, exclusions)
Checks whether a prefix.cc entry is excluded by its prefix or by its namespace’s host.
- Parameters:
prefix (
str) –namespace (
str) –exclusions (
Mapping[str,Mapping[str,str]]) – as returned byload_prefixcc_exclusions()
- Return type:
bool- Returns:
True if the entry must not be imported
- prefixmaps.ingest.ingest_jsonld.load_prefixcc_exclusions(path=PosixPath('/home/runner/work/prefixmaps/prefixmaps/src/prefixmaps/data/prefixcc.excluded.yaml'))
Loads the prefix.cc entries that are never imported.
- Parameters:
path (
Path) – the exclusions file- Return type:
Mapping[str,Mapping[str,str]]- Returns:
the excluded
hostsandprefixes, each mapped to the reason