Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit OBO prefixes to prefix.cc #1038

Open
cmungall opened this issue Aug 19, 2019 · 7 comments
Open

Submit OBO prefixes to prefix.cc #1038

cmungall opened this issue Aug 19, 2019 · 7 comments
Labels
external resource Issues related to interactions with external (non-Foundry) resources

Comments

@cmungall
Copy link
Contributor

We release prefixes using shacl vocab here: https://raw.githubusercontent.com/OBOFoundry/OBOFoundry.github.io/master/registry/obo_prefixes.ttl

(still need a PURL for this...)

We are now able to submit OBO purls to http://prefix.cc which is maintained by @cygri (see also
cygri/prefix.cc#27). Rather than submit all manually it would be good to figure out an automatic sync.

Or maybe this is better done indirectly via identifiers.org or n2t.net? cc @jkunze

@balhoff
Copy link
Contributor

balhoff commented Aug 19, 2019

Will prefix.cc also start allowing uppercase prefixes?

@jkunze
Copy link

jkunze commented Aug 19, 2019

It would be easy to load, if only to test, that batch of prefixes into n2t.net. I see some conflicts with existing prefixes in n2t.net, such as for CHEBI and DOID; normally, n2t resolves such conflicts by letting the earliest definition take precedence.

@nlharris
Copy link
Contributor

nlharris commented Mar 3, 2020

What is the status of this?

@nlharris nlharris added the external resource Issues related to interactions with external (non-Foundry) resources label Apr 21, 2020
@cygri
Copy link

cygri commented Dec 30, 2020

FYI, prefix.cc has been updated to allow underscores as the final character in a namespace URI.

@cmungall
Copy link
Contributor Author

cmungall commented Jun 1, 2021

Thanks @cygri

How should we progress with synchronizing with prefix.cc (either directly from OBO, or from a registry that consumes from OBO, such as n2t or bioregistry.io?)? Is it possible to have some kind of semi-automated process, or do you recommend manual submission?

It would also be good to be able to batch update prefix.cc. For example, for GO on http://prefix.cc/context you have

"go": "http://purl.org/obo/owl/GO#",

This has not been in use for over a decade

there are other odd entries e.g
"drugbank": "http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/",

@cthoyt
Copy link
Collaborator

cthoyt commented Feb 26, 2023

FYI here's the Python code you'd need to automate updating prefix.cc:

import requests
import bioregistry


def create(curie_prefix: str, uri_prefix: str) -> requests.Response:
    return requests.post(
        f"https://prefix.cc/{curie_prefix}",
        data={"create": uri_prefix},
    )


def main():
    prefix_cc_map = requests.get("https://prefix.cc/context").json()["@context"]
    for record in bioregistry.resources():
        if not record.get_obofoundry_prefix():
            continue
        uri_prefix = record.get_uri_prefix()
        if not uri_prefix:
            continue
        if uri_prefix == prefix_cc_map.get(record.prefix):
            # No need to re-create something that's already
            # both available and correct wrt Bioregistry/OBO
            continue

        print("Creating record for", record.prefix, uri_prefix)
        res = create(record.prefix, uri_prefix)
        print(res.text)

        # We're breaking here since we can only make one
        # update per day
        break


if __name__ == "__main__":
    main()

As of biopragmatics/bioregistry#1056, this is now possible with python -m bioregistry.export.prefixcc

Unfortunately, there seems to be some kind of rate-limiting, and you can only post one per day. @cygri is there the possibility of adding some kind of authentication for trusted posters?

cthoyt added a commit to biopragmatics/bioregistry that referenced this issue Mar 18, 2024
cthoyt added a commit to biopragmatics/bioregistry that referenced this issue Mar 18, 2024
@cthoyt
Copy link
Collaborator

cthoyt commented Mar 18, 2024

I implemented the script from above in a GitHub action in biopragmatics/bioregistry#1056 that will run nightly until it gets all of the OBO Foundry prefixes into Prefix.cc, then will continue with the remaining. Note that this is rate limited to a given IP address at 1 upload per day. The first successful CI run was on: https://github.com/biopragmatics/bioregistry/actions/runs/8325600134/job/22779554502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external resource Issues related to interactions with external (non-Foundry) resources
Projects
None yet
Development

No branches or pull requests

6 participants