Skip to content

Commit

Permalink
Add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Nov 2, 2023
1 parent 200f4e4 commit 3a899bd
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion exports/contexts/obo.context.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"PLANA": "http://purl.obolibrary.org/obo/PLANA_",
"PLANP": "http://purl.obolibrary.org/obo/PLANP_",
"PLO": "http://purl.obolibrary.org/obo/PLO_",
"PMID": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"PMID": "https://www.ncbi.nlm.nih.gov/pubmed/",
"PO": "http://purl.obolibrary.org/obo/PO_",
"PORO": "http://purl.obolibrary.org/obo/PORO_",
"PPO": "http://purl.obolibrary.org/obo/PPO_",
Expand Down
2 changes: 1 addition & 1 deletion exports/contexts/obo.context.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
[ sh:prefix "PLANA" ; sh:namespace "http://purl.obolibrary.org/obo/PLANA_"^^xsd:anyURI ; sh:pattern "^\\d{7}$" ],
[ sh:prefix "PLANP" ; sh:namespace "http://purl.obolibrary.org/obo/PLANP_"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PLO" ; sh:namespace "http://purl.obolibrary.org/obo/PLO_"^^xsd:anyURI ],
[ sh:prefix "PMID" ; sh:namespace "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PMID" ; sh:namespace "https://www.ncbi.nlm.nih.gov/pubmed/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PO" ; sh:namespace "http://purl.obolibrary.org/obo/PO_"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PORO" ; sh:namespace "http://purl.obolibrary.org/obo/PORO_"^^xsd:anyURI ; sh:pattern "^\\d{7}$" ],
[ sh:prefix "PPO" ; sh:namespace "http://purl.obolibrary.org/obo/PPO_"^^xsd:anyURI ; sh:pattern "^\\d{7}$" ],
Expand Down
6 changes: 3 additions & 3 deletions exports/contexts/obo.epm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4366,7 +4366,7 @@
"pmid",
"pubmed"
],
"uri_prefix": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"uri_prefix": "https://www.ncbi.nlm.nih.gov/pubmed/",
"uri_prefix_synonyms": [
"http://bio2rdf.org/pubmed:",
"http://bioregistry.io/MEDLINE:",
Expand All @@ -4382,6 +4382,7 @@
"http://pubmed.ncbi.nlm.nih.gov/",
"http://purl.uniprot.org/citations/",
"http://purl.uniprot.org/pubmed/",
"http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"http://scholia.toolforge.org/pubmed/",
"http://www.hubmed.org/display.cgi?uids=",
"http://www.ncbi.nlm.nih.gov/pubmed/",
Expand All @@ -4401,8 +4402,7 @@
"https://purl.uniprot.org/pubmed/",
"https://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"https://scholia.toolforge.org/pubmed/",
"https://www.hubmed.org/display.cgi?uids=",
"https://www.ncbi.nlm.nih.gov/pubmed/"
"https://www.hubmed.org/display.cgi?uids="
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions exports/contexts/obo_synonyms.context.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"MC": "http://purl.obolibrary.org/obo/MC_",
"MCO": "http://purl.obolibrary.org/obo/MCO_",
"MCRO": "http://purl.obolibrary.org/obo/MCRO_",
"MEDLINE": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"MEDLINE": "https://www.ncbi.nlm.nih.gov/pubmed/",
"MEDRA": "http://purl.bioontology.org/ontology/MDRFRE/",
"MESH": "http://id.nlm.nih.gov/mesh/",
"MESHA": "http://id.nlm.nih.gov/mesh/",
Expand Down Expand Up @@ -437,7 +437,7 @@
"PLO": "http://purl.obolibrary.org/obo/PLO_",
"PMC": "http://europepmc.org/articles/",
"PMCID": "http://europepmc.org/articles/",
"PMID": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"PMID": "https://www.ncbi.nlm.nih.gov/pubmed/",
"PO": "http://purl.obolibrary.org/obo/PO_",
"PORO": "http://purl.obolibrary.org/obo/PORO_",
"PPO": "http://purl.obolibrary.org/obo/PPO_",
Expand All @@ -459,7 +459,7 @@
"Progenetix": "https://progenetix.org/services/ids/",
"PuRO": "http://purl.org/spar/pro/",
"PubChem_Compound_CID": "http://rdf.ncbi.nlm.nih.gov/pubchem/compound/CID",
"PubMed": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"PubMed": "https://www.ncbi.nlm.nih.gov/pubmed/",
"Pubchem": "http://rdf.ncbi.nlm.nih.gov/pubchem/compound/CID",
"RBO": "http://purl.obolibrary.org/obo/RBO_",
"RCSB_PDB": "https://rdf.wwpdb.org/pdb/",
Expand Down Expand Up @@ -1657,7 +1657,7 @@
"pmap.substratedb": "https://identifiers.org/pmap.substratedb:",
"pmc": "http://europepmc.org/articles/",
"pmdb": "https://bioinformatics.cineca.it/PMDB/user//search.php?idsearch=",
"pmid": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"pmid": "https://www.ncbi.nlm.nih.gov/pubmed/",
"pmp": "http://purl.uniprot.org/uniprot/",
"pmr": "https://models.physiomeproject.org/exposure/",
"pmr.workspace": "https://models.physiomeproject.org/workspace/",
Expand Down Expand Up @@ -1697,7 +1697,7 @@
"pubchem_id": "http://rdf.ncbi.nlm.nih.gov/pubchem/compound/CID",
"publons.publication": "https://publons.com/publon/",
"publons.researcher": "https://publons.com/researcher/",
"pubmed": "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/",
"pubmed": "https://www.ncbi.nlm.nih.gov/pubmed/",
"px": "http://proteomecentral.proteomexchange.org/cgi/GetDataset?ID=",
"pypi": "https://pypi.org/project/",
"qb": "http://purl.org/linked-data/cube#",
Expand Down
10 changes: 5 additions & 5 deletions exports/contexts/obo_synonyms.context.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@
[ sh:prefix "PLANA" ; sh:namespace "http://purl.obolibrary.org/obo/PLANA_"^^xsd:anyURI ; sh:pattern "^\\d{7}$" ],
[ sh:prefix "PLANP" ; sh:namespace "http://purl.obolibrary.org/obo/PLANP_"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PLO" ; sh:namespace "http://purl.obolibrary.org/obo/PLO_"^^xsd:anyURI ],
[ sh:prefix "PMID" ; sh:namespace "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "MEDLINE" ; sh:namespace "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PubMed" ; sh:namespace "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "pmid" ; sh:namespace "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "pubmed" ; sh:namespace "http://rdf.ncbi.nlm.nih.gov/pubchem/reference/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PMID" ; sh:namespace "https://www.ncbi.nlm.nih.gov/pubmed/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "MEDLINE" ; sh:namespace "https://www.ncbi.nlm.nih.gov/pubmed/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PubMed" ; sh:namespace "https://www.ncbi.nlm.nih.gov/pubmed/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "pmid" ; sh:namespace "https://www.ncbi.nlm.nih.gov/pubmed/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "pubmed" ; sh:namespace "https://www.ncbi.nlm.nih.gov/pubmed/"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PO" ; sh:namespace "http://purl.obolibrary.org/obo/PO_"^^xsd:anyURI ; sh:pattern "^\\d+$" ],
[ sh:prefix "PORO" ; sh:namespace "http://purl.obolibrary.org/obo/PORO_"^^xsd:anyURI ; sh:pattern "^\\d{7}$" ],
[ sh:prefix "PPO" ; sh:namespace "http://purl.obolibrary.org/obo/PPO_"^^xsd:anyURI ; sh:pattern "^\\d{7}$" ],
Expand Down
4 changes: 4 additions & 0 deletions src/bioregistry/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ def get_prefix_map(
prefix_priority: Optional[Sequence[str]] = None,
include_synonyms: bool = False,
remapping: Optional[Mapping[str, str]] = None,
rewiring: Optional[Mapping[str, str]] = None,
blacklist: Optional[typing.Collection[str]] = None,
) -> Mapping[str, str]:
"""Get a mapping from Bioregistry prefixes to their URI prefixes .
Expand All @@ -743,13 +744,15 @@ def get_prefix_map(
:param include_synonyms: Should synonyms of each prefix also be included as additional prefixes, but with
the same URI prefix?
:param remapping: A mapping from Bioregistry prefixes to preferred prefixes.
:param rewiring: A mapping from Bioregistry prefixes to URI prefixes.
:param blacklist: Prefixes to skip
:return: A mapping from prefixes to URI prefixes.
"""
converter = self.get_converter(
prefix_priority=prefix_priority,
uri_prefix_priority=uri_prefix_priority,
remapping=remapping,
rewiring=rewiring,
blacklist=blacklist,
)
rv = {}
Expand Down Expand Up @@ -1610,6 +1613,7 @@ def get_context_artifacts(
prefix_priority=context.prefix_priority,
include_synonyms=include_synonyms,
blacklist=context.blacklist,
rewiring=context.custom_prefix_map,
)
prescriptive_pattern_map = self.get_pattern_map(
remapping=context.prefix_remapping,
Expand Down
1 change: 1 addition & 0 deletions tests/test_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def test_obo_converter(self):
self.assertEqual("Orphanet", converter.standardize_prefix("ordo"))
self.assertEqual("GO", converter.standardize_prefix("GO"))
self.assertEqual("GO", converter.standardize_prefix("gomf"))
self.assertEqual("https://www.ncbi.nlm.nih.gov/pubmed/", converter.bimap["PMID"])
# FIXME later, handle adding canonical bioregistry prefix
# as synonym when non-default prefix priority ordering is given
# self.assertEqual("GO", converter.standardize_prefix("go"))
Expand Down

0 comments on commit 3a899bd

Please sign in to comment.