No project description provided
Project description
prefixmaps
A python library for retrieving semantic prefix maps
A semantic prefix map will map a a prefix (e.g. skos
) to a namespace (e.g http://www.w3.org/2004/02/skos/core#
)
This library is designed to satisfy the following requirements
- coverage of prefixes from multiple different domains
- multiple authorities
- preferred semantic namespace is prioritized over web URLs
- authority preferred prefix is prioritized
- lightweight
- network-independence
- versioned prefix maps
- ability to retrieve latest from external authority on network
Installation
pip install prefixmaps
Usage
to use in combination with curies library:
from prefixmaps.io.parser import load_context, load_multi_context
from curies import Converter
ctxt = load_multi_context(["obo", "bioregistry.upper", "linked_data", "prefixcc"])
converter = Converter.from_prefix_map(ctxt.as_dict())
>>> converter.expand("CHEBI:1")
'http://purl.obolibrary.org/obo/CHEBI_1'
>>> converter.expand("GEO:1")
'http://purl.obolibrary.org/obo/GEO_1'
>>> converter.expand("owl:Class")
'http://www.w3.org/2002/07/owl#Class'
>>> converter.expand("FlyBase:FBgn123")
'http://identifiers.org/fb/FBgn123'
Refresh
By default this will make use of metadata distributed alongside the package. This has certain advantages in terms of reproducibility, but it means if a new ontology or prefix is added to an upstream source you won't see this.
To refresh and use the latest upstream:
ctxt = load_context("obo", refresh=True)
Order
order is significant - sources listed first will take priority. The as_dict method ensures that the map is bijective
Contexts
See the description fields
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for prefixmaps-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f96b4d9b577837c97a4d0143911ae8b16d517ca27409261c8f64b37921e4343 |
|
MD5 | 4988a0301c26b7a53cb2752f927e1e56 |
|
BLAKE2b-256 | 202d650823b303006833fa49322b29f5a44136702ae999874c596985d8652b55 |