Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Library for working prefixcommons.org CURIEs

Project description

prefixcommons

A python API for working with ID prefixes in the context of prefixcommons

Current functionality: Uses JSON-LD contexts to expand and contract CURIEs to URIs

E.g. GO:0008150 <=> http://purl.obolibrary.org/obo/GO_0008150

Example

>>> from prefixcommons import contract_uri
>>> print(contract_uri('http://purl.obolibrary.org/obo/GO_0008150'))
GO:0008150

>>> from prefixcommons import expand_uri
>>> print(expand_uri('GOL0008150'))
http://purl.obolibrary.org/obo/GO_0008150

The above uses standard JSON-LD context files from prefixcommons/biocontext

You can pass your own

>>> cmaps = [{'GO': 'http://purl.obolibrary.org/obo/GO_'}]
>>> print(contract_uri('http://purl.obolibrary.org/obo/GO_0008150'), cmaps)
GO:0008150

You can also use a pre-defined context from biocontexts

>>> from prefixcommons import read_biocontext
>>> ctxt = read_biocontext('translator_context')
>>> print(contract_uri('http://purl.obolibrary.org/obo/GO_0008150'), [ctxt])
GO:0008150

Project details


Release history Release notifications

This version
History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
prefixcommons-0.1.7-py3.6.egg (5.1 kB) Copy SHA256 hash SHA256 Egg 3.6 May 8, 2018
prefixcommons-0.1.7-py3-none-any.whl (5.5 kB) Copy SHA256 hash SHA256 Wheel py3 May 8, 2018
prefixcommons-0.1.7.tar.gz (4.4 kB) Copy SHA256 hash SHA256 Source None May 8, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page