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

Re-implementing the N2T ARK Resolver | Biopragmatics #53

Open
utterances-bot opened this issue Apr 13, 2023 · 5 comments
Open

Re-implementing the N2T ARK Resolver | Biopragmatics #53

utterances-bot opened this issue Apr 13, 2023 · 5 comments

Comments

@utterances-bot
Copy link

Re-implementing the N2T ARK Resolver | Biopragmatics

Archival Resource Keys (ARKs) are flavor of persistent identifiers like DOIs, URNs, and Handles that have the benefit of being free, flexible with what metadata gets attached, and natively able to resolve to web pages. Name-to-Thing (N2T) implements a resolver for a variety of ARKs, so this blog post is about how that resolver can be re-implemented with the curies Python package.

https://cthoyt.com/2023/04/11/n2t-ark-resolver.html

Copy link

Cool! Re: the ark:/ to ark: migration, it is intended that any resolver support both the old-style expression (with a / after ark:) and the new one. If you can update to support both, that would be excellent.

well done!

Copy link
Owner

cthoyt commented Apr 13, 2023

I think this is possible, but I can't imagine it being elegant. Some ideas:

  1. if I mount two different resolver apps on different url_prefix's.
  2. Maybe there are also some deep dark magics in URL routing I could use too, but it won'

@dwinston
Copy link

My strategy has been a blanket rewrite-and-redirect in a FastAPI app:

@app.get(
    "/ark:/{naan}/{rest_of_path:path}",
    response_class=RedirectResponse,
    tags=["util"],
    summary="Get ARK (Slash Before NAAN)",
)
async def _ark(naan: ArkNaan, request: Request):
    """normalize request to not have slash (/) preceding ark naan."""
    return RedirectResponse(
        url=str(request.url).replace("ark:/", "ark:"), status_code=301
    )

Source: https://github.com/polyneme/ns/blob/b7650f682421f639a09fb36491e8126eea08c668/xyz_polyneme_ns/main.py#L900

@dwinston
Copy link

I know this can be done at a higher level, e.g. at a reverse proxy level via e.g. an Apache RewriteRule, but it would be nice to work "out of the box" for n2t-ark-resolver.

Copy link

The new URN syntax (RFC 8141) does allow the use of slash, so it is up to the ARK community to decide whether to keep it. So an ARK like ark:/53355/cl010277627 may be left unchanged or converted to URN urn:ark:53355/cl010277627. IMO the version without the slash looks better. I don't know if the ARK alliance is planning to register a URN namespace, but I would welcome such decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants