Skip to content

Commit

Permalink
Merge pull request #40 from linkml/release-0.1.5
Browse files Browse the repository at this point in the history
Release 0.1.5
  • Loading branch information
cmungall authored Apr 11, 2023
2 parents b616759 + 8585fac commit cfac82f
Show file tree
Hide file tree
Showing 10 changed files with 1,331 additions and 1,079 deletions.
30 changes: 18 additions & 12 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Introuction
# Introduction

A python library for retrieving semantic prefix maps

Expand All @@ -10,7 +10,7 @@ This library is designed to satisfy the following requirements
- no single authoritative source of either prefixes or prefix-namespace mappings (clash-resilient)
- preferred semantic namespace is prioritized over web URLs
- authority preferred prefix is prioritized where possible
- each individual prefixmap is case-insenstive bijective
- each individual prefixmap is case-insensitive bijective
- prefixmap composition and custom ordering of prefixmaps
- lightweight / low footprint
- fast (TODO)
Expand All @@ -28,11 +28,12 @@ pip install prefixmaps
to use in combination with [curies](https://github.com/cthoyt/curies) library:

```python
from prefixmaps.io.parser import load_context, load_multi_context
from prefixmaps.io.parser import 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())
context = load_multi_context(["obo", "bioregistry.upper", "linked_data", "prefixcc"])
extended_prefix_map = context.as_extended_prefix_map()
converter = Converter.from_extended_prefix_map(extended_prefix_map)

>>> converter.expand("CHEBI:1")
'http://purl.obolibrary.org/obo/CHEBI_1'
Expand All @@ -54,7 +55,8 @@ If we prioritize prefix.cc the OBO prefix is ignored:

```python
>>> ctxt = load_multi_context(["prefixcc", "obo"])
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> extended_prefix_map = context.as_extended_prefix_map()
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter.expand("GEO:1")
>>> converter.expand("geo:1")
'http://www.opengis.net/ont/geosparql#1'
Expand All @@ -66,7 +68,8 @@ If we push bioregistry at the start of the list then GEOGEO can be used as the p

```python
>>> ctxt = load_multi_context(["bioregistry", "prefixcc", "obo"])
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> extended_prefix_map = context.as_extended_prefix_map()
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter.expand("geo:1")
'http://identifiers.org/geo/1'
>>> converter.expand("GEO:1")
Expand All @@ -80,9 +83,10 @@ We get similar results using the upper-normalized variant of bioregistry:

```python
>>> ctxt = load_multi_context(["bioregistry.upper", "prefixcc", "obo"])
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> extended_prefix_map = context.as_extended_prefix_map()
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter.expand("GEO:1")
'http://identifiers.org/geo/1'
>>> converter.expand("geo:1")
Expand All @@ -94,7 +98,8 @@ Users of OBO ontologies will want to place OBO at the start of the list:

```python
>>> ctxt = load_multi_context(["obo", "bioregistry.upper", "prefixcc"])
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> extended_prefix_map = context.as_extended_prefix_map()
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter.expand("geo:1")
>>> converter.expand("GEO:1")
'http://purl.obolibrary.org/obo/GEO_1'
Expand All @@ -109,7 +114,8 @@ You can use the ready-made "merged" prefix set, which prioritizes OBO:

```python
>>> ctxt = load_context("merged")
>>> converter = Converter.from_prefix_map(ctxt.as_dict())
>>> extended_prefix_map = context.as_extended_prefix_map()
>>> converter = Converter.from_extended_prefix_map(extended_prefix_map)
>>> converter.expand("GEOGEO:1")
>>> converter.expand("GEO:1")
'http://purl.obolibrary.org/obo/GEO_1'
Expand Down
1,981 changes: 988 additions & 993 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ homepage = "https://github.com/linkml/prefixmaps"
[tool.poetry.dependencies]
python = "^3.7.6"
pyyaml = ">=5.3.1"
greenlet = "2.0.1"
importlib-metadata = ">=1.0.0"
sphinx-rtd-theme = {version = "^1.0.0", extras = ["docs"]}
Sphinx = {version = "^5.3.0", extras = ["docs"]}
Expand All @@ -33,13 +34,13 @@ myst-parser = {version = "^0.18.1", extras = ["docs"]}
click = "^8.1.3"
typing-extensions = "^4.4.0"
requests = {version = "^2.28.1", extras = ["refresh"]}
bioregistry = {version = "^0.6.0", extras = ["refresh"]}
bioregistry = {version = "^0.8.0", extras = ["refresh"]}
rdflib = {version = "^6.2.0", extras = ["refresh"]}

[tool.poetry.dev-dependencies]
pytest = "^5.2"
pytest = "^6.2"
linkml = "^1.3.1"
curies = "^0.4.0"
curies = "^0.5.3"
coverage = "^6.4.4"

[tool.poetry.extras]
Expand Down
Loading

0 comments on commit cfac82f

Please sign in to comment.